Skip to content

[receiver/datadog] Address semconv noncompliance #39678

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

Merged
merged 13 commits into from
May 14, 2025

Conversation

xiu
Copy link
Contributor

@xiu xiu commented Apr 27, 2025

Description

Note: this PR addresses several things, happy to split it in multiple PRs if it helps.

In #36924, a number of noncompliances were identified. This PR addresses most of them:

Misalignments applying to all span types

  • A resource attribute deployment.resource.name should be defined instead of the span attribute deployment.environment: Str(production)
  • A resource attribute process.pid should be defined instead of the attribute process.id

Addressed by bumping semconv to latest in the collector (1.30.0)

Misalignments applying to HTTP server span

  • Adopt new OTel Semantic Conventions http.request.method and http.response.status_code instead of http.method and http.status_code
  • The span name should be ${http.request.method} ${http.route}, the attribute dd.span.Resource is right for this span type
    • OTTL transformation to fix the pb: set (name, attributes["dd.span.Resource"]) where name == "servlet.request"

Added in 89e2bff

Misalignment applying to internal Spring Framework spans(span name spring.handler)

Span should be kind = SpanKind.SPAN_KIND_INTERNAL

  • OTTL transformation to fix the pb: set (kind, SPAN_KIND_INTERNAL) where kind == SPAN_KIND_SERVER and name == "spring.handler"
  • Span name should be the Java method nam hat is carried over by the dd.span.Resource attribute
    • OTTL transformation to fix the pb: `set (name, attributes["dd.span.Resource"]) where name

I didn't add the span kind transformation for now as it seemed too involved for the receiver, happy to get feedback on that. Rest in 89e2bff

Misalignments applying to Database client spans

  • The resource attribute service.name should be set to the value of the span attribute _dd.base_service

Done in d067d37. This might be a big change though.

  • Rename the following span attributes
    • db.type -> db.system
    • db.operation -> db.operation.name
    • db.instance -> db.name
  • The span name should be set to ${db.operation.name} ${}

Done in f78caac

Link to tracking issue

#36924

Testing

Unit tests were updated.

@xiu xiu requested review from MovieStoreGuy and a team as code owners April 27, 2025 11:18
@xiu xiu changed the title [receiver/datadog] Bump Semantic Conventions WIP: [receiver/datadog] Bump Semantic Conventions Apr 27, 2025
@xiu xiu marked this pull request as draft April 27, 2025 11:23
@xiu xiu changed the title WIP: [receiver/datadog] Bump Semantic Conventions [receiver/datadog] Address semconv noncompliance Apr 28, 2025
@xiu xiu force-pushed the fix/datadog_receiver_bump_semconv branch from d067d37 to e7a4705 Compare April 28, 2025 08:33
@xiu xiu marked this pull request as ready for review April 28, 2025 11:21
@xiu xiu force-pushed the fix/datadog_receiver_bump_semconv branch 2 times, most recently from 79e758b to 9c76ee6 Compare April 30, 2025 09:11
@xiu xiu marked this pull request as draft May 1, 2025 16:12
@xiu
Copy link
Contributor Author

xiu commented May 1, 2025

Back to draft as we've noted some issues with span names, I'll address them.

@xiu xiu force-pushed the fix/datadog_receiver_bump_semconv branch 4 times, most recently from 23b7702 to 424fb90 Compare May 2, 2025 12:08
@xiu xiu marked this pull request as ready for review May 2, 2025 12:32
@xiu
Copy link
Contributor Author

xiu commented May 2, 2025

Addressed the issues and fixed some others. Ready for review 👍

@cyrille-leclerc
Copy link
Member

cyrille-leclerc commented May 3, 2025

Here are all tests showing this PR fixes many semconv compliance issues:

HTTP server spans

Spec: https://opentelemetry.io/docs/specs/semconv/http/http-spans/

image

DB client spans

Specs: https://opentelemetry.io/docs/specs/semconv/database/database-spans/#common-attributes

PostgreSQL client span

image

Redis client spans

image

Copy link
Contributor

@dehaansa dehaansa left a comment

Choose a reason for hiding this comment

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

Looks like a great improvement to the receiver - once you resolve the linter issues we can move forward. Please let us know if you need any assistance with the linting issues.

@atoulme atoulme marked this pull request as draft May 9, 2025 18:28
@atoulme
Copy link
Contributor

atoulme commented May 9, 2025

Please resolve linting issues and conflicts and mark ready for review again.

@xiu xiu force-pushed the fix/datadog_receiver_bump_semconv branch from 3f35879 to 88eeb55 Compare May 13, 2025 05:33
@xiu
Copy link
Contributor Author

xiu commented May 13, 2025

Rebased, fixed fmt and switched to otel-go's semconvs, which bumped them to v1.30.0.

@xiu xiu marked this pull request as ready for review May 13, 2025 06:15
Copy link
Contributor

@dehaansa dehaansa left a comment

Choose a reason for hiding this comment

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

One nit in the changelog then 👍

@dehaansa dehaansa added the ready to merge Code review completed; ready to merge by maintainers label May 14, 2025
@codeboten codeboten merged commit 4014347 into open-telemetry:main May 14, 2025
182 checks passed
@github-actions github-actions bot added this to the next release milestone May 14, 2025
seongpil0948 pushed a commit to seongpil0948/opentelemetry-collector-contrib that referenced this pull request May 16, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
**Note: this PR addresses several things, happy to split it in multiple
PRs if it helps.**

In open-telemetry#36924, a number of noncompliances were identified. This PR addresses
most of them:
> Misalignments applying to all span types
> 
> * A resource attribute deployment.resource.name should be defined
instead of the span attribute deployment.environment: Str(production)
> * A resource attribute process.pid should be defined instead of the
attribute process.id

Addressed by bumping semconv to latest in the collector (1.30.0)

> Misalignments applying to HTTP server span
> 
> * Adopt new OTel Semantic Conventions http.request.method and
http.response.status_code instead of http.method and http.status_code
> * The span name should be ${http.request.method} ${http.route}, the
attribute dd.span.Resource is right for this span type
> * OTTL transformation to fix the pb: set (name,
attributes["dd.span.Resource"]) where name == "servlet.request"

Added in 89e2bff

> Misalignment applying to internal Spring Framework spans(span name
spring.handler)
> 
> Span should be kind = SpanKind.SPAN_KIND_INTERNAL
> * OTTL transformation to fix the pb: set (kind, SPAN_KIND_INTERNAL)
where kind == SPAN_KIND_SERVER and name == "spring.handler"
> * Span name should be the Java method nam hat is carried over by the
dd.span.Resource attribute
> * OTTL transformation to fix the pb: `set (name,
attributes["dd.span.Resource"]) where name

I didn't add the span kind transformation for now as it seemed too
involved for the receiver, happy to get feedback on that. Rest in
89e2bff

> Misalignments applying to Database client spans
> 
> * The resource attribute service.name should be set to the value of
the span attribute _dd.base_service

Done in d067d37. This might be a big
change though.

> * Rename the following span attributes
>     * db.type -> db.system
>     * db.operation -> db.operation.name
>     * db.instance -> db.name
> * The span name should be set to ${db.operation.name} ${}

Done in f78caac

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
open-telemetry#36924 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests were updated.

<!--Please delete paragraphs that you did not use before submitting.-->
johnleslie pushed a commit to johnleslie/opentelemetry-collector-contrib that referenced this pull request May 23, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
**Note: this PR addresses several things, happy to split it in multiple
PRs if it helps.**

In open-telemetry#36924, a number of noncompliances were identified. This PR addresses
most of them:
> Misalignments applying to all span types
> 
> * A resource attribute deployment.resource.name should be defined
instead of the span attribute deployment.environment: Str(production)
> * A resource attribute process.pid should be defined instead of the
attribute process.id

Addressed by bumping semconv to latest in the collector (1.30.0)

> Misalignments applying to HTTP server span
> 
> * Adopt new OTel Semantic Conventions http.request.method and
http.response.status_code instead of http.method and http.status_code
> * The span name should be ${http.request.method} ${http.route}, the
attribute dd.span.Resource is right for this span type
> * OTTL transformation to fix the pb: set (name,
attributes["dd.span.Resource"]) where name == "servlet.request"

Added in 89e2bff

> Misalignment applying to internal Spring Framework spans(span name
spring.handler)
> 
> Span should be kind = SpanKind.SPAN_KIND_INTERNAL
> * OTTL transformation to fix the pb: set (kind, SPAN_KIND_INTERNAL)
where kind == SPAN_KIND_SERVER and name == "spring.handler"
> * Span name should be the Java method nam hat is carried over by the
dd.span.Resource attribute
> * OTTL transformation to fix the pb: `set (name,
attributes["dd.span.Resource"]) where name

I didn't add the span kind transformation for now as it seemed too
involved for the receiver, happy to get feedback on that. Rest in
89e2bff

> Misalignments applying to Database client spans
> 
> * The resource attribute service.name should be set to the value of
the span attribute _dd.base_service

Done in d067d37. This might be a big
change though.

> * Rename the following span attributes
>     * db.type -> db.system
>     * db.operation -> db.operation.name
>     * db.instance -> db.name
> * The span name should be set to ${db.operation.name} ${}

Done in f78caac

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
open-telemetry#36924 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests were updated.

<!--Please delete paragraphs that you did not use before submitting.-->
johnleslie pushed a commit to johnleslie/opentelemetry-collector-contrib that referenced this pull request May 23, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
**Note: this PR addresses several things, happy to split it in multiple
PRs if it helps.**

In open-telemetry#36924, a number of noncompliances were identified. This PR addresses
most of them:
> Misalignments applying to all span types
> 
> * A resource attribute deployment.resource.name should be defined
instead of the span attribute deployment.environment: Str(production)
> * A resource attribute process.pid should be defined instead of the
attribute process.id

Addressed by bumping semconv to latest in the collector (1.30.0)

> Misalignments applying to HTTP server span
> 
> * Adopt new OTel Semantic Conventions http.request.method and
http.response.status_code instead of http.method and http.status_code
> * The span name should be ${http.request.method} ${http.route}, the
attribute dd.span.Resource is right for this span type
> * OTTL transformation to fix the pb: set (name,
attributes["dd.span.Resource"]) where name == "servlet.request"

Added in 89e2bff

> Misalignment applying to internal Spring Framework spans(span name
spring.handler)
> 
> Span should be kind = SpanKind.SPAN_KIND_INTERNAL
> * OTTL transformation to fix the pb: set (kind, SPAN_KIND_INTERNAL)
where kind == SPAN_KIND_SERVER and name == "spring.handler"
> * Span name should be the Java method nam hat is carried over by the
dd.span.Resource attribute
> * OTTL transformation to fix the pb: `set (name,
attributes["dd.span.Resource"]) where name

I didn't add the span kind transformation for now as it seemed too
involved for the receiver, happy to get feedback on that. Rest in
89e2bff

> Misalignments applying to Database client spans
> 
> * The resource attribute service.name should be set to the value of
the span attribute _dd.base_service

Done in d067d37. This might be a big
change though.

> * Rename the following span attributes
>     * db.type -> db.system
>     * db.operation -> db.operation.name
>     * db.instance -> db.name
> * The span name should be set to ${db.operation.name} ${}

Done in f78caac

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
open-telemetry#36924 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests were updated.

<!--Please delete paragraphs that you did not use before submitting.-->
dragonlord93 pushed a commit to dragonlord93/opentelemetry-collector-contrib that referenced this pull request May 23, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
**Note: this PR addresses several things, happy to split it in multiple
PRs if it helps.**

In open-telemetry#36924, a number of noncompliances were identified. This PR addresses
most of them:
> Misalignments applying to all span types
> 
> * A resource attribute deployment.resource.name should be defined
instead of the span attribute deployment.environment: Str(production)
> * A resource attribute process.pid should be defined instead of the
attribute process.id

Addressed by bumping semconv to latest in the collector (1.30.0)

> Misalignments applying to HTTP server span
> 
> * Adopt new OTel Semantic Conventions http.request.method and
http.response.status_code instead of http.method and http.status_code
> * The span name should be ${http.request.method} ${http.route}, the
attribute dd.span.Resource is right for this span type
> * OTTL transformation to fix the pb: set (name,
attributes["dd.span.Resource"]) where name == "servlet.request"

Added in 89e2bff

> Misalignment applying to internal Spring Framework spans(span name
spring.handler)
> 
> Span should be kind = SpanKind.SPAN_KIND_INTERNAL
> * OTTL transformation to fix the pb: set (kind, SPAN_KIND_INTERNAL)
where kind == SPAN_KIND_SERVER and name == "spring.handler"
> * Span name should be the Java method nam hat is carried over by the
dd.span.Resource attribute
> * OTTL transformation to fix the pb: `set (name,
attributes["dd.span.Resource"]) where name

I didn't add the span kind transformation for now as it seemed too
involved for the receiver, happy to get feedback on that. Rest in
89e2bff

> Misalignments applying to Database client spans
> 
> * The resource attribute service.name should be set to the value of
the span attribute _dd.base_service

Done in d067d37. This might be a big
change though.

> * Rename the following span attributes
>     * db.type -> db.system
>     * db.operation -> db.operation.name
>     * db.instance -> db.name
> * The span name should be set to ${db.operation.name} ${}

Done in f78caac

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
open-telemetry#36924 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests were updated.

<!--Please delete paragraphs that you did not use before submitting.-->
dd-jasminesun pushed a commit to DataDog/opentelemetry-collector-contrib that referenced this pull request Jun 23, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
**Note: this PR addresses several things, happy to split it in multiple
PRs if it helps.**

In open-telemetry#36924, a number of noncompliances were identified. This PR addresses
most of them:
> Misalignments applying to all span types
> 
> * A resource attribute deployment.resource.name should be defined
instead of the span attribute deployment.environment: Str(production)
> * A resource attribute process.pid should be defined instead of the
attribute process.id

Addressed by bumping semconv to latest in the collector (1.30.0)

> Misalignments applying to HTTP server span
> 
> * Adopt new OTel Semantic Conventions http.request.method and
http.response.status_code instead of http.method and http.status_code
> * The span name should be ${http.request.method} ${http.route}, the
attribute dd.span.Resource is right for this span type
> * OTTL transformation to fix the pb: set (name,
attributes["dd.span.Resource"]) where name == "servlet.request"

Added in 89e2bff

> Misalignment applying to internal Spring Framework spans(span name
spring.handler)
> 
> Span should be kind = SpanKind.SPAN_KIND_INTERNAL
> * OTTL transformation to fix the pb: set (kind, SPAN_KIND_INTERNAL)
where kind == SPAN_KIND_SERVER and name == "spring.handler"
> * Span name should be the Java method nam hat is carried over by the
dd.span.Resource attribute
> * OTTL transformation to fix the pb: `set (name,
attributes["dd.span.Resource"]) where name

I didn't add the span kind transformation for now as it seemed too
involved for the receiver, happy to get feedback on that. Rest in
89e2bff

> Misalignments applying to Database client spans
> 
> * The resource attribute service.name should be set to the value of
the span attribute _dd.base_service

Done in d067d37. This might be a big
change though.

> * Rename the following span attributes
>     * db.type -> db.system
>     * db.operation -> db.operation.name
>     * db.instance -> db.name
> * The span name should be set to ${db.operation.name} ${}

Done in f78caac

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
open-telemetry#36924 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests were updated.

<!--Please delete paragraphs that you did not use before submitting.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers receiver/datadog
Projects
None yet
Development

Successfully merging this pull request may close these issues.