Skip to content

feat(contrib/cloud.google.com/go/pubsub): add Data Streams checkpoints - #5946

Open
robcarlan-datadog wants to merge 3 commits into
mainfrom
robcarlan/dsm2-743-pubsub
Open

robcarlan-datadog wants to merge 3 commits into
mainfrom
robcarlan/dsm2-743-pubsub

Conversation

@robcarlan-datadog

Copy link
Copy Markdown
Contributor

What

Adds Data Streams Monitoring checkpoints to the shared pubsubtrace package, so pubsub.v1, pubsub.v2 and Orchestrion all get them from one change. Go Pub/Sub hops were invisible to DSM, so pathways through mixed-language pipelines broke at their Go services.

TracePublish sets a direction:out, topic:<topic>, type:google-pubsub checkpoint and injects the base64 pathway into the message attributes, alongside the trace context. TraceReceiveFunc extracts the pathway from the attributes, sets a direction:in checkpoint, and returns it in the handler context, so a consumer that publishes onward chains through the context. Consumes are tagged by subscription, matching the Java tracer's convention for Pub/Sub; a cross-tracer standardization of this tag is underway and consumeEdgeTags is the single place to flip it. Gated on DD_DATA_STREAMS_ENABLED, off by default.

Also accepts subscription as an edge tag key in internal/datastreams, without which subscription tags are dropped from the pathway hash; no other integration uses that key today.

Why

Java and Node.js already instrument Pub/Sub for DSM; Go was the gap.

Testing

Unit tests in pubsubtrace follow the sarama integration's pattern: pathway hash equality for produce, consume chained on produce, forwarding through the handler context, and no-op behavior when the flag is off. pubsub.v1, pubsub.v2 and internal/datastreams suites pass; gofmt and go vet clean.

🤖 Generated with Claude Code

Go Pub/Sub publishers and consumers were missing from Data Streams
Monitoring, so pathways broke at Go hops. TracePublish now sets a
produce checkpoint and injects the pathway into the message attributes;
TraceReceiveFunc extracts it, sets a consume checkpoint, and returns
it in the handler context so downstream publishes chain. Consumes are
tagged by subscription, matching the Java tracer's convention. Gated
on DD_DATA_STREAMS_ENABLED, off by default. One change covers pubsub.v1,
pubsub.v2 and Orchestrion, which all share the pubsubtrace package.

internal/datastreams: accept "subscription" as an edge tag key so
subscription tags participate in the pathway hash.

Environment: Datadog workspace

Co-Authored-By: Claude Code claude-glm-5.3 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 20, 2026

Copy link
Copy Markdown

DSM2-743

@github-actions github-actions Bot added the apm:ecosystem contrib/* related feature requests or bugs label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Config Audit

PACKAGE: contrib/cloud.google.com/go/pubsubtrace
  STATUS      CONFIG                                            CALL_SITES
  UNMIGRATED  DD_GOOGLE_CLOUD_PUBSUB_PROPAGATION_AS_SPAN_LINKS  1

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

PACKAGE: crashtracker
  STATUS      CONFIG                    CALL_SITES
  STILL_READ  DD_API_KEY                1
  STILL_READ  DD_SITE                   1
  STILL_READ  DD_TAGS                   1
  UNMIGRATED  DD_CRASHTRACKING_ENABLED  1

PACKAGE: ddtrace/opentelemetry/log
  STATUS      CONFIG                    CALL_SITES
  STILL_READ  DD_ENV                    1
  STILL_READ  DD_SERVICE                1
  STILL_READ  DD_TAGS                   1
  STILL_READ  DD_TRACE_REPORT_HOSTNAME  1
  STILL_READ  DD_VERSION                1
  UNMIGRATED  DD_HOSTNAME               1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES  1
  UNMIGRATED  OTEL_SERVICE_NAME         1

PACKAGE: ddtrace/opentelemetry/metric
  STATUS      CONFIG                    CALL_SITES
  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_REPORT_HOSTNAME  1
  STILL_READ  DD_VERSION                1
  STILL_READ  OTEL_METRICS_EXPORTER     1
  UNMIGRATED  DD_HOSTNAME               1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES  1
  UNMIGRATED  OTEL_SERVICE_NAME         1

PACKAGE: ddtrace/tracer
  STATUS      CONFIG                                    CALL_SITES
  STILL_READ  DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT     1
  STILL_READ  DD_TRACE_PROPAGATION_EXTRACT_FIRST        1
  STILL_READ  DD_TRACE_PROPAGATION_STYLE_EXTRACT        1
  STILL_READ  DD_TRACE_PROPAGATION_STYLE_INJECT         1
  UNMIGRATED  DD_APM_TRACING_ENABLED                    1
  UNMIGRATED  DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED  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_GOOGLE_CLOUD_PUBSUB_PROPAGATION_AS_SPAN_LINKS       1
  UNMIGRATED  DD_HTTP_SERVER_TAG_QUERY_STRING_SIZE                   1
  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
  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_AGENTIC_ONBOARDING                          1
  UNMIGRATED  DD_APPSEC_DISABLE_FEATURES                            1
  UNMIGRATED  DD_APPSEC_ENABLED                                     2
  UNMIGRATED  DD_APPSEC_MAX_STACK_TRACE_DEPTH                       1
  UNMIGRATED  DD_APPSEC_RASP_ENABLED                                1
  UNMIGRATED  DD_APPSEC_RULES                                       1
  UNMIGRATED  DD_APPSEC_SCA_ENABLED                                 1
  UNMIGRATED  DD_APPSEC_STACK_TRACE_ENABLED                         1
  UNMIGRATED  DD_APPSEC_TRACE_RATE_LIMIT                            1
  UNMIGRATED  DD_APPSEC_WAF_TIMEOUT                                 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_DYNAMIC_ATR_BUCKETS                  1
  UNMIGRATED  DD_CIVISIBILITY_DYNAMIC_ATR_ENABLED                  1
  UNMIGRATED  DD_CIVISIBILITY_EARLY_FLAKE_DETECTION_ENABLED        1
  UNMIGRATED  DD_CIVISIBILITY_EARLY_FLAKE_DETECTION_MAX_RETRIES    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  2
  UNMIGRATED  DD_CIVISIBILITY_RETRY_EXECUTION_MODE                             1
  UNMIGRATED  DD_CIVISIBILITY_RETRY_PROCESS_MAX_CONCURRENCY                    1
  UNMIGRATED  DD_CIVISIBILITY_RETRY_PROCESS_TIMEOUT                            1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                                       2

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_SITE                            1
  STILL_READ  DD_TAGS                            1
  STILL_READ  DD_VERSION                         1
  UNMIGRATED  DD_CODE_COVERAGE_FLAGS             1

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

PACKAGE: internal/clientip
  STATUS      CONFIG                     CALL_SITES
  UNMIGRATED  DD_TRACE_CLIENT_IP_HEADER  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
  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/telemetry
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_API_KEY                                         1
  STILL_READ  DD_SITE                                            1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_MESSAGE_LIMIT  1
  UNMIGRATED  DD_INSTRUMENTATION_TELEMETRY_ENABLED               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_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_SITE                                   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

@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 3 Pipeline jobs failed

Check Pull Request CI Status | all-jobs-are-green

View more details · View in GitHub Actions

Pull Request Tests | PR Unit and Integration Tests (oldstable) / test-core

View more details · View in GitHub Actions

Pull Request Tests | PR Unit and Integration Tests / test-core

View more details · View in GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 83.78%
• Overall Coverage: 74.20% (+7.05%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5fa8f6d | Docs | View more details | Give us feedback!

@dd-octo-sts dd-octo-sts Bot mentioned this pull request Nov 20, 2026
@pr-commenter

pr-commenter Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-11-25 23:15:42

Comparing candidate commit 5fa8f6d in PR branch robcarlan/dsm2-743-pubsub with baseline commit 5c733d5 in branch main.

📊 Benchmarking dashboard

Found 0 performance improvements and 1 performance regressions! Performance is the same for 414 metrics, 1 unstable metrics.

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 ----------------------------------'

scenario:BenchmarkNodeHash

  • 🟥 execution_time [+2.994ns; +4.286ns] or [+2.220%; +3.178%]

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:BenchmarkContextWithSpan/detach-no-snapshot

  • unstable execution_time [-1.245ns; +1.799ns] or [-4.264%; +6.161%]

@robcarlan-datadog
robcarlan-datadog marked this pull request as ready for review November 20, 2026 20:30
@robcarlan-datadog
robcarlan-datadog requested review from a team as code owners November 20, 2026 20:30
@robcarlan-datadog
robcarlan-datadog requested review from rarguelloF and removed request for a team November 20, 2026 20:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T16:05:19.656429Z d6b84c9 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 2f5aefdb82

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@datadog-prod-us1-6 datadog-prod-us1-6 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.

Bits Code Review: FAIL

When a receive callback context already contains a DSM pathway, the merge can randomly discard the new consume checkpoint. Forwarded messages can consequently omit the Pub/Sub consume hop from their pathway.

Open Bits AI session

🤖 Bits Code Review · Commit 2f5aefd

…terministic when the handler context carries one

When a receive callback's context already carries a DSM pathway,
MergeContexts picked one of the two pathways at random, so downstream
publishes could bypass the consume checkpoint about half the time.
consumeCheckpoint now chains the checkpoint on the pathway extracted
from the message attributes and attaches the result to the callback
context unconditionally, preserving its span and other values.

Environment: Datadog workspace

Co-Authored-By: Claude Code <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: d6b84c94cb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@robcarlan-datadog

Copy link
Copy Markdown
Contributor Author

@DataDog review

@datadog-prod-us1-6 datadog-prod-us1-6 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.

Bits Code Review: PASS

More details

The receive path overrides unrelated inherited pathways with the message-derived checkpoint while preserving the handler’s span and context, addressing the edge case discussed on the PR. The completed static reviewer returned no reportable findings.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit d6b84c9

)

var hashableEdgeTags = map[string]struct{}{"event_type": {}, "exchange": {}, "group": {}, "kafka_cluster_id": {}, "topic": {}, "type": {}, "direction": {}, "segment_name": {}}
var hashableEdgeTags = map[string]struct{}{"event_type": {}, "exchange": {}, "group": {}, "kafka_cluster_id": {}, "subscription": {}, "topic": {}, "type": {}, "direction": {}, "segment_name": {}}

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.

This needs a test for subscription. I removed it from hashableEdgeTags and all the pubsubtrace DSM tests still pass (each hash just drops the tag on both sides). Adding {"subscription:orders", true} to the isWellFormedEdgeTag table in pathway_test.go would cover it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added {"subscription:orders", true} to the isWellFormedEdgeTag table in 5fa8f6d.

if msg == nil {
return ctx
}
parent := datastreams.ExtractFromBase64Carrier(context.Background(), dataStreamsCarrier(msg.Attributes))

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.

This should have a comment on why the parent comes from the message attributes and replaces the pathway in ctx instead of merging, it's hard to tell without the earlier review thread. Something like:

// The checkpoint uses the pathway in the message attributes as its parent,
// not the pathway in ctx. ctx can already carry a pathway from another
// consumer, and datastreams.MergeContexts selects one pathway at random, so
// consumeCheckpoint replaces the pathway in ctx.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a shorter version of this above the extract in 5fa8f6d.

Cover the subscription edge tag in the isWellFormedEdgeTag table, explain
why consumeCheckpoint replaces the handler context's pathway, and drop
nil-message guards that callers already make unreachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Error Tracking Audit

OWNER: @DataDog/apm-go — 39 sites (10 CANDIDATE, 0 LIKELY_INELIGIBLE, 29 ignored)
  FILE                                     LINE  LEVEL  CLASSIFICATION  MESSAGE
  ddtrace/tracer/log.go                    255   WARN   CANDIDATE       DIAGNOSTICS Failed to serialize json for startup log (%v) %#v\n
  ddtrace/tracer/otlp_writer.go            148   ERROR  CANDIDATE       Error marshalling OTLP traces data: %s
  ddtrace/tracer/slog.go                   77    WARN   CANDIDATE       %s %s
  ddtrace/tracer/slog.go                   79    ERROR  CANDIDATE       %s %s
  ddtrace/tracer/stats.go                  255   WARN   CANDIDATE       (*concentrator).Start called more than once. This is likely a programming error.
  ddtrace/tracer/stats_to_otlp_metrics.go  150   WARN   CANDIDATE       stats_to_otlp_metrics: failed to decode sketch: %s
  ddtrace/tracer/writer.go                 128   ERROR  CANDIDATE       Error encoding msgpack: %s
  ddtrace/tracer/writer.go                 445   ERROR  CANDIDATE       Error marshaling value %q: %v
  ddtrace/tracer/writer.go                 480   ERROR  CANDIDATE       Error marshaling value %q: %v
  ddtrace/tracer/writer.go                 543   ERROR  CANDIDATE       Lost a trace: %s

OWNER: @DataDog/apm-sdk-capabilities — 101 sites (3 CANDIDATE, 5 LIKELY_INELIGIBLE, 93 ignored)
  FILE                                  LINE  LEVEL  CLASSIFICATION     MESSAGE
  ddtrace/tracer/remote_config.go       362   WARN   CANDIDATE          openfeature: failed to subscribe to Remote Config: %v
  internal/config/config.go             1231  WARN   LIKELY_INELIGIBLE  ignoring DD_TRACE_PAYLOAD_QUEUE_SIZE: value %d is less than 1, using default %d. A value below 1 would leave the queue unbuffered and drop almost every trace.
  internal/config/config.go             1235  WARN   LIKELY_INELIGIBLE  ignoring DD_TRACE_PAYLOAD_QUEUE_SIZE: value %d is above the maximum %d, using default %d. A value above the maximum can panic with "makechan: size out of range" or exhaust memory when the queue is allocated.
  internal/config/config_helpers.go     277   WARN   LIKELY_INELIGIBLE  ignoring DD_TRACE_PAYLOAD_QUEUE_SIZE: value %d is less than 1. A value below 1 would leave the queue unbuffered and drop almost every trace.
  internal/config/config_helpers.go     281   WARN   LIKELY_INELIGIBLE  ignoring DD_TRACE_PAYLOAD_QUEUE_SIZE: value %d is above the maximum %d. A value above the maximum can panic with "makechan: size out of range" or exhaust memory when the queue is allocated.
  internal/config/config_helpers.go     408   WARN   CANDIDATE          Failed to parse DogStatsD udp address %q: %s
  internal/config/config_helpers.go     413   WARN   CANDIDATE          DogStatsD udp address %q has no host, using %s
  internal/config/provider/provider.go  166   WARN   LIKELY_INELIGIBLE  ignoring %s: value %q is not a valid integer

OWNER: @DataDog/asm-go — 21 sites (3 CANDIDATE, 2 LIKELY_INELIGIBLE, 16 ignored)
  FILE                                                   LINE  LEVEL  CLASSIFICATION     MESSAGE
  instrumentation/appsec/emitter/waf/actions/actions.go  47    WARN   CANDIDATE          appsec: action type `%s` already registered
  internal/appsec/appsec.go                              131   ERROR  CANDIDATE          appsec: could not start because of an unexpected error: %s\nNo security activities will be collected. Please contact support at https://docs.datadoghq.com/help/ for help.
  internal/appsec/features.go                            64    WARN   LIKELY_INELIGIBLE  appsec: %s: feature %q cannot be disabled
  internal/appsec/features.go                            75    WARN   LIKELY_INELIGIBLE  appsec: %s: ignoring unknown feature %q
  internal/appsec/remoteconfig.go                        171   ERROR  CANDIDATE          appsec: remote config: could not apply the new security rules: %s

OWNER: @DataDog/ci-app-libraries — 40 sites (3 CANDIDATE, 2 LIKELY_INELIGIBLE, 35 ignored)
  FILE                                                                      LINE  LEVEL  CLASSIFICATION     MESSAGE
  internal/civisibility/integrations/gotesting/coverage/coverage_writer.go  111   ERROR  CANDIDATE          coverageWriter: Error encoding msgpack: %s
  internal/civisibility/integrations/logs/logs_writer.go                    69    ERROR  CANDIDATE          logsWriter: Error encoding JSON: %s
  internal/civisibility/utils/codeowners.go                                 79    WARN   CANDIDATE          civisibility: CODEOWNERS discovery failed; it will be retried: %s
  internal/civisibility/utils/codeowners.go                                 133   WARN   LIKELY_INELIGIBLE  civisibility: CODEOWNERS file exceeds GitHub's %d byte limit and is ignored, as GitHub does: %q
  internal/civisibility/utils/codeowners.go                                 136   WARN   LIKELY_INELIGIBLE  civisibility: CODEOWNERS file has %d invalid lines; their rules were ignored or kept with the owners that could be read: %q

OWNER: @DataDog/data-streams-monitoring — 8 sites (1 CANDIDATE, 3 LIKELY_INELIGIBLE, 4 ignored)
  FILE                               LINE  LEVEL  CLASSIFICATION     MESSAGE
  ddtrace/tracer/data_streams.go     97    WARN   CANDIDATE          datastreams: %s is a no-op and records nothing: Data Streams Monitoring transaction tracking has been removed. Remove the call.
  internal/datastreams/processor.go  123   ERROR  LIKELY_INELIGIBLE  can't serialize pathway latency. Ignoring: %s
  internal/datastreams/processor.go  131   ERROR  LIKELY_INELIGIBLE  can't serialize edge latency. Ignoring: %s
  internal/datastreams/processor.go  139   ERROR  LIKELY_INELIGIBLE  can't serialize payload size. Ignoring: %s

OWNER: @DataDog/dd-trace-go-guild — 10 sites (5 CANDIDATE, 1 LIKELY_INELIGIBLE, 4 ignored)
  FILE                                 LINE  LEVEL  CLASSIFICATION     MESSAGE
  crashtracker/monitor.go              137   WARN   CANDIDATE          crashtracker: upload succeeded
  crashtracker/monitor.go              250   WARN   CANDIDATE          crashtracker: monitor process exited unexpectedly: %v
  instrumentation/httptrace/config.go  150   WARN   CANDIDATE          Could not compile regexp from %s. The query string will not be reported.
  instrumentation/httptrace/config.go  204   WARN   LIKELY_INELIGIBLE  Negative value for env var %s, defaulting to %d.
  instrumentation/logger.go            39    WARN   CANDIDATE          (non-constant)
  instrumentation/logger.go            43    ERROR  CANDIDATE          (non-constant)

OWNER: @DataDog/feature-flagging-and-experimentation-sdk — 43 sites (0 CANDIDATE, 0 LIKELY_INELIGIBLE, 43 ignored)
  FILE  LINE  LEVEL  CLASSIFICATION  MESSAGE

OWNER: @DataDog/ml-observability @DataDog/apm-idm-go @DataDog/apm-go — 41 sites (0 CANDIDATE, 0 LIKELY_INELIGIBLE, 41 ignored)
  FILE  LINE  LEVEL  CLASSIFICATION  MESSAGE

OWNER: @DataDog/profiling-go — 11 sites (8 CANDIDATE, 3 LIKELY_INELIGIBLE, 0 ignored)
  FILE                  LINE  LEVEL  CLASSIFICATION     MESSAGE
  profiler/options.go   405   ERROR  LIKELY_INELIGIBLE  profiler: invalid site provided, using %s (%s)
  profiler/profiler.go  173   WARN   LIKELY_INELIGIBLE  Invalid execution trace config, enabled is true but size limit or frequency is 0. Disabling execution tracing
  profiler/profiler.go  178   WARN   CANDIDATE          goroutine leak profile requires Go 1.27 or later, or GOEXPERIMENT=goroutineleakprofile
  profiler/profiler.go  193   WARN   CANDIDATE          Agentless upload is currently for internal usage only and not officially supported.
  profiler/profiler.go  202   WARN   LIKELY_INELIGIBLE  You are currently setting the DD_API_KEY env variable, but as of dd-trace-go v1.30.0 this value is getting ignored by the profiler. Please verify that your integration is still working.
  profiler/profiler.go  212   WARN   CANDIDATE          unable to look up hostname: %s
  profiler/profiler.go  412   ERROR  CANDIDATE          Error getting %s profile: %v; skipping.
  profiler/profiler.go  504   WARN   CANDIDATE          Evicting one profile batch from the upload queue to make room.
  profiler/profiler.go  527   ERROR  CANDIDATE          Failed to output profile to dir: %s
  profiler/profiler.go  530   ERROR  CANDIDATE          Failed to upload profile: %s
  profiler/upload.go    61    ERROR  CANDIDATE          Uploading profile failed: %s. Trying again in %s...

SUMMARY: 314 sites (33 CANDIDATE, 16 LIKELY_INELIGIBLE, 265 ignored) across 9 owners

Both CANDIDATE and LIKELY_INELIGIBLE are triage labels from message-text heuristics, not verdicts: a human applies the adoption policy in internal/README.md. This check is advisory and does not block the PR.

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