Skip to content

Commit 8477a83

Browse files
[receiver/datadog] Implement '/info' endpoint (#34772)
**Description:** <Describe what has changed.> The Datadog agent exposes a `/info` [endpoint](https://github.com/DataDog/datadog-agent/blob/ab888632bb71bcd57716e3428ed4c242ed7b9aaa/pkg/trace/api/api.go#L205), communicating its available endpoints and capabilities. This endpoint is used for the [trace libraries](https://github.com/DataDog/dd-trace-java/blob/master/communication/src/main/java/datadog/communication/ddagent/DDAgentFeaturesDiscovery.java#L140-L173) to infer the features available in the queried agent, and make some decisions about the telemetry data at hand, including whether to send [client stats](https://github.com/DataDog/dd-trace-java/blob/master/communication/src/main/java/datadog/communication/ddagent/DDAgentFeaturesDiscovery.java#L40) for the [local sampled spans](https://github.com/DataDog/dd-trace-java/blob/master/dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java#L993-L1008) used to calculate the [trace metrics](https://docs.datadoghq.com/tracing/metrics/metrics_namespace/). PS: in order to dynamically expose the available endpoints, this PR also does a minor refactor on the endpoint configuration structure, defining them in a `[]Endpoint` rather than registering them directly in the `ServeMux`. **Link to tracking Issue:** **Testing:** **Documentation:** --------- Signed-off-by: Juraci Paixão Kröhling <[email protected]> Co-authored-by: Juraci Paixão Kröhling <[email protected]>
1 parent 4bac647 commit 8477a83

File tree

8 files changed

+403
-24
lines changed

8 files changed

+403
-24
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: datadogreceiver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Implement '/info' endpoint
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [34772]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

receiver/datadogreceiver/go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.22.0
44

55
require (
66
github.com/DataDog/agent-payload/v5 v5.0.130
7+
github.com/DataDog/datadog-agent/pkg/obfuscate v0.55.3
78
github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.12
89
github.com/DataDog/datadog-api-client-go/v2 v2.29.0
910
github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.107.0
@@ -26,10 +27,14 @@ require (
2627
)
2728

2829
require (
30+
github.com/DataDog/datadog-go/v5 v5.5.0 // indirect
31+
github.com/DataDog/go-sqllexer v0.0.12 // indirect
2932
github.com/DataDog/zstd v1.5.2 // indirect
33+
github.com/Microsoft/go-winio v0.5.1 // indirect
3034
github.com/beorn7/perks v1.0.1 // indirect
3135
github.com/cespare/xxhash/v2 v2.3.0 // indirect
3236
github.com/davecgh/go-spew v1.1.1 // indirect
37+
github.com/dustin/go-humanize v1.0.0 // indirect
3338
github.com/felixge/httpsnoop v1.0.4 // indirect
3439
github.com/fsnotify/fsnotify v1.7.0 // indirect
3540
github.com/go-logr/logr v1.4.2 // indirect
@@ -52,7 +57,9 @@ require (
5257
github.com/modern-go/reflect2 v1.0.2 // indirect
5358
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5459
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.107.0 // indirect
60+
github.com/outcaste-io/ristretto v0.2.1 // indirect
5561
github.com/philhofer/fwd v1.1.2 // indirect
62+
github.com/pkg/errors v0.9.1 // indirect
5663
github.com/pmezard/go-difflib v1.0.0 // indirect
5764
github.com/prometheus/client_golang v1.19.1 // indirect
5865
github.com/prometheus/client_model v0.6.1 // indirect
@@ -82,6 +89,7 @@ require (
8289
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
8390
go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect
8491
go.opentelemetry.io/otel/trace v1.28.0 // indirect
92+
go.uber.org/atomic v1.10.0 // indirect
8593
golang.org/x/net v0.28.0 // indirect
8694
golang.org/x/oauth2 v0.21.0 // indirect
8795
golang.org/x/sys v0.23.0 // indirect

receiver/datadogreceiver/go.sum

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package translator // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver/internal/translator"
5+
6+
import (
7+
"github.com/DataDog/datadog-agent/pkg/obfuscate"
8+
)
9+
10+
type ReducedObfuscationConfig struct {
11+
ElasticSearch bool `json:"elastic_search"`
12+
Mongo bool `json:"mongo"`
13+
SQLExecPlan bool `json:"sql_exec_plan"`
14+
SQLExecPlanNormalize bool `json:"sql_exec_plan_normalize"`
15+
HTTP obfuscate.HTTPConfig `json:"http"`
16+
RemoveStackTraces bool `json:"remove_stack_traces"`
17+
Redis obfuscate.RedisConfig `json:"redis"`
18+
Memcached obfuscate.MemcachedConfig `json:"memcached"`
19+
}
20+
21+
type ReducedConfig struct {
22+
DefaultEnv string `json:"default_env"`
23+
TargetTPS float64 `json:"target_tps"`
24+
MaxEPS float64 `json:"max_eps"`
25+
ReceiverPort int `json:"receiver_port"`
26+
ReceiverSocket string `json:"receiver_socket"`
27+
ConnectionLimit int `json:"connection_limit"`
28+
ReceiverTimeout int `json:"receiver_timeout"`
29+
MaxRequestBytes int64 `json:"max_request_bytes"`
30+
StatsdPort int `json:"statsd_port"`
31+
MaxMemory float64 `json:"max_memory"`
32+
MaxCPU float64 `json:"max_cpu"`
33+
AnalyzedSpansByService map[string]map[string]float64 `json:"analyzed_spans_by_service"`
34+
Obfuscation ReducedObfuscationConfig `json:"obfuscation"`
35+
}
36+
37+
type DDInfo struct {
38+
Version string `json:"version"`
39+
Endpoints []string `json:"endpoints"`
40+
ClientDropP0s bool `json:"client_drop_p0s"`
41+
SpanMetaStructs bool `json:"span_meta_structs"`
42+
LongRunningSpans bool `json:"long_running_spans"`
43+
Config *ReducedConfig `json:"config"`
44+
}

0 commit comments

Comments
 (0)