You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey. We have integrated OpenTelemetry using System.Diagnostics.ActivitySource in our services and now looking to improve observability in the end-to-end tests. We are using MsTest to run different scenarios, including calling web services (with OTel support), sending bus messages, accessing databases, etc.
We want to achieve the following with as less duplicate code as possible:
Assembly Initialize:
create a new ActivitySource
wrap the method logic with an Activity
Assembly Cleanup:
wrap the method logic with an Activity
dispose the ActivitySource created on Assembly Initialize
Class Initialize/Cleanup: wrap the method logic with an Activity
Test method: wrap the method logic with an Activity
The last point looks pretty simple. It can be achieved by deriving the TestMethodAttribute and overriding the Execute method. And by deriving from TestClassAttribute and overriding the GetTestMethodAttribute, we can simply replace the [TestClass] with our [TelemetryTestClass] and finish the task with minimal changes.
But unfortunately, it's impossible to do the same with Assembly and Class Initialize/Cleanup attributes.
Are there any extension points that would allow implementing it once and reusing it in all assemblies/classes? If not, would you consider providing such extension points in future releases?
@gao-artur I have changed the title of your issue as for now we will only allow to derive the fixture attributes so you can achieve the feature yourself. I still strongly want to provide a built-in Open Telemetry feature but we will need more design time.
Blocking for now the progress on this because we need to agree on direction to take as first implementation is unveiling quite some questions. We first have to decide if we want to allow to provide only a before and after functionality or offer a "invoke" functionnality. After that, we need to decide what to do for things like timeout (e.g. is [Timeout] only applying to the user method and so the before/after or code wrapping it in case of invoke not part of the timeout or is it?), what about special scheduling like STA.
There are also some questions regarding the impact/difference of behavior when having a sync vs async method where things like Culture would (or would not) flow down.
Hey. We have integrated OpenTelemetry using
System.Diagnostics.ActivitySource
in our services and now looking to improve observability in the end-to-end tests. We are usingMsTest
to run different scenarios, including calling web services (with OTel support), sending bus messages, accessing databases, etc.We want to achieve the following with as less duplicate code as possible:
ActivitySource
Activity
Activity
ActivitySource
created on Assembly InitializeActivity
Activity
The last point looks pretty simple. It can be achieved by deriving the
TestMethodAttribute
and overriding theExecute
method. And by deriving fromTestClassAttribute
and overriding theGetTestMethodAttribute
, we can simply replace the[TestClass]
with our[TelemetryTestClass]
and finish the task with minimal changes.But unfortunately, it's impossible to do the same with Assembly and Class Initialize/Cleanup attributes.
Are there any extension points that would allow implementing it once and reusing it in all assemblies/classes? If not, would you consider providing such extension points in future releases?
AB#2332773
The text was updated successfully, but these errors were encountered: