Skip to content

chore(llmobs): dac strip io from gemini #13874

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

Merged
merged 7 commits into from
Jul 14, 2025

Conversation

jsimpher
Copy link
Contributor

@jsimpher jsimpher commented Jul 3, 2025

Remove potentially sensitive i/o data from apm spans. This way, prompt and completion data will only appear on the llm obs spans, which are/will be subject to data access controls.

Mostly, this just removes io tag sets. A few things (mostly metrics) have llmobs tags dependent on span tags, so there is a bit more refactoring there.

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Jul 3, 2025

CODEOWNERS have been resolved as:

releasenotes/notes/remove-io-data-from-span-gemini-integration-743cc458841345b4.yaml  @DataDog/apm-python
ddtrace/contrib/internal/google_generativeai/_utils.py                  @DataDog/ml-observability
ddtrace/contrib/internal/google_generativeai/patch.py                   @DataDog/ml-observability
ddtrace/llmobs/_integrations/gemini.py                                  @DataDog/ml-observability
ddtrace/llmobs/_integrations/utils.py                                   @DataDog/ml-observability
tests/contrib/google_generativeai/test_google_generativeai.py           @DataDog/ml-observability
tests/snapshots/tests.contrib.google_generativeai.test_google_generativeai.test_gemini_completion.json  @DataDog/ml-observability
tests/snapshots/tests.contrib.google_generativeai.test_google_generativeai.test_gemini_completion_error.json  @DataDog/ml-observability
tests/snapshots/tests.contrib.google_generativeai.test_google_generativeai.test_gemini_completion_image.json  @DataDog/ml-observability
tests/snapshots/tests.contrib.google_generativeai.test_google_generativeai.test_gemini_completion_multiple_messages.json  @DataDog/ml-observability
tests/snapshots/tests.contrib.google_generativeai.test_google_generativeai.test_gemini_completion_stream.json  @DataDog/ml-observability
tests/snapshots/tests.contrib.google_generativeai.test_google_generativeai.test_gemini_completion_system_prompt.json  @DataDog/ml-observability
tests/snapshots/tests.contrib.google_generativeai.test_google_generativeai.test_gemini_completion_tool_stream.json  @DataDog/ml-observability
tests/snapshots/tests.contrib.google_generativeai.test_google_generativeai.test_gemini_tool_chat_completion.json  @DataDog/ml-observability
tests/snapshots/tests.contrib.google_generativeai.test_google_generativeai.test_gemini_tool_completion.json  @DataDog/ml-observability

Copy link
Contributor

github-actions bot commented Jul 3, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 279 ± 3 ms.

The average import time from base is: 281 ± 3 ms.

The import time difference between this PR and base is: -2.3 ± 0.1 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 2.024 ms (0.73%)
ddtrace.bootstrap.sitecustomize 1.351 ms (0.48%)
ddtrace.bootstrap.preload 1.351 ms (0.48%)
ddtrace.internal.remoteconfig.client 0.655 ms (0.23%)
ddtrace.debugging._import 0.013 ms (0.00%)
ddtrace.debugging._function.discovery 0.013 ms (0.00%)
ddtrace.debugging._function 0.013 ms (0.00%)
ddtrace 0.673 ms (0.24%)
ddtrace.internal._unpatched 0.030 ms (0.01%)
json 0.030 ms (0.01%)
json.decoder 0.030 ms (0.01%)
re 0.030 ms (0.01%)
enum 0.030 ms (0.01%)
types 0.030 ms (0.01%)

@pr-commenter
Copy link

pr-commenter bot commented Jul 3, 2025

Benchmarks

Benchmark execution time: 2025-07-14 14:33:49

Comparing candidate commit 9c11c39 in PR branch jsimpher/dac-strip-io-from-gemini with baseline commit c7c99b3 in branch main.

Found 0 performance improvements and 5 performance regressions! Performance is the same for 543 metrics, 2 unstable metrics.

scenario:iastaspects-lstrip_aspect

  • 🟥 execution_time [+736.331ns; +811.666ns] or [+7.071%; +7.794%]

scenario:iastaspects-strip_aspect

  • 🟥 execution_time [+763.810ns; +834.007ns] or [+7.340%; +8.014%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+737.405ns; +881.015ns] or [+17.411%; +20.802%]

scenario:iastaspectsospath-ospathjoin_aspect

  • 🟥 execution_time [+641.593ns; +855.453ns] or [+10.434%; +13.911%]

scenario:iastaspectsospath-ospathnormcase_aspect

  • 🟥 execution_time [+367.526ns; +438.529ns] or [+10.485%; +12.511%]

@jsimpher jsimpher marked this pull request as ready for review July 3, 2025 16:45
@jsimpher jsimpher requested review from a team as code owners July 3, 2025 16:45
@jsimpher jsimpher requested review from Yun-Kim and erikayasuda July 3, 2025 16:45
Copy link
Contributor

@ncybul ncybul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- left a couple minor comments, but looks clean!

Copy link
Contributor

@Yun-Kim Yun-Kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nits but otherwise LGTM

@jsimpher
Copy link
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Jul 14, 2025

View all feedbacks in Devflow UI.

2025-07-14 16:34:51 UTC ℹ️ Start processing command /merge


2025-07-14 16:35:02 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-07-14 16:35:17 UTC ⚠️ MergeQueue: This merge request was unqueued

jacob.simpher@datadoghq.com unqueued this merge request

@jsimpher
Copy link
Contributor Author

/merge --cancel

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Jul 14, 2025

View all feedbacks in Devflow UI.

2025-07-14 16:35:10 UTC ℹ️ Start processing command /merge --cancel

@jsimpher
Copy link
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Jul 14, 2025

View all feedbacks in Devflow UI.

2025-07-14 18:55:49 UTC ℹ️ Start processing command /merge


2025-07-14 18:56:02 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-07-14 19:21:19 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 1h (p90).


2025-07-14 19:44:47 UTC ⚠️ MergeQueue: This merge request build was cancelled

jacob.simpher@datadoghq.com cancelled this merge request build

@jsimpher
Copy link
Contributor Author

/merge --cancel

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Jul 14, 2025

View all feedbacks in Devflow UI.

2025-07-14 19:44:36 UTC ℹ️ Start processing command /merge --cancel

@jsimpher
Copy link
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Jul 14, 2025

View all feedbacks in Devflow UI.

2025-07-14 19:55:57 UTC ℹ️ Start processing command /merge


2025-07-14 19:56:08 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 1h (p90).


2025-07-14 21:43:12 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue bot merged commit b02e328 into main Jul 14, 2025
609 of 613 checks passed
@dd-mergequeue dd-mergequeue bot deleted the jsimpher/dac-strip-io-from-gemini branch July 14, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants