-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[receiver/datadog] Implement '/info' endpoint #34772
[receiver/datadog] Implement '/info' endpoint #34772
Conversation
I'm having a bit of a hard time with the CI checks (as you can see from the list of "fix issues" commits) 😞 Any help on this would be really appreciated here. Thanks 🙂 |
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
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.
I applied a couple of fixes and added comments about how to find and fix them. Let's see if the CI Lords are happy now.
@@ -4,6 +4,7 @@ go 1.22.0 | |||
|
|||
require ( | |||
github.com/DataDog/agent-payload/v5 v5.0.130 | |||
github.com/DataDog/datadog-agent/pkg/obfuscate v0.55.3 |
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.
Because this component is included by other ones (like tests and the dev distribution), you need to run make gotidy
. Running it here, it yielded these changes:
> git st
On branch datadog-receiver/info-endpoint
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: receiver/datadogreceiver/go.sum
modified: testbed/go.mod
modified: testbed/go.sum
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.
Hmm, good to know, thanks :)
@@ -8,6 +8,7 @@ import ( | |||
"context" | |||
"errors" | |||
"fmt" | |||
"go.opentelemetry.io/collector/consumer" |
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 is failing the linter, as we require the imports to be split in three blocks: stdlib, third-party, local packages. This here is a third-party among the stdlib. You can run make lint
from the component's directory, and it should this:
datadogreceiver/receiver_test.go:11: File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/open-telemetry/opentelemetry-collector-contrib) (gci)
"go.opentelemetry.io/collector/consumer"
datadogreceiver/receiver_test.go:20: File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/open-telemetry/opentelemetry-collector-contrib) (gci)
"go.opentelemetry.io/collector/component/componenttest"
datadogreceiver/receiver_test.go:16: File is not `goimports`-ed with -local github.com/open-telemetry/opentelemetry-collector-contrib (goimports)
This is how it looks like:
diff --git a/receiver/datadogreceiver/receiver_test.go b/receiver/datadogreceiver/receiver_test.go
index 76ab51d4c3..573e271ba8 100644
--- a/receiver/datadogreceiver/receiver_test.go
+++ b/receiver/datadogreceiver/receiver_test.go
@@ -8,7 +8,6 @@ import (
"context"
"errors"
"fmt"
- "go.opentelemetry.io/collector/consumer"
"io"
"net/http"
"strings"
@@ -18,6 +17,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
+ "go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric"
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.
Oh, that makes sense. Thanks!
It looks like they are! Thank you for the help |
**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.>
**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]>
**Description:** <Describe what has changed.> Following up on open-telemetry#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.>
Description:
The Datadog agent exposes a
/info
endpoint, communicating its available endpoints and capabilities.This endpoint is used for the trace libraries 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 for the local sampled spans used to calculate the trace metrics.
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 theServeMux
.Link to tracking Issue:
Testing:
Documentation: