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

[bug] EntityFrameworkCore spans are not populating server.address following the otel conventions #2438

Open
overbit opened this issue Dec 20, 2024 · 0 comments · May be fixed by #2439
Open
Labels
bug Something isn't working comp:instrumentation.entityframeworkcore Things related to OpenTelemetry.Instrumentation.EntityFrameworkCore

Comments

@overbit
Copy link

overbit commented Dec 20, 2024

Component

OpenTelemetry.Instrumentation.EntityFrameworkCore

Package Version

Package Name Version
OpenTelemetry.Instrumentation.EntityFrameworkCore 1.10.0-beta.1

Runtime Version

net8.0,net9.0, any

Description

As reported in the OTEL docs, server.address should be populated with the server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. i.e. example.com10.1.2.80/tmp/my.sock.
Meanwhile, the latest version of OpenTelemetry.Instrumentation.EntityFrameworkCore populate the field prefixing it with the connection protocol tcp.

https://opentelemetry.io/docs/specs/semconv/attributes-registry/server/#server-attributes

Steps to Reproduce

Configure the instrumentation and record some traces

Expected Result

server.address to be populated as my.domain.example
server.port to be populated as 5432

Actual Result

server.address populated as tcp:my.domain.example:5432
server.port not populated

Additional Context

No response

@overbit overbit added the bug Something isn't working label Dec 20, 2024
@github-actions github-actions bot added the comp:instrumentation.entityframeworkcore Things related to OpenTelemetry.Instrumentation.EntityFrameworkCore label Dec 20, 2024
overbit added a commit to overbit/opentelemetry-dotnet-contrib that referenced this issue Dec 20, 2024
…ions

Fixes open-telemetry#2438

Update the `server.address` field in EntityFrameworkCore spans to populate with the server domain name without the `tcp` prefix.

* Modify `src/OpenTelemetry.Instrumentation.EntityFrameworkCore/Implementation/EntityFrameworkDiagnosticListener.cs` to fetch the `host` and `port` properties from the `connection` object and set them to the `server.address` field, with a fallback to use the `dataSource` property if the `host` property is not available.
* Update `src/OpenTelemetry.Instrumentation.EntityFrameworkCore/CHANGELOG.md` to reflect the changes made to the `server.address` field.
* Add tests in `src/OpenTelemetry.Instrumentation.EntityFrameworkCore.Tests/EntityFrameworkInstrumentationTests.cs` to verify the `server.address` field is populated correctly without the `tcp` prefix.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/open-telemetry/opentelemetry-dotnet-contrib/issues/2438?shareId=XXXX-XXXX-XXXX-XXXX).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working comp:instrumentation.entityframeworkcore Things related to OpenTelemetry.Instrumentation.EntityFrameworkCore
Projects
None yet
1 participant