-
Notifications
You must be signed in to change notification settings - Fork 1.4k
support v3 in fakeintake #51150
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
base: main
Are you sure you want to change the base?
support v3 in fakeintake #51150
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,12 @@ type Params struct { | |
| // parameters like the MSI flags. | ||
| AdditionalInstallParameters []string | ||
| SkipAPIKeyInConfig bool | ||
|
|
||
| // intakeScheme, intakeHostname, intakePort are stored by withIntakeHostname so that | ||
| // WithV3MetricsEnabled (applied after fakeintake wiring) can inject V3 endpoints config. | ||
| intakeScheme pulumi.StringInput | ||
| intakeHostname pulumi.StringInput | ||
| intakePort pulumi.IntInput | ||
| } | ||
|
|
||
| type Option = func(*Params) error | ||
|
|
@@ -268,6 +274,11 @@ func WithPulumiResourceOptions(resources ...pulumi.ResourceOption) func(*Params) | |
|
|
||
| func withIntakeHostname(scheme pulumi.StringInput, hostname pulumi.StringInput, port pulumi.IntInput) func(*Params) error { | ||
| return func(p *Params) error { | ||
| // Store so that WithV3MetricsEnabled (applied after) can build V3 endpoints config. | ||
| p.intakeScheme = scheme | ||
| p.intakeHostname = hostname | ||
| p.intakePort = port | ||
|
|
||
| extraConfig := pulumi.Sprintf(`dd_url: %[3]s://%[1]s:%[2]d | ||
| logs_config.logs_dd_url: %[1]s:%[2]d | ||
| logs_config.logs_no_ssl: true | ||
|
|
@@ -338,6 +349,30 @@ func WithFakeintake(fakeintake *fakeintake.Fakeintake) func(*Params) error { | |
| } | ||
| } | ||
|
|
||
| // WithV3MetricsEnabled opts the agent into the V3 metrics intake API for its primary fakeintake | ||
| // endpoint. It adds serializer_experimental_use_v3_api.series/sketches.endpoints pointing at the | ||
| // same URL used for dd_url, so the serializer sends to /api/intake/metrics/v3/series instead of | ||
| // /api/v2/series. | ||
| // | ||
| // Must be called after WithFakeintake (or WithIntakeHostname) so the intake URL is known. | ||
| func WithV3MetricsEnabled() func(*Params) error { | ||
| return func(p *Params) error { | ||
| 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: | ||
| series: | ||
| endpoints: | ||
| - %[3]s://%[1]s:%[2]d | ||
| sketches: | ||
| endpoints: | ||
| - %[3]s://%[1]s:%[2]d | ||
|
Comment on lines
+367
to
+369
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This now configures Useful? React with 👍 / 👎. |
||
| `, p.intakeHostname, p.intakePort, p.intakeScheme) | ||
| p.ExtraAgentConfig = append(p.ExtraAgentConfig, v3Config) | ||
| return nil | ||
| } | ||
| } | ||
|
|
||
| // WithLogs enables the log agent | ||
| func WithLogs() func(*Params) error { | ||
| return func(p *Params) error { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "reader", | ||
| srcs = ["reader.go"], | ||
| importpath = "github.com/DataDog/datadog-agent/test/fakeintake/aggregator/internal/reader", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//pkg/proto/pbgo/dogstatsdhttp", | ||
| "@com_github_datadog_agent_payload_v5//gogen", | ||
| "@org_golang_google_protobuf//encoding/protowire", | ||
| ], | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 (FilterSketchesstill queries/api/beta/sketches, and there is no/api/intake/metrics/v3/sketcheshandler inserverstore/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 👍 / 👎.