Skip to content

Commit

Permalink
[receiver/datadog] Implement '/stats' endpoint (#34790)
Browse files Browse the repository at this point in the history
**Description:** <Describe what has changed.>
Following up on #34772, this PR implements Datadog Agent's `/stats`
endpoint, which is used for sending [client
stats](https://github.com/DataDog/dd-trace-java/blob/master/communication/src/main/java/datadog/communication/ddagent/DDAgentFeaturesDiscovery.java#L40)
of 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)
to calculate the [trace
metrics](https://docs.datadoghq.com/tracing/metrics/metrics_namespace/).

This PR also does a minor refactor in the usage of Datadog's common
headers, moving from literal strings to centralized constants.

**Link to tracking Issue:** <Issue number if applicable>

**Testing:** <Describe what testing was performed and which tests were
added.>

**Documentation:** <Describe the documentation added.>
  • Loading branch information
lopes-felipe authored Aug 27, 2024
1 parent 3099e8e commit 59151b5
Show file tree
Hide file tree
Showing 15 changed files with 813 additions and 50 deletions.
27 changes: 27 additions & 0 deletions .chloggen/datadogreceiver-stats-endpoint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: datadogreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Implement '/stats' endpoint

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [34790]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
2 changes: 1 addition & 1 deletion cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ require (
github.com/DataDog/datadog-agent/pkg/logs/status/utils v0.56.0-rc.12 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.56.0-rc.12 // indirect
github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.12 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.56.0-rc.12 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.56.0 // indirect
github.com/DataDog/datadog-agent/pkg/status/health v0.56.0-rc.12 // indirect
github.com/DataDog/datadog-agent/pkg/telemetry v0.56.0-rc.12 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.57.0-devel.0.20240722160158-ad956a31a730 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 24 additions & 6 deletions receiver/datadogreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ go 1.22.0

require (
github.com/DataDog/agent-payload/v5 v5.0.130
github.com/DataDog/datadog-agent/pkg/obfuscate v0.55.3
github.com/DataDog/datadog-agent/pkg/obfuscate v0.56.0-rc.12
github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.12
github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.12
github.com/DataDog/datadog-api-client-go/v2 v2.29.0
github.com/DataDog/sketches-go v1.4.6
github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.107.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.107.0
github.com/stretchr/testify v1.9.0
github.com/tinylib/msgp v1.1.9
github.com/vmihailenco/msgpack/v4 v4.3.13
go.opentelemetry.io/collector/component v0.107.1-0.20240827012220-5963d446ca4a
go.opentelemetry.io/collector/component/componentstatus v0.107.1-0.20240827012220-5963d446ca4a
Expand All @@ -27,18 +30,22 @@ require (
)

require (
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.56.0 // indirect
github.com/DataDog/datadog-go/v5 v5.5.0 // indirect
github.com/DataDog/go-sqllexer v0.0.12 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.14.0 // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-viper/mapstructure/v2 v2.1.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand All @@ -51,6 +58,7 @@ require (
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/knadh/koanf/providers/confmap v0.1.0 // indirect
github.com/knadh/koanf/v2 v2.1.1 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -61,13 +69,19 @@ require (
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
github.com/prometheus/client_golang v1.20.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rs/cors v1.11.0 // indirect
github.com/tinylib/msgp v1.1.9 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
github.com/shirou/gopsutil/v3 v3.24.4 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/collector v0.107.1-0.20240827012220-5963d446ca4a // indirect
go.opentelemetry.io/collector/client v1.13.1-0.20240827012220-5963d446ca4a // indirect
go.opentelemetry.io/collector/config/configauth v0.107.1-0.20240827012220-5963d446ca4a // indirect
Expand All @@ -88,14 +102,18 @@ require (
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.65.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
Loading

0 comments on commit 59151b5

Please sign in to comment.