Commit 71e53e0
fix(llmobs): clear meta_struct on user-processor span omit
When a user span_processor returns None to drop an LLMObs span, also
clear meta_struct["_llmobs"] off the underlying APM span. Previously
the early return in _prepare_llmobs_span_data left the LLMObs payload
in place. That's a no-op today (the LLMObs writer never enqueued, and
APM doesn't read meta_struct["_llmobs"] yet), but it becomes a leak
post-convergence (MLOB-4925): once APM ships meta_struct["_llmobs"] to
the LLMObs backend, an "omitted" span whose payload was left intact
would arrive at LLMObs anyway — exactly the data the user told us to
drop.
The scrub is unconditional: it overrides _DD_LLMOBS_TEST_KEEP_META_STRUCT
because the omit contract is "no LLMObs data on this span", regardless
of test mode. The env var only suppresses the kept-path scrub (where
data must survive for assertions).
Rewrites test_processor_omit_span to assert directly on the contract:
omit ⇒ _get_llmobs_data_metastruct(span) == {}, kept ⇒ payload intact.
The test no longer references llmobs_events, so the only remaining
llmobs_events callsite in tests/llmobs/ is
test_malformed_span_logs_error_instead_of_raising — which legitimately
checks "no event was emitted" for a malformed span and stays on the
existing fixture.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4f2a51a commit 71e53e0
2 files changed
Lines changed: 17 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
596 | 600 | | |
597 | 601 | | |
598 | 602 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
208 | 207 | | |
209 | 208 | | |
210 | 209 | | |
| |||
0 commit comments