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

Add gateway usage #479

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

Add gateway usage #479

wants to merge 5 commits into from

Conversation

ogaca-dd
Copy link
Contributor

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

What does this PR do?

This PR adds a way to know if OTEL is used in a gateway setup.
In order to do so, it checks if datadog.host.name was sent with two different values.

See #479 for additional context.

Motivation

@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 79.41176% with 7 lines in your changes missing coverage. Please review.

Project coverage is 81.26%. Comparing base (30dbd89) to head (d3d2b4b).

Files with missing lines Patch % Lines
pkg/otlp/attributes/source.go 25.00% 2 Missing and 1 partial ⚠️
pkg/otlp/logs/transform.go 0.00% 2 Missing ⚠️
pkg/otlp/attributes/translator.go 66.66% 1 Missing ⚠️
pkg/otlp/logs/translator.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #479      +/-   ##
==========================================
+ Coverage   81.24%   81.26%   +0.02%     
==========================================
  Files          48       49       +1     
  Lines        3668     3689      +21     
==========================================
+ Hits         2980     2998      +18     
- Misses        606      608       +2     
- Partials       82       83       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ogaca-dd ogaca-dd added Skip Changelog breaking-change This PR introduces a Go API breaking change and removed Skip Changelog labels Jan 27, 2025
@ogaca-dd ogaca-dd marked this pull request as ready for review January 27, 2025 14:13
@ogaca-dd ogaca-dd requested a review from a team as a code owner January 27, 2025 14:13
@ogaca-dd ogaca-dd requested a review from liustanley January 27, 2025 14:13
Copy link
Contributor

@liustanley liustanley left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -143,16 +143,24 @@ func unsanitizedHostnameFromAttributes(attrs pcommon.Map) (string, bool) {
return "", false
}

// HostFromAttributesHandler calls OnHost when a hostname is extracted from attributes.
type HostFromAttributesHandler interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for defining and using a new interface here instead of only using GatewayUsage?


import "sync"

type GatewayUsage struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a comment describing GatewayUsage here?

import "sync"

type GatewayUsage struct {
fistHostname string
Copy link
Member

Choose a reason for hiding this comment

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

firstHostname?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This PR introduces a Go API breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants