Skip to content

feat(contrib/googleapis/go-genai): add Google GenAI Go SDK integration#4951

Open
billyac wants to merge 7 commits into
mainfrom
feat/contrib-googleapis-go-genai
Open

feat(contrib/googleapis/go-genai): add Google GenAI Go SDK integration#4951
billyac wants to merge 7 commits into
mainfrom
feat/contrib-googleapis-go-genai

Conversation

@billyac

@billyac billyac commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Adds Datadog LLM Observability tracing for google.golang.org/genai at contrib/googleapis/go-genai/v2.

API matches the existing LLMObs contrib precedent (mark3labs/mcp-go, modelcontextprotocol/go-sdk): the user calls genaitrace.WrapClient(*genai.Client) *Client and uses the returned client in place of the original. No orchestrion.yml for now — same as the other LLMObs contribs.

Instrumented methods

  • Models.GenerateContent, Models.GenerateContentStream (chunks accumulated for output text + final usage)
  • Models.EmbedContent
  • Chats.Create → traced *Chat.SendMessage / *Chat.SendMessageStream

Span data

  • Model name, model provider (derived from backend: google / google_vertexai / google_enterprise)
  • Generation metadata: temperature, top_p, top_k, max_output_tokens, stop_sequences
  • Metrics: input_tokens, output_tokens, total_tokens, cache_read_input_tokens, reasoning_output_tokens

Repo wiring

  • instrumentation/packages.go: PackageGoogleAPIsGoGenAI
  • ddtrace/tracer/option.go contribIntegrations: google.golang.org/genai
  • internal/env/supported_configurations.{json,gen.go}: DD_TRACE_GOOGLE_GENAI_ANALYTICS_ENABLED
  • internal/stacktrace/contribs_generated.go (regenerated)
  • go.work

Test plan

  • go test ./contrib/googleapis/go-genai/... — five tests covering generate, generate stream (SSE), embed, chat with prior history (two consecutive sends to verify history-snapshot ordering), and error path, all running against an httptest mock server.
  • go test ./instrumentation/...TestInstrumentation_AnalyticsRate/googleapis/go-genai passes.
  • go test ./ddtrace/tracer/ -run TestAgentIntegration — passes after bumping default integration count 57 → 58.
  • go build ./... from repo root.
  • Real Gemini API smoke test (requires API key) — not run in CI.

Review follow-ups

  • Chat history snapshot (Codex P2 on chats.go): genai.Chat.SendMessage appends the current turn to History() on success, so reading history after the call duplicated the user message and leaked the assistant reply into the recorded input. Fixed by snapshotting history before the call in a new snapshotInput helper; TestChatSendMessage now performs two consecutive sends and asserts each span's input contains the new user turn exactly once and no assistant content from the same turn.
  • Supported configuration metadata (Codex P2 on supported_configurations.json): replaced the FIX_ME placeholders for DD_TRACE_GOOGLE_GENAI_ANALYTICS_ENABLED with boolean / default false, matching every other DD_TRACE_*_ANALYTICS_ENABLED key.

Outstanding

  • dd-gitlab/validate_supported_configurations_v2_local_file requires a Datadog maintainer to register DD_TRACE_GOOGLE_GENAI_ANALYTICS_ENABLED in the internal configuration registry (per CONTRIBUTING.md). I can't do this from outside.

Claude session: 10d83514-c53a-4629-b0b1-ccde7bb21f6b
Resume: claude --resume 10d83514-c53a-4629-b0b1-ccde7bb21f6b

🤖 Generated with Claude Code

@billyac billyac requested review from a team as code owners June 24, 2026 19:23
@billyac billyac requested review from rarguelloF and removed request for a team June 24, 2026 19:23
@github-actions github-actions Bot added the apm:ecosystem contrib/* related feature requests or bugs label Jun 24, 2026
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 24, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-go | validate_supported_configurations_v2_local_file   View in Datadog   GitLab

Check Pull Request CI Status | all-jobs-are-green   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 54.35%
Overall Coverage: 62.53% (+11.12%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: bbdae1c | Docs | Datadog PR Page | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01f68751f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread contrib/googleapis/go-genai/chats.go Outdated
span, ctx := startLLMSpan(ctx, "genai.chat.send_message", c.model, c.provider)

resp, err := c.chat.SendMessage(ctx, parts...)
finishLLMSpan(span, c.inputForSpan(parts), c.config, resp, err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Snapshot chat input before sending

On successful chat sends, google.golang.org/genai mutates the chat history before this line returns by recording the user input and model output, so c.inputForSpan(parts) reads a history that already contains the current turn and then appends the current user message again. This makes LLMObs input include the assistant response and duplicate user message for every successful Chat.SendMessage call (and the same pattern exists in the stream path), corrupting the recorded conversation telemetry; build the span input from a pre-call history snapshot instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch — fixed in dcb3fa8. Snapshotted history into a local before calling SendMessage/SendMessageStream (new snapshotInput helper). Extended TestChatSendMessage to two consecutive sends: each span's input now contains the new user turn exactly once and the assistant reply for that turn doesn't appear in its own input.

Comment on lines +1224 to +1225
"type": "FIX_ME",
"default": "FIX_ME"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fill in supported configuration metadata

This entry was left with the configinverter placeholders. Since supported_configurations.json is the source of metadata for known env vars, shipping FIX_ME reports DD_TRACE_GOOGLE_GENAI_ANALYTICS_ENABLED with an invalid type/default instead of matching the other DD_TRACE_*_ANALYTICS_ENABLED boolean keys with default false.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in dcb3fa8 — set type="boolean", default="false" to match the other DD_TRACE_*_ANALYTICS_ENABLED keys.

@pr-commenter

pr-commenter Bot commented Jun 24, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-08 14:34:56

Comparing candidate commit bbdae1c in PR branch feat/contrib-googleapis-go-genai with baseline commit 0e9c636 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 326 metrics, 0 unstable metrics, 1 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

Known flaky benchmarks without significant changes:

  • scenario:BenchmarkOTLPTraceWriterFlush

@billyac billyac changed the title feat(contrib/googleapis/go-genai): add LLM Observability integration feat(contrib/googleapis/go-genai): add Google GenAI Go SDK integration Jun 24, 2026
billyac and others added 4 commits July 7, 2026 11:47
Add a new contrib submodule that wraps *genai.Client to produce LLM
Observability spans for GenerateContent, GenerateContentStream,
EmbedContent and chat sessions (Chats.Create, SendMessage,
SendMessageStream). Provider is derived from the configured backend
(google / google_vertexai / google_enterprise).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- chats.go: snapshot chat history before SendMessage / SendMessageStream;
  genai.Chat appends the current turn to History on success, so reading
  history after the call double-counted the user message and leaked the
  assistant reply into the recorded input (Codex P2).
- Fix supported_configurations.json placeholder for
  DD_TRACE_GOOGLE_GENAI_ANALYTICS_ENABLED to boolean / default false
  (Codex P2).
- Add testify direct/transitive deps to contrib go.mod, eliben tokenizer
  entry to go.work.sum, google.golang.org/genai to the third-party
  libraries list in stacktrace, and goimports group separator in
  example_test.go (CI: check-modules, check-format, generate).
- Bump TestAgentIntegration default integration count 57 -> 58 for the
  new contribIntegrations entry.
- Extend TestChatSendMessage to two consecutive sends and assert no
  duplication of user content across spans.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous run failed during 'go mod download' with a transient
proxy.golang.org stream error fetching unrelated modules
(elastic/go-elasticsearch/v8, envoyproxy/go-control-plane/envoy).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@billyac billyac force-pushed the feat/contrib-googleapis-go-genai branch from 4f214c7 to 9adb68b Compare July 7, 2026 15:49
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Config Audit

PACKAGE: contrib/confluentinc/confluent-kafka-go/kafkatrace
  STATUS      CONFIG                            CALL_SITES
  UNMIGRATED  DD_TRACE_KAFKA_ANALYTICS_ENABLED  1

PACKAGE: ddtrace/opentelemetry/log
  STATUS      CONFIG                            CALL_SITES
  STILL_READ  DD_AGENT_HOST                     2
  STILL_READ  DD_ENV                            1
  STILL_READ  DD_SERVICE                        1
  STILL_READ  DD_TAGS                           1
  STILL_READ  DD_TRACE_AGENT_URL                2
  STILL_READ  DD_TRACE_REPORT_HOSTNAME          1
  STILL_READ  DD_VERSION                        1
  UNMIGRATED  DD_HOSTNAME                       1
  UNMIGRATED  OTEL_BLRP_EXPORT_TIMEOUT          1
  UNMIGRATED  OTEL_BLRP_MAX_EXPORT_BATCH_SIZE   1
  UNMIGRATED  OTEL_BLRP_MAX_QUEUE_SIZE          1
  UNMIGRATED  OTEL_BLRP_SCHEDULE_DELAY          1
  UNMIGRATED  OTEL_EXPORTER_OTLP_ENDPOINT       4
  UNMIGRATED  OTEL_EXPORTER_OTLP_HEADERS        2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_ENDPOINT  4
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_HEADERS   2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_PROTOCOL  2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_TIMEOUT   1
  UNMIGRATED  OTEL_EXPORTER_OTLP_PROTOCOL       2
  UNMIGRATED  OTEL_EXPORTER_OTLP_TIMEOUT        1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES          1

PACKAGE: ddtrace/opentelemetry/metric
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_AGENT_HOST                                      2
  STILL_READ  DD_ENV                                             1
  STILL_READ  DD_METRICS_OTEL_ENABLED                            1
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TAGS                                            1
  STILL_READ  DD_TRACE_AGENT_URL                                 2
  STILL_READ  DD_TRACE_REPORT_HOSTNAME                           1
  STILL_READ  DD_VERSION                                         1
  STILL_READ  OTEL_METRICS_EXPORTER                              1
  UNMIGRATED  DD_HOSTNAME                                        1
  UNMIGRATED  OTEL_EXPORTER_OTLP_ENDPOINT                        2
  UNMIGRATED  OTEL_EXPORTER_OTLP_HEADERS                         1
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_ENDPOINT                2
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_HEADERS                 1
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_PROTOCOL                2
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE  1
  UNMIGRATED  OTEL_EXPORTER_OTLP_PROTOCOL                        2
  UNMIGRATED  OTEL_EXPORTER_OTLP_TIMEOUT                         1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES                           1
  UNMIGRATED  OTEL_SERVICE_NAME                                  1

PACKAGE: ddtrace/tracer
  STATUS      CONFIG                                    CALL_SITES
  STILL_READ  DD_API_KEY                                1
  UNMIGRATED  DD_APM_TRACING_ENABLED                    1
  UNMIGRATED  DD_LLMOBS_AGENTLESS_ENABLED               1
  UNMIGRATED  DD_LLMOBS_ENABLED                         1
  UNMIGRATED  DD_LLMOBS_ML_APP                          1
  UNMIGRATED  DD_LLMOBS_PROJECT_NAME                    1
  UNMIGRATED  DD_SITE                                   2
  UNMIGRATED  DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED  1
  UNMIGRATED  DD_TRACE_DEBUG_SEELOG_WORKAROUND          1
  UNMIGRATED  DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT     1
  UNMIGRATED  DD_TRACE_PROPAGATION_EXTRACT_FIRST        1
  UNMIGRATED  DD_TRACE_PROPAGATION_STYLE_EXTRACT        1
  UNMIGRATED  DD_TRACE_PROPAGATION_STYLE_INJECT         1
  UNMIGRATED  OTEL_TRACES_SAMPLER_ARG                   1

PACKAGE: instrumentation
  STATUS      CONFIG                                       CALL_SITES
  STILL_READ  DD_DATA_STREAMS_ENABLED                      1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_ENABLED  1

PACKAGE: instrumentation/graphql
  STATUS      CONFIG                             CALL_SITES
  UNMIGRATED  DD_TRACE_GRAPHQL_ERROR_EXTENSIONS  1

PACKAGE: instrumentation/httptrace
  STATUS      CONFIG                                                 CALL_SITES
  UNMIGRATED  DD_TRACE_BAGGAGE_TAG_KEYS                              1
  UNMIGRATED  DD_TRACE_CLIENT_IP_ENABLED                             1
  UNMIGRATED  DD_TRACE_HTTP_SERVER_ERROR_STATUSES                    1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST               1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_CLIENT        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_SERVER        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_DISABLED                1
  UNMIGRATED  DD_TRACE_INFERRED_PROXY_SERVICES_ENABLED               1
  UNMIGRATED  DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP               2
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT  1
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ENABLED                     1

PACKAGE: instrumentation/internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TRACE_SPAN_ATTRIBUTE_SCHEMA                     1
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal
  STATUS      CONFIG                         CALL_SITES
  STILL_READ  DD_AGENT_HOST                  1
  STILL_READ  DD_TAGS                        1
  STILL_READ  DD_TRACE_AGENT_PORT            1
  STILL_READ  DD_TRACE_AGENT_URL             1
  UNMIGRATED  DD_EXTERNAL_ENV                1
  UNMIGRATED  DD_GIT_COMMIT_SHA              1
  UNMIGRATED  DD_GIT_REPOSITORY_URL          1
  UNMIGRATED  DD_TRACE_GIT_METADATA_ENABLED  1

PACKAGE: internal/appsec
  STATUS      CONFIG           CALL_SITES
  UNMIGRATED  DD_APPSEC_RULES  1

PACKAGE: internal/appsec/config
  STATUS      CONFIG                                                CALL_SITES
  UNMIGRATED  DD_API_SECURITY_DOWNSTREAM_BODY_ANALYSIS_SAMPLE_RATE  1
  UNMIGRATED  DD_API_SECURITY_ENABLED                               1
  UNMIGRATED  DD_API_SECURITY_MAX_DOWNSTREAM_REQUEST_BODY_ANALYSIS  1
  UNMIGRATED  DD_API_SECURITY_PROXY_SAMPLE_RATE                     1
  UNMIGRATED  DD_API_SECURITY_REQUEST_SAMPLE_RATE                   1
  UNMIGRATED  DD_API_SECURITY_SAMPLE_DELAY                          1
  UNMIGRATED  DD_APM_TRACING_ENABLED                                1
  UNMIGRATED  DD_APPSEC_ENABLED                                     1
  UNMIGRATED  DD_APPSEC_RASP_ENABLED                                1
  UNMIGRATED  DD_APPSEC_RULES                                       1
  UNMIGRATED  DD_APPSEC_SCA_ENABLED                                 1
  UNMIGRATED  DD_APPSEC_TRACE_RATE_LIMIT                            1
  UNMIGRATED  DD_APPSEC_WAF_TIMEOUT                                 1

PACKAGE: internal/appsec/listener/httpsec
  STATUS      CONFIG                     CALL_SITES
  UNMIGRATED  DD_TRACE_CLIENT_IP_HEADER  1

PACKAGE: internal/bazel
  STATUS      CONFIG                                  CALL_SITES
  UNMIGRATED  DD_TEST_OPTIMIZATION_MANIFEST_FILE      1
  UNMIGRATED  DD_TEST_OPTIMIZATION_PAYLOADS_IN_FILES  1

PACKAGE: internal/civisibility/envconfig
  STATUS      CONFIG                   CALL_SITES
  STILL_READ  DD_CIVISIBILITY_ENABLED  1

PACKAGE: internal/civisibility/integrations
  STATUS      CONFIG                                               CALL_SITES
  STILL_READ  DD_SERVICE                                           1
  STILL_READ  DD_TRACE_DEBUG                                       1
  UNMIGRATED  DD_CIVISIBILITY_CODE_COVERAGE_REPORT_UPLOAD_ENABLED  1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_COUNT                    1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_ENABLED                  1
  UNMIGRATED  DD_CIVISIBILITY_GIT_UPLOAD_ENABLED                   1
  UNMIGRATED  DD_CIVISIBILITY_IMPACTED_TESTS_DETECTION_ENABLED     1
  UNMIGRATED  DD_CIVISIBILITY_SUBTEST_FEATURES_ENABLED             1
  UNMIGRATED  DD_CIVISIBILITY_TOTAL_FLAKY_RETRY_COUNT              1
  UNMIGRATED  DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES            1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                           1

PACKAGE: internal/civisibility/integrations/gotesting
  STATUS      CONFIG                                                           CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_INTERNAL_PARALLEL_EARLY_FLAKE_DETECTION_ENABLED  1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                                       1

PACKAGE: internal/civisibility/integrations/logs
  STATUS      CONFIG                        CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_LOGS_ENABLED  1

PACKAGE: internal/civisibility/utils
  STATUS      CONFIG                              CALL_SITES
  STILL_READ  DD_SERVICE                          1
  UNMIGRATED  DD_ACTION_EXECUTION_ID              1
  UNMIGRATED  DD_PIPELINE_EXECUTION_ID            1
  UNMIGRATED  DD_TEST_OPTIMIZATION_ENV_DATA_FILE  1
  UNMIGRATED  DD_TEST_SESSION_NAME                1

PACKAGE: internal/civisibility/utils/net
  STATUS      CONFIG                             CALL_SITES
  STILL_READ  DD_API_KEY                         1
  STILL_READ  DD_CIVISIBILITY_AGENTLESS_ENABLED  1
  STILL_READ  DD_CIVISIBILITY_AGENTLESS_URL      1
  STILL_READ  DD_ENV                             1
  STILL_READ  DD_SERVICE                         1
  STILL_READ  DD_TAGS                            1
  STILL_READ  DD_VERSION                         1
  UNMIGRATED  DD_SITE                            1

PACKAGE: internal/civisibility/utils/telemetry
  STATUS      CONFIG                                         CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER  1

PACKAGE: internal/globalconfig
  STATUS      CONFIG                           CALL_SITES
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_ID    1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TIME  1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TYPE  1

PACKAGE: internal/hostname
  STATUS      CONFIG       CALL_SITES
  UNMIGRATED  DD_HOSTNAME  1

PACKAGE: internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TRACE_SPAN_ATTRIBUTE_SCHEMA                     1
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal/processtags
  STATUS      CONFIG                                          CALL_SITES
  UNMIGRATED  DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED  1

PACKAGE: internal/remoteconfig
  STATUS      CONFIG                                  CALL_SITES
  STILL_READ  DD_ENV                                  1
  UNMIGRATED  DD_RC_TUF_ROOT                          1
  UNMIGRATED  DD_REMOTE_CONFIGURATION_ENABLED         1
  UNMIGRATED  DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS  1

PACKAGE: internal/stacktrace
  STATUS      CONFIG                           CALL_SITES
  UNMIGRATED  DD_APPSEC_MAX_STACK_TRACE_DEPTH  1
  UNMIGRATED  DD_APPSEC_STACK_TRACE_ENABLED    1

PACKAGE: internal/telemetry
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_API_KEY                                         1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_MESSAGE_LIMIT  1
  UNMIGRATED  DD_INSTRUMENTATION_TELEMETRY_ENABLED               1
  UNMIGRATED  DD_SITE                                            1
  UNMIGRATED  DD_TELEMETRY_DEBUG                                 1
  UNMIGRATED  DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED         1
  UNMIGRATED  DD_TELEMETRY_EXTENDED_HEARTBEAT_INTERVAL           1
  UNMIGRATED  DD_TELEMETRY_HEARTBEAT_INTERVAL                    1
  UNMIGRATED  DD_TELEMETRY_LOG_COLLECTION_ENABLED                1
  UNMIGRATED  DD_TELEMETRY_METRICS_ENABLED                       1

PACKAGE: openfeature
  STATUS      CONFIG                                                     CALL_SITES
  STILL_READ  DD_ENV                                                     2
  STILL_READ  DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED                  1
  STILL_READ  DD_SERVICE                                                 2
  STILL_READ  DD_VERSION                                                 2
  UNMIGRATED  DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED  1
  UNMIGRATED  DD_FLAGGING_EVALUATION_COUNTS_ENABLED                      1

PACKAGE: profiler
  STATUS      CONFIG                                    CALL_SITES
  STILL_READ  DD_API_KEY                                1
  STILL_READ  DD_ENV                                    1
  STILL_READ  DD_SERVICE                                1
  STILL_READ  DD_TAGS                                   1
  STILL_READ  DD_TRACE_STARTUP_LOGS                     1
  STILL_READ  DD_VERSION                                1
  UNMIGRATED  DD_PROFILING_AGENTLESS                    1
  UNMIGRATED  DD_PROFILING_DEBUG_COMPRESSION_SETTINGS   1
  UNMIGRATED  DD_PROFILING_DELTA                        1
  UNMIGRATED  DD_PROFILING_ENABLED                      3
  UNMIGRATED  DD_PROFILING_ENDPOINT_COUNT_ENABLED       1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_ENABLED      1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_LIMIT_BYTES  1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_PERIOD       1
  UNMIGRATED  DD_PROFILING_FLUSH_ON_EXIT                1
  UNMIGRATED  DD_PROFILING_OUTPUT_DIR                   1
  UNMIGRATED  DD_PROFILING_UPLOAD_TIMEOUT               1
  UNMIGRATED  DD_PROFILING_URL                          1
  UNMIGRATED  DD_SITE                                   1

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread instrumentation/packages.go Outdated
PackageUptraceBun Package = "uptrace/bun"
PackageLogSlog Package = "log/slog"
PackageModelContextProtocolGoSDK Package = "modelcontextprotocol/go-sdk"
PackageGoogleAPIsGoGenAI Package = "googleapis/go-genai"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
PackageGoogleAPIsGoGenAI Package = "googleapis/go-genai"
PackageGoogleAPIsGoGenAI Package = "google.golang.org/genai"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Applied in 0e44ff9. Also updated the naming registration and matching MCP-style tests still pass.

@@ -0,0 +1,114 @@
// Unless explicitly stated otherwise all files in this repository are licensed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the contrib path should match the traced package path

(in this case it should live under contrib/google.golang.org/genai)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Moved in 0e44ff9 to contrib/google.golang.org/genai/ to match the traced import path (same as google.golang.org/grpc and google.golang.org/api).

Comment thread contrib/googleapis/go-genai/client.go Outdated
// WrapClient returns a tracing wrapper around the given *genai.Client.
// The returned *Client exposes wrapper Models and Chats with the same
// method signatures as the upstream SDK.
func WrapClient(c *genai.Client) *Client {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

usually we accept here a variadic opts ...Option argument in case we want to provide configuration for the integration. Even if we don't have any option in mind right now, its worth it to add it to avoid introducing breaking changes in the api if we need it in the future.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done in 0e44ff9: added an Option type and WrapClient(c *genai.Client, opts ...Option) — no options exported yet, but the variadic form is in place to avoid a breaking change later.

billyac and others added 2 commits July 8, 2026 09:56
- Move contrib from contrib/googleapis/go-genai to
  contrib/google.golang.org/genai to match the traced package's canonical
  import path (per contrib/README.md naming convention).
- Update the Package constant value to "google.golang.org/genai" so the
  telemetry package name matches the traced import path (matches how
  google.golang.org/grpc and google.golang.org/api are registered).
- Accept variadic opts ...Option in WrapClient so we can add integration
  options later without breaking the API. No public options are exported
  yet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Main upgraded the WAF dependency; retidying the contrib swaps
go-libddwaf/v4 v4.10.0 -> go-libddwaf/v5 v5.0.0 in the contrib's
go.mod / go.sum and adds the missing v4.10.0 /go.mod entry to
go.work.sum.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
billyac added a commit to billyac/genai-dd-trace-go-smoke that referenced this pull request Jul 8, 2026
Move the go.mod pseudo-versions to the latest commit of the branch
(bbdae1c51d37) and rename the contrib path to
contrib/google.golang.org/genai to match the reviewer feedback on
DataDog/dd-trace-go#4951.

Document the go get @branch-name pattern in the README so anyone
running the smoke test can refresh to the branch tip without looking
up commit hashes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@billyac billyac requested a review from rarguelloF July 8, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apm:ecosystem contrib/* related feature requests or bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants