-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(llmobs): add parent ID handling for integration-generated spans #9417
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yun-Kim
added
changelog/no-changelog
A changelog entry is not required for this PR.
backport 2.9
labels
May 28, 2024
sabrenner
approved these changes
May 28, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
Yun-Kim
force-pushed
the
yunkim/llmobs-fix-integration-propagation
branch
from
May 28, 2024 20:49
56b4885
to
1290d8d
Compare
Datadog ReportBranch report: ✅ 0 Failed, 2088 Passed, 1447 Skipped, 59m 44.68s Total duration (26m 54.99s time saved) |
Yun-Kim
force-pushed
the
yunkim/llmobs-fix-integration-propagation
branch
from
May 28, 2024 21:22
1290d8d
to
0d4c6fa
Compare
Yun-Kim
force-pushed
the
yunkim/llmobs-fix-integration-propagation
branch
2 times, most recently
from
May 28, 2024 22:43
3bffafb
to
2995819
Compare
Yun-Kim
force-pushed
the
yunkim/llmobs-fix-integration-propagation
branch
from
May 29, 2024 00:44
2995819
to
7e6af37
Compare
Yun-Kim
force-pushed
the
yunkim/llmobs-fix-integration-propagation
branch
from
May 29, 2024 00:45
7e6af37
to
f2732a7
Compare
17 tasks
auto-merge was automatically disabled
May 29, 2024 01:18
Pull request was closed
github-actions bot
pushed a commit
that referenced
this pull request
May 29, 2024
…9417) This PR adds a fix to add handling for integration-generated spans for LLMObs parent ID propagation. #9152 added a edge case handling in `LLMObs._start_span()` if the span was part of the first service in a distributed trace, in which case we would need to check the `span.get_tag(PROPAGATED_PARENT_KEY)` due to the distributed header being propagated upwards to the local root of the original service at span finish time (but would always be propagated to all spans in subsequent services at span start time). Integration (openai, bedrock, langchain) generated spans use `BaseLLMIntegration.trace(...)` instead of `LLMObs._start_span()` so we needed to add handling here. ## Checklist - [x] Change(s) are motivated and described in the PR description - [x] Testing strategy is described if automated tests are not included in the PR - [x] Risks are described (performance impact, potential for breakage, maintainability) - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed or label `changelog/no-changelog` is set - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)) - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) - [x] If this PR changes the public interface, I've notified `@DataDog/apm-tees`. ## Reviewer Checklist - [x] Title is accurate - [x] All changes are related to the pull request's stated goal - [x] Description motivates each change - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - [x] Testing strategy adequately addresses listed risks - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] Release note makes sense to a user of the library - [x] Author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) (cherry picked from commit 538a024)
17 tasks
Yun-Kim
added a commit
that referenced
this pull request
May 29, 2024
…backport 2.9] (#9422) Backport 538a024 from #9417 to 2.9. This PR adds a fix to add handling for integration-generated spans for LLMObs parent ID propagation. #9152 added a edge case handling in `LLMObs._start_span()` if the span was part of the first service in a distributed trace, in which case we would need to check the `span.get_tag(PROPAGATED_PARENT_KEY)` due to the distributed header being propagated upwards to the local root of the original service at span finish time (but would always be propagated to all spans in subsequent services at span start time). Integration (openai, bedrock, langchain) generated spans use `BaseLLMIntegration.trace(...)` instead of `LLMObs._start_span()` so we needed to add handling here. ## Checklist - [x] Change(s) are motivated and described in the PR description - [x] Testing strategy is described if automated tests are not included in the PR - [x] Risks are described (performance impact, potential for breakage, maintainability) - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed or label `changelog/no-changelog` is set - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)) - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) - [x] If this PR changes the public interface, I've notified `@DataDog/apm-tees`. ## Reviewer Checklist - [x] Title is accurate - [x] All changes are related to the pull request's stated goal - [x] Description motivates each change - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - [x] Testing strategy adequately addresses listed risks - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] Release note makes sense to a user of the library - [x] Author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: Yun Kim <[email protected]>
Yun-Kim
added a commit
that referenced
this pull request
May 30, 2024
NOTE to apm-python reviewers: The only files this PR touches outside of LLM Observability ownership are snapshot files. This PR expands on #9417 by only set span.span_type = "llm" if LLMObs is enabled. This means that we will not even attempt to process the given span (i.e. set temporary LLMObs tags), which should minimize when the affect LLMObs code has outside of LLMObs contexts. The majority of this PR's LOC involves modifying all openai/langchain/bedrock snapshot files to remove "type":"llm". Existing tests should cover the reverted functionality. ## Checklist - [x] Change(s) are motivated and described in the PR description - [x] Testing strategy is described if automated tests are not included in the PR - [x] Risks are described (performance impact, potential for breakage, maintainability) - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed or label `changelog/no-changelog` is set - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)) - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) - [x] If this PR changes the public interface, I've notified `@DataDog/apm-tees`. ## Reviewer Checklist - [x] Title is accurate - [x] All changes are related to the pull request's stated goal - [x] Description motivates each change - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - [x] Testing strategy adequately addresses listed risks - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] Release note makes sense to a user of the library - [x] Author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
brettlangdon
pushed a commit
that referenced
this pull request
Jun 1, 2024
NOTE to apm-python reviewers: The only files this PR touches outside of LLM Observability ownership are snapshot files. This PR expands on #9417 by only set span.span_type = "llm" if LLMObs is enabled. This means that we will not even attempt to process the given span (i.e. set temporary LLMObs tags), which should minimize when the affect LLMObs code has outside of LLMObs contexts. The majority of this PR's LOC involves modifying all openai/langchain/bedrock snapshot files to remove "type":"llm". Existing tests should cover the reverted functionality. ## Checklist - [x] Change(s) are motivated and described in the PR description - [x] Testing strategy is described if automated tests are not included in the PR - [x] Risks are described (performance impact, potential for breakage, maintainability) - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed or label `changelog/no-changelog` is set - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)) - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) - [x] If this PR changes the public interface, I've notified `@DataDog/apm-tees`. ## Reviewer Checklist - [x] Title is accurate - [x] All changes are related to the pull request's stated goal - [x] Description motivates each change - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - [x] Testing strategy adequately addresses listed risks - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] Release note makes sense to a user of the library - [x] Author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
This PR adds a fix to add handling for integration-generated spans for LLMObs parent ID propagation. #9152 added a edge case handling in
LLMObs._start_span()
if the span was part of the first service in a distributed trace, in which case we would need to check thespan.get_tag(PROPAGATED_PARENT_KEY)
due to the distributed header being propagated upwards to the local root of the original service at span finish time (but would always be propagated to all spans in subsequent services at span start time).Integration (openai, bedrock, langchain) generated spans use
BaseLLMIntegration.trace(...)
instead ofLLMObs._start_span()
so we needed to add handling here.Checklist
changelog/no-changelog
is set@DataDog/apm-tees
.Reviewer Checklist