Skip to content

Olivierg/gateway usage gauge#37499

Merged
songy23 merged 19 commits into
open-telemetry:mainfrom
ogaca-dd:olivierg/gateway-usage-gauge
Feb 7, 2025
Merged

Olivierg/gateway usage gauge#37499
songy23 merged 19 commits into
open-telemetry:mainfrom
ogaca-dd:olivierg/gateway-usage-gauge

Conversation

@ogaca-dd

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

Copy link
Copy Markdown
Contributor

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
Comment thread exporter/datadogexporter/go.mod Outdated

@songy23 songy23 left a comment

Copy link
Copy Markdown
Member

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

Comment thread exporter/datadogexporter/internal/metrics/series.go
@ogaca-dd

ogaca-dd commented Feb 4, 2025

Copy link
Copy Markdown
Contributor Author

This needs a changelog too
@songy23 Changelog added.

@songy23

songy23 commented Feb 5, 2025

Copy link
Copy Markdown
Member

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

@songy23

songy23 commented Feb 6, 2025

Copy link
Copy Markdown
Member

…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.
Comment thread exporter/datadogexporter/internal/metrics/series.go Outdated
@songy23 songy23 merged commit 837293f into open-telemetry:main Feb 7, 2025
@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 <songy23@users.noreply.github.com>
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