Skip to content

support v3 in fakeintake#51150

Open
atanzu wants to merge 3 commits into
mainfrom
mark.kirichenko/support-v3-in-fakeintake
Open

support v3 in fakeintake#51150
atanzu wants to merge 3 commits into
mainfrom
mark.kirichenko/support-v3-in-fakeintake

Conversation

@atanzu
Copy link
Copy Markdown
Contributor

@atanzu atanzu commented May 21, 2026

What does this PR do?

Allow us to test V3 payloads with fakeintake.

Motivation

Current e2e test setup doesn't support the V3 payload format. We want to address this gap.

We add V3 metrics intake support, which relies on the V3 parser from dogstatsd-http. We cannot import this module directly, so we use a copy of it.

Describe how you validated your changes

We add new e2e tests for our usual metrics and for OTel data which verify that we can send data to a V3 endpoint instead of V2.

Additional Notes

V3 payload parser is a copy from dogstatsd-http, so we need to update both in parallel in case of any changes.

@github-actions
Copy link
Copy Markdown
Contributor

@codex review

@github-actions github-actions Bot added the long review PR is complex, plan time to review it label May 21, 2026
@datadog-prod-us1-5
Copy link
Copy Markdown
Contributor

datadog-prod-us1-5 Bot commented May 21, 2026

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 5 Pipeline jobs failed

DataDog/datadog-agent | new-e2e-cws: [--run TestAgentSuiteGCP]   View in Datadog   GitLab

🔄 Retry job. This looks flaky and may succeed on retry. 409 Conflict: Agent rule creation failed in TestAgentSuiteGCP/Test03OpenSignal at /go/src/github.com/DataDog/datadog-agent/test/new-e2e/tests/cws/common.go:119

DataDog/datadog-agent | files_inventory_check   View in Datadog   GitLab

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. Key 'datadog-agent/static_quality_gates/GATE_REPORTS/7fac772c969652613eedec5e80de3e5439cbacab/agent_deb_amd64_size_report_7fac772c.yml' does not exist.

DataDog/datadog-agent | new-e2e-ha-agent-failover   View in Datadog   GitLab

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. Connection refused while trying to reach the agent endpoint: Get "https://localhost:5001/agent/metadata/ha-agent" and "https://localhost:5001/agent/status/section/collector?format=text"

View all 5 failed jobs.

ℹ️ Info

🎯 Code Coverage (details)
Patch Coverage: 11.72%
Overall Coverage: 50.46%

Useful? React with 👍 / 👎

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

Copy link
Copy Markdown

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

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: 69873fff60

ℹ️ 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".

"/api/v1/check_run": getCheckRunPayLoadJSON,
"/api/v1/connections": getConnectionsPayLoadProtobuf,
"/api/beta/sketches": getSketchPayloadProtobuf,
"/api/intake/metrics/v3/series": getMetricV3SeriesPayload,
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 Register V3 sketches route alongside V3 series

This change enables serializer_experimental_use_v3_api.sketches.endpoints (host and Helm paths), so when V3 is turned on the agent sends sketch payloads to /api/intake/metrics/v3/sketches; however fakeintake only adds a parser for /api/intake/metrics/v3/series here, and FilterSketches() still reads /api/beta/sketches. In V3 mode, distribution/sketch assertions will therefore silently see no data even though payloads are being sent, which breaks end-to-end metric coverage for sketches.

Useful? React with 👍 / 👎.

@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 21, 2026

Files inventory check summary

File checks results against ancestor 5d847224:

Results for datadog-agent_7.81.0~devel.git.105.ca9624c.pipeline.114521494-1_amd64.deb:

No change detected

@atanzu atanzu force-pushed the mark.kirichenko/support-v3-in-fakeintake branch from 69873ff to 46d4a45 Compare May 21, 2026 11:35
@github-actions
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

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

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: 46d4a4504b

ℹ️ 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".

"/api/v1/check_run": getCheckRunPayLoadJSON,
"/api/v1/connections": getConnectionsPayLoadProtobuf,
"/api/beta/sketches": getSketchPayloadProtobuf,
"/api/intake/metrics/v3/series": getMetricV3SeriesPayload,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Parse V3 sketches when V3 metrics mode is enabled

This map adds /api/intake/metrics/v3/series but leaves out /api/intake/metrics/v3/sketches, even though WithV3MetricsEnabled now configures both series and sketches V3 endpoints. In that configuration, sketch payloads are sent to the V3 sketches route (comp/forwarder/defaultforwarder/endpoints/endpoints.go) and fakeintake won’t decode them (and FilterSketches still reads /api/beta/sketches), so sketch-based assertions under V3 mode silently miss data. Either add V3-sketch parsing/client support or stop enabling the sketches V3 endpoint until that support exists.

Useful? React with 👍 / 👎.

@atanzu atanzu changed the title Mark.kirichenko/support v3 in fakeintake support v3 in fakeintake May 21, 2026
@atanzu atanzu force-pushed the mark.kirichenko/support-v3-in-fakeintake branch from 46d4a45 to b2b4d07 Compare May 21, 2026 12:17
@github-actions
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

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

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: b2b4d07492

ℹ️ 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".

"/api/v1/check_run": getCheckRunPayLoadJSON,
"/api/v1/connections": getConnectionsPayLoadProtobuf,
"/api/beta/sketches": getSketchPayloadProtobuf,
"/api/intake/metrics/v3/series": getMetricV3SeriesPayload,
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 Add V3 sketches route parsing to fakeintake

When V3 is enabled, the new config paths set both series and sketches V3 endpoints to fakeintake, so sketch payloads are sent to /api/intake/metrics/v3/sketches. This parser map only adds /api/intake/metrics/v3/series, so V3 sketch payloads remain unparsed and FilterSketches() (which still reads /api/beta/sketches) will silently miss them. Any V3-enabled tests asserting distributions/sketches can therefore fail or give false negatives.

Useful? React with 👍 / 👎.

@atanzu atanzu force-pushed the mark.kirichenko/support-v3-in-fakeintake branch from b2b4d07 to 8995a94 Compare May 21, 2026 13:32
@github-actions
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

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

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: 8995a94b17

ℹ️ 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".

Comment on lines +367 to +369
sketches:
endpoints:
- %[3]s://%[1]s:%[2]d
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Stop rerouting sketches until fakeintake can read v3 sketches

This option now enables serializer_experimental_use_v3_api.sketches.endpoints, which redirects sketch/distribution traffic to /api/intake/metrics/v3/sketches, but fakeintake still has no corresponding v3-sketch retrieval path (FilterSketches still queries /api/beta/sketches, and there is no /api/intake/metrics/v3/sketches handler in serverstore/parser.go). As soon as a v3-enabled test needs to assert sketch metrics, it will get empty results despite sketches being sent.

Useful? React with 👍 / 👎.

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.

We can leave sketches out entirely from the config, or separate them from series so we can enable it without sketches.

@atanzu atanzu force-pushed the mark.kirichenko/support-v3-in-fakeintake branch from 8995a94 to ca9624c Compare May 21, 2026 14:48
@github-actions
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

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

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: ca9624c4fe

ℹ️ 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".

Comment on lines +367 to +369
sketches:
endpoints:
- %[3]s://%[1]s:%[2]d
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Don’t enable V3 sketches without fakeintake sketch support

This now configures serializer_experimental_use_v3_api.sketches.endpoints, so sketch/distribution payloads are sent to /api/intake/metrics/v3/sketches, but fakeintake still only exposes sketch parsing/querying on /api/beta/sketches (FilterSketches/GetSketchNames in test/fakeintake/client/client.go). In suites that enable V3 and assert on sketch metrics, those assertions will incorrectly see no data because sketches have been rerouted to an unsupported endpoint.

Useful? React with 👍 / 👎.

@atanzu atanzu added the changelog/no-changelog No changelog entry needed label May 22, 2026
@atanzu atanzu force-pushed the mark.kirichenko/support-v3-in-fakeintake branch from ca9624c to 3655bb2 Compare May 22, 2026 06:23
@github-actions
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

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

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: 3655bb2f3e

ℹ️ 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".

Comment on lines +367 to +369
sketches:
endpoints:
- %[3]s://%[1]s:%[2]d
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 Avoid pointing sketches to unsupported V3 fakeintake route

WithV3MetricsEnabled also rewrites sketch traffic to V3, but this change set only adds fakeintake support for /api/intake/metrics/v3/series (new parser/client path) and adds no parser/client support for /api/intake/metrics/v3/sketches. In E2E runs that emit distribution/sketch metrics with V3 enabled, sketch payloads are sent to an endpoint fakeintake cannot decode/query, so FilterSketches-style assertions will silently see no data and tests can miss or misreport regressions.

Useful? React with 👍 / 👎.

@atanzu atanzu added the qa/done QA done before merge and regressions are covered by tests label May 22, 2026
@atanzu atanzu marked this pull request as ready for review May 22, 2026 10:06
@atanzu atanzu requested review from a team as code owners May 22, 2026 10:06
@atanzu atanzu requested review from agagniere and removed request for a team May 22, 2026 10:06
Copy link
Copy Markdown

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

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: 3655bb2f3e

ℹ️ 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".

}
envVars := pulumi.Map{
"DD_SERIALIZER_EXPERIMENTAL_USE_V3_API_SERIES_ENDPOINTS": pulumi.Sprintf("%s", p.intakeURL),
"DD_SERIALIZER_EXPERIMENTAL_USE_V3_API_SKETCHES_ENDPOINTS": pulumi.Sprintf("%s", p.intakeURL),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid rerouting sketches until fakeintake parses V3 sketches

WithV3MetricsEnabled now sets DD_SERIALIZER_EXPERIMENTAL_USE_V3_API_SKETCHES_ENDPOINTS, which moves distribution/sketch traffic to /api/intake/metrics/v3/sketches, but this change only adds V3 handling for /api/intake/metrics/v3/series (test/fakeintake/server/serverstore/parser.go) and the client still reads sketches from /api/beta/sketches (test/fakeintake/client/client.go). In V3-enabled E2E runs that assert sketch/distribution metrics, fakeintake will silently return no sketches even though the agent is sending them, causing false negatives.

Useful? React with 👍 / 👎.

@carlosroman carlosroman added this to the 7.81.0 milestone May 22, 2026
Comment on lines +367 to +369
sketches:
endpoints:
- %[3]s://%[1]s:%[2]d
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.

We can leave sketches out entirely from the config, or separate them from series so we can enable it without sketches.

if p.intakeHostname == nil || p.intakePort == nil || p.intakeScheme == nil {
return fmt.Errorf("WithV3MetricsEnabled must be called after WithFakeintake or WithIntakeHostname")
}
v3Config := pulumi.Sprintf(`serializer_experimental_use_v3_api:
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 is my personal preference, but I try to avoid plain text templating like this. I'd make a struct and serialize it with proper serializer, just to avoid potential issues with quoting strings or counting spaces.

// Store so that WithV3MetricsEnabled (applied after) can build V3 endpoints config.
p.intakeScheme = scheme
p.intakeHostname = hostname
p.intakePort = port
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.

With this, we format the url twice. Would it make sense to construct it here, stash it and use the complete string in two places?

return nil, fmt.Errorf("v3 next sketch point: %w", err)
}
}
continue
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.

We should return an error if a sketch is encountered in a series payload, it would be a serious bug in the agent.

case encodingDeflate:
rc, err = zlib.NewReader(bytes.NewReader(payload))
case encodingZstd:
rc = zstd.NewReader(bytes.NewReader(payload))
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 work with zstd with the latest head of DataDog/zstd (v1.5.8-0.20250922095318-5c504fb5d923).

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.

The problem is, I don't see a stable 1.5.8 tag. Would that be OK to have that specific pinned version?

Copy link
Copy Markdown
Contributor

@vickenty vickenty May 22, 2026

Choose a reason for hiding this comment

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

I'll follow up on the release, but yes, it should be OK to pin pre-release version.

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.

It was released as 1.5.7+patch1, +patch is how we version our changes on top of the upstream.

// MetricSeriesV3 represents a single time series decoded from a V3 metrics intake payload
// (/api/intake/metrics/v3/series). The V3 format is a column-oriented protobuf encoding
// described in pkg/proto/datadog/dogstatsdhttp/payload.proto.
type MetricSeriesV3 struct {
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.

Would it make sense to use the old metricAggregator for v3 as well? V3 is expected to be equivalent (at least until we turn on sketches), and should be transparent change. Ideally, the existing tests that currently use v2 protocol should upgrade when we enable v3 by default (and it would be nice if we can run the same suite in parallel for both versions). WDYT?

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.

My initial intent was to make this check as explicit as possible. You are right in terms of usage of a single metricAggregator and its transparency: after the flip the modified fakeintake shall work as is. However, for now we still need to have a clear vision between v2 and v3 (and check that we don't have mixed traffic), so I will update a couple of the existing test suites to have a v3 variant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog No changelog entry needed internal Identify a non-fork PR long review PR is complex, plan time to review it qa/done QA done before merge and regressions are covered by tests team/agent-build team/agent-devx team/agent-metric-pipelines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants