fix(llmobs): avoid missing ml app error if llmobs is disabled [backport 3.9] #13737
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 17ce936 from #13717 to 3.9.
Our
_start_span()
method does a bunch of llmobs-instrumentation/modifications under the hood, even if LLMObs is disabled. Specifically our llm/task/tool/agent/retrieval/workflow/embeddings() methods only log a warning if ML_APP is missing, but still route to our_start_span()
method, which then continues on to do a ML_APP check (and raises if this is missing), even if LLMObs is disabled. This means if ML_APP is missing, any manual instrumentation will break customer apps if they disable LLMObs.We need to make
_start_span()
a no-op wrapper aroundtracer.trace(...)
. This fix ensures that if llmobs is disabled, we return the span immediately before we start doing llmobs-specific logic.Checklist
Reviewer Checklist