open-telemetry / opentelemetry-dotnet-contrib

This repository contains set of components extending functionality of the OpenTelemetry .NET SDK. Instrumentation libraries, exporters, and other components can find their home here.
https://opentelemetry.io
Apache License 2.0
473 stars 282 forks source link

Redis attributes not aligned with latest semantic conventions #2098

Open luke6Lh43 opened 1 month ago

luke6Lh43 commented 1 month ago

Component

OpenTelemetry.Instrumentation.StackExchangeRedis

Package Version

Microsoft.Extensions.Hosting 8.0.0 OpenTelemetry 1.9.0 OpenTelemetry.Api 1.9.0 OpenTelemetry.Exporter.OpenTelemetryProtocol 1.9.0 OpenTelemetry.Extensions.Hosting 1.9.0 StackExchange.Redis 2.8.16

Runtime Version

net8.0

Description

Hello,

I have recently been working on a project that required Redis instrumentation for two different languages. During this process, I noticed some discrepancies in the attributes being collected. To investigate further, I conducted testing to check the attributes collected for Redis instrumentation across six of the most popular languages. I have documented my testing in this GitHub repository:

[Link to GitHub Repo]

Findings for .NET

For .NET, the attributes currently being captured are as follows:

What We Capture Today ==> How It Should Look in Latest Semantic Conventions

db.system: redis ==> db.system: redis db.redis.flags: DemandMaster ==> (Custom attribute, not part of standard) db.statement: SET ==> db.query.text: SET net.peer.name: localhost ==> network.peer.name: localhost net.peer.port: 6379 ==> network.peer.port: 6379 db.redis.database_index: 0 ==> db.namespace: "0"

The latest OpenTelemetry semantic conventions for Redis can be found here: OpenTelemetry Semantic Conventions for Redis

Steps to Reproduce

(https://opentelemetry.io/docs/specs/semconv/database/redis/)](https://github.com/luke6Lh43/otel-redis-testing?tab=readme-ov-file#net)

Expected Result

N/A

Actual Result

N/A

Additional Context

I can see there is PR opened by @tiagodaraujo. Not sure if these addresses my findings:

https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1982

Kielek commented 1 month ago

@luke6Lh43, mentioned PR will not solve the issue. What is more, it will be great to update it earlier. See https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1982#discussion_r1763036402

Would you like to contribute?