diff --git a/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisMetrics.cs b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisMetrics.cs index d36f6e2b9a..6c14d34ced 100644 --- a/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisMetrics.cs +++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisMetrics.cs @@ -4,14 +4,15 @@ using System.Diagnostics.Metrics; using System.Reflection; using OpenTelemetry.Internal; +using OpenTelemetry.Trace; namespace OpenTelemetry.Instrumentation.StackExchangeRedis.Implementation; internal class RedisMetrics : IDisposable { - internal const string MetricRequestDurationName = "redis.client.request.duration"; - internal const string MetricQueueDurationName = "redis.client.queue.duration"; - internal const string MetricNetworkDurationName = "redis.client.network.duration"; + internal const string OperationMetricName = "db.client.operation.duration"; + internal const string QueueMetricName = "db.client.queue.duration"; + internal const string NetworkMetricName = "db.client.network.duration"; internal static readonly Assembly Assembly = typeof(StackExchangeRedisInstrumentation).Assembly; internal static readonly AssemblyName AssemblyName = Assembly.GetName(); @@ -25,19 +26,20 @@ public RedisMetrics() this.meter = new Meter(InstrumentationName, InstrumentationVersion); this.QueueHistogram = this.meter.CreateHistogram( - MetricQueueDurationName, + QueueMetricName, unit: "s", description: "Total time the redis request was waiting in queue before being sent to the server."); this.NetworkHistogram = this.meter.CreateHistogram( - MetricNetworkDurationName, + NetworkMetricName, unit: "s", description: "Duration of redis requests since sent the request to receive the response."); - this.RequestHistogram = this.meter.CreateHistogram( - MetricRequestDurationName, + this.OperationHistogram = this.meter.CreateHistogram( + OperationMetricName, unit: "s", - description: "Total client request duration, including processing, queue and server duration."); + description: "Total client request duration, including processing, queue and server duration.", + [new(SemanticConventions.AttributeDbSystem, "redis")]); } public static RedisMetrics Instance { get; } = new RedisMetrics(); @@ -46,9 +48,9 @@ public RedisMetrics() public Histogram NetworkHistogram { get; } - public Histogram RequestHistogram { get; } + public Histogram OperationHistogram { get; } - public bool Enabled => this.RequestHistogram.Enabled; + public bool Enabled => this.OperationHistogram.Enabled; public void Dispose() { diff --git a/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisProfilerEntryInstrumenter.cs b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisProfilerEntryInstrumenter.cs index e86403ea58..5945b56559 100644 --- a/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisProfilerEntryInstrumenter.cs +++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/Implementation/RedisProfilerEntryInstrumenter.cs @@ -212,7 +212,7 @@ static bool GetCommandAndKey( { metrics.QueueHistogram.Record(command.EnqueuedToSending.TotalSeconds, meterTagList); metrics.NetworkHistogram.Record(command.SentToResponse.TotalSeconds, meterTagList); - metrics.RequestHistogram.Record(command.ElapsedTime.TotalSeconds, meterTagList); + metrics.OperationHistogram.Record(command.ElapsedTime.TotalSeconds, meterTagList); } activity?.Stop();