Replies: 1 comment 3 replies
-
I am having a similar issue where a listener is not registered with the ActivitySource. `
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Why is OpenTelemetry not adding a listener for my
ActivitySource
in a hosted service on generic host?I have some configurations to pass into OpenTelemetry set-up, so I depend on a class
MyClass
. This means registering that class, and then configuring a callback action forTracerProviderBuilder
which uses that class. However, when I later create anActivitySource
and start anActivity
withActivitySource.StartActivity(...)
then it returns null because no listeners were attached to the source. By debugging and inspecting theActivitySource
, I could see the list ofs_activeSources
which included theOpenTelemetry.HttpRequest
ActivitySource
created by.AddHttpClientInstrumentation()
so it's odd that no listener was added for that either.Note: This is being run in a unit test and failing, whereas it is working in a long-running worker service program. Not sure if unit tests are too short-lived or are influenced by test environment e.g. Visual Studio
Below is a minimal version of my scenario:
TestService.cs
Package versions:
I've also tried moving the
.AddConsoleExporter()
line out of the.Configure
method and simply called straight away byhostingBuilder
but still no listener attached to anyActivitySource
.Beta Was this translation helpful? Give feedback.
All reactions