From fc247e16f5989f059aaee232ff0ea8fc5e8da556 Mon Sep 17 00:00:00 2001 From: nenoNaninu Date: Sat, 11 May 2024 19:21:49 +0900 Subject: [PATCH 1/2] support semconv for exception --- .../Internal/HubActivitySource.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AspNetCore.SignalR.OpenTelemetry/Internal/HubActivitySource.cs b/src/AspNetCore.SignalR.OpenTelemetry/Internal/HubActivitySource.cs index 60ecf21..afb4fef 100644 --- a/src/AspNetCore.SignalR.OpenTelemetry/Internal/HubActivitySource.cs +++ b/src/AspNetCore.SignalR.OpenTelemetry/Internal/HubActivitySource.cs @@ -55,7 +55,11 @@ internal static void StopInvocationActivityError(Activity? activity, Exception e } activity.SetTag("otel.status_code", "ERROR"); - activity.SetTag("signalr.hub.exception", exception.ToString()); + + // https://github.com/open-telemetry/semantic-conventions/blob/v1.25.0/docs/exceptions/exceptions-spans.md#attributes + activity.SetTag("exception.message", exception.Message); + activity.SetTag("exception.stacktrace", exception.StackTrace); + activity.SetTag("exception.type", exception.GetType().FullName); } } From 51f58a6cf29872ebc45fa8f8f6b3fbfdd4b1d5b1 Mon Sep 17 00:00:00 2001 From: nenoNaninu Date: Sat, 11 May 2024 19:22:07 +0900 Subject: [PATCH 2/2] update comment --- .../Internal/HubActivitySource.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AspNetCore.SignalR.OpenTelemetry/Internal/HubActivitySource.cs b/src/AspNetCore.SignalR.OpenTelemetry/Internal/HubActivitySource.cs index afb4fef..51738a3 100644 --- a/src/AspNetCore.SignalR.OpenTelemetry/Internal/HubActivitySource.cs +++ b/src/AspNetCore.SignalR.OpenTelemetry/Internal/HubActivitySource.cs @@ -12,7 +12,7 @@ internal static class HubActivitySource internal static Activity? StartInvocationActivity(string hubName, string methodName, string? address) { - // https://github.com/open-telemetry/semantic-conventions/blob/v1.24.0/docs/rpc/rpc-spans.md#span-name + // https://github.com/open-telemetry/semantic-conventions/blob/v1.25.0/docs/rpc/rpc-spans.md#span-name var activity = ActivitySource.CreateActivity($"{hubName}/{methodName}", ActivityKind.Server); // Activity.IsAllDataRequested is same as TelemetrySpan.IsRecording in OpenTelemetry API. @@ -23,7 +23,7 @@ internal static class HubActivitySource return null; } - // https://github.com/open-telemetry/semantic-conventions/blob/v1.24.0/docs/rpc/rpc-spans.md#common-attributes + // https://github.com/open-telemetry/semantic-conventions/blob/v1.25.0/docs/rpc/rpc-spans.md#common-attributes activity.SetTag("rpc.system", "signalr"); activity.SetTag("rpc.service", hubName); activity.SetTag("rpc.method", methodName);