Skip to content

Commit 5b0442e

Browse files
authored
Merge pull request #37 from nenoNaninu/semconv_exception
Support semconv for exception
2 parents 1cf7daf + 51f58a6 commit 5b0442e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/AspNetCore.SignalR.OpenTelemetry/Internal/HubActivitySource.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal static class HubActivitySource
1212

1313
internal static Activity? StartInvocationActivity(string hubName, string methodName, string? address)
1414
{
15-
// https://github.com/open-telemetry/semantic-conventions/blob/v1.24.0/docs/rpc/rpc-spans.md#span-name
15+
// https://github.com/open-telemetry/semantic-conventions/blob/v1.25.0/docs/rpc/rpc-spans.md#span-name
1616
var activity = ActivitySource.CreateActivity($"{hubName}/{methodName}", ActivityKind.Server);
1717

1818
// Activity.IsAllDataRequested is same as TelemetrySpan.IsRecording in OpenTelemetry API.
@@ -23,7 +23,7 @@ internal static class HubActivitySource
2323
return null;
2424
}
2525

26-
// https://github.com/open-telemetry/semantic-conventions/blob/v1.24.0/docs/rpc/rpc-spans.md#common-attributes
26+
// https://github.com/open-telemetry/semantic-conventions/blob/v1.25.0/docs/rpc/rpc-spans.md#common-attributes
2727
activity.SetTag("rpc.system", "signalr");
2828
activity.SetTag("rpc.service", hubName);
2929
activity.SetTag("rpc.method", methodName);
@@ -55,7 +55,11 @@ internal static void StopInvocationActivityError(Activity? activity, Exception e
5555
}
5656

5757
activity.SetTag("otel.status_code", "ERROR");
58-
activity.SetTag("signalr.hub.exception", exception.ToString());
58+
59+
// https://github.com/open-telemetry/semantic-conventions/blob/v1.25.0/docs/exceptions/exceptions-spans.md#attributes
60+
activity.SetTag("exception.message", exception.Message);
61+
activity.SetTag("exception.stacktrace", exception.StackTrace);
62+
activity.SetTag("exception.type", exception.GetType().FullName);
5963
}
6064
}
6165

0 commit comments

Comments
 (0)