Skip to content
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

Olivierg/gateway usage gauge #37499

Merged
merged 19 commits into from
Feb 7, 2025

Conversation

ogaca-dd
Copy link
Contributor

@ogaca-dd ogaca-dd commented Jan 27, 2025

Description

This PR adds a new gauge metric datadog.otel.gateway. This metric is set at 1 when the collector is used as a gateway otherwise, the value is 0.
If datadog.host.name was sent with two different values, then the collector is used as a gateway.

Note: The PR on opentelemetry-mapping-go should be merged before this PR and go.mod must use a commit on main instead of 0.24.1-0.20250124131402-bcd6fd1617a6

Associated PRs:

Link to tracking issue

Fixes

Testing

The following commands generates the metric datadog.otel.gateway at 1

telemetrygen metrics --otlp-insecure   --otlp-attributes "datadog.host.name"=\"host1\"
telemetrygen metrics --otlp-insecure   --otlp-attributes "datadog.host.name"=\"host2\"

Same tests were performed for traces and for logs when isLogsAgentExporterEnabled is false.

Documentation

@github-actions github-actions bot added the exporter/datadog Datadog components label Jan 27, 2025
@ogaca-dd ogaca-dd marked this pull request as ready for review January 27, 2025 12:38
@ogaca-dd ogaca-dd requested a review from a team as a code owner January 27, 2025 12:38
Copy link
Member

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

This needs a changelog too

@ogaca-dd
Copy link
Contributor Author

ogaca-dd commented Feb 4, 2025

This needs a changelog too
@songy23 Changelog added.

@songy23
Copy link
Member

songy23 commented Feb 5, 2025

more breaking changes: https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13159514653/job/36725209514?pr=37499

@songy23
Copy link
Member

songy23 commented Feb 6, 2025

…NLogs"

TestLogsExporter creates a DatadogLogServerMock which assumes that every request type are "log". As hosts is empty in exportUsageMetrics, sends the series only if it is not empty solve the issue.
@songy23 songy23 merged commit 837293f into open-telemetry:main Feb 7, 2025
162 of 163 checks passed
@github-actions github-actions bot added this to the next release milestone Feb 7, 2025
chengchuanpeng pushed a commit to chengchuanpeng/opentelemetry-collector-contrib that referenced this pull request Feb 8, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This PR adds a new gauge metric `datadog.otel.gateway`. This metric is
set at `1` when the collector is used as a gateway otherwise, the value
is `0`.
If `datadog.host.name` was sent with two different values, then the
collector is used as a gateway.

Note: [The PR on
opentelemetry-mapping-go](DataDog/opentelemetry-mapping-go#479)
should be merged before this PR and `go.mod` must use a commit on main
instead of `0.24.1-0.20250124131402-bcd6fd1617a6`

Associated PRs:
- DataDog/opentelemetry-mapping-go#479
- DataDog/datadog-agent#33370
<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes

<!--Describe what testing was performed and which tests were added.-->
#### Testing
The following commands generates the metric `datadog.otel.gateway` at
`1`
```
telemetrygen metrics --otlp-insecure   --otlp-attributes "datadog.host.name"=\"host1\"
telemetrygen metrics --otlp-insecure   --otlp-attributes "datadog.host.name"=\"host2\"
```

Same tests were performed for `traces` and for `logs` when
`isLogsAgentExporterEnabled` is false.


<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Yang Song <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants