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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ogaca-dd
Copy link

@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
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.24.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.24.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.24.0
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.24.1-0.20250124131402-bcd6fd1617a6
Copy link
Member

@songy23 songy23 Jan 27, 2025

Choose a reason for hiding this comment

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

Please make a new release of mapping-go after your other PR is merged

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

@@ -67,6 +69,17 @@ func DefaultMetrics(exporterType string, hostname string, timestamp uint64, tags
return metrics
}

// GatewayUsageGauge creates a gauge metric to report is there is a gateway
func GatewayUsageGauge(timestamp uint64, hostname string, tags []string, gatewayUsage *attributes.GatewayUsage) datadogV2.MetricSeries {
series := NewGauge("datadog.otel.gateway", timestamp, gatewayUsage.Gauge(), tags)
Copy link
Member

Choose a reason for hiding this comment

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

What if the gateway host is from traces, metrics and logs, does this gauge report value of 3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter/datadog Datadog components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants