-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(llmobs): allow users to toggle on/off sending llmobs data (#9242)
This PR decouples starting/stopping LLMObs traces locally and sending trace data to the LLMObs backend. Previously these two concepts were tied together and configured through the `enable()` and `DD_LLMOBS_ENABLED` environment variable. This is problematic because it results in instrumented code to break if `DD_LLMOBS_ENABLED` is false or the `enable()` function is not explicitly called (since starting spans returns `None` if llmobs is not enabled). This is a) inconvenient when unit testing b) prevents people from disabling sending LLMObs data unless they strip out all LLMObs code from their instrumented app We want to enable LLMObs tracing locally while giving users the ability to toggle actually sending traces to our backend. The state of `DD_LLMOBS_ENABLED` and `LLMObs.enabled` variable should not impact any of the user’s code at all. It purely configures data to be sent/not sent to our backend. This can be done through: 1. Having LLMObs service always have a default `_instance` with `ddtrace.tracer` as the internal tracer. 2. Move starting the span and eval metric writer out of the `__init__` function 3. Have span and eval metric writers only be started or stopped in `enable()` and `disable()` Case to consider: When DD_LLMOBS_ENABLED is False, APM is enabled, and someone uses the SDK decorators to start/stop llm spans in this case trace processing for llmobs is turned off, and writers are turned off, yet llmobs spans are being made by the SDK and submitted to APM. ## 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: lievan <[email protected]> Co-authored-by: Yun Kim <[email protected]>
- Loading branch information
1 parent
f682826
commit ab86515
Showing
7 changed files
with
91 additions
and
76 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.