wildedge-python icon indicating copy to clipboard operation
wildedge-python copied to clipboard

Non-scalar span attribute makes the server reject the whole event batch

Open piotrekno1 opened this issue 1 month ago • 0 comments

What happens

SpanContextManager.set_attributes() (wildedge/client.py:223) accepts any value. If one value is a list, e.g. span.set_attributes(rejections=["English", "too long"]), ingest answers 422 (span attributes['rejections'] must be a scalar) and every event in that batch is dropped: model loads, inferences and spans that had nothing to do with the bad attribute.

Found while integrating a llama.cpp + Whisper app; a whole run's telemetry disappeared because of one attribute.

Expected

One bad value should never cost unrelated events. Options, roughly in order of preference:

  1. Validate in set_attributes() / span constructor: drop (or str()) non-scalar values and log a warning once.
  2. Coerce lists of scalars to a joined string (plus a <key>_count?) — that's what we did app-side as a workaround.
  3. On a 422 that names a field, retry the batch without the offending event instead of dropping all of it.

Repro

client = wildedge.init()
with client.trace(run_id="r"):
    with client.span(kind="custom", name="s") as span:
        span.set_attributes(tags=["a", "b"])
client.close(timeout=5)  # batch rejected with 422, nothing ingested

SDK 0.2.2.

🤖 Generated with Claude Code

piotrekno1 avatar Oct 19 '26 19:10 piotrekno1