-
Notifications
You must be signed in to change notification settings - Fork 831
Description
Bug Report
OpenTelemetry.Exporter.Console 1.2.0-rc1
Runtime version (e.g. net461
, net48
, netcoreapp3.1
, net5.0
etc. You can
find this information from the *.csproj
file):
net6.0 Blazor app running as WebAssembly
Symptom
A clear and concise description of what the bug is.
Adding tracing to a Blazor wasm app results in System.PlatformNotSupportedException during runtime as Process.GetCurrentProcess() is not supported in Blazor wasm. The stacktrace is:
System.AggregateException: One or more errors occurred. (The type initializer for 'OpenTelemetry.Resources.ResourceBuilder' threw an exception.) ---> System.TypeInitializationException: The type initializer for 'OpenTelemetry.Resources.ResourceBuilder' threw an exception. ---> System.PlatformNotSupportedException: System.Diagnostics.Process is not supported on this platform. at System.Diagnostics.Process.GetCurrentProcess() at OpenTelemetry.Resources.ResourceBuilder..cctor() --- End of inner exception stack trace --- at OpenTelemetry.Trace.TracerProviderBuilderBase..ctor() at OpenTelemetry.Trace.TracerProviderBuilderSdk..ctor() at OpenTelemetry.Sdk.CreateTracerProviderBuilder() at Program.
$(String[] args) in C:\Sources\Privat\OtelBlazorTracingBug\Program.cs:line 12 --- End of inner exception stack trace ---
The reasons seems to be the in the DefaultResource property of the ResourceBuilder class, see
private static Resource DefaultResource { get; } = new Resource(new Dictionary<string, object> |
What did you expect to see?
Tracing to work in a Blazor wasm app.
What did you see instead?
Runtime exception
Reproduce
See the following repo for a simple reproduction:
https://github.com/mkuennek/OtelBlazorTracingBug
Additional Context
Also discovered elsewhere, see https://wolfgang-ziegler.com/blog/otel-dotnet-blazor