We have a distributed system and I am working on a ticket to add attributes to the Open Telemetry traces for NewRelic. In dotnet this is done by setting tags, like so:
Activity.Current.SetTag("bf.my_attribute", "myAttributeValue");
Because the messages are coming from MassTransit (MT), I created a custom Filter to add to the MT pipeline. So far so good. But given that this is part of a library and not the Service itself, I can only perform Unit tests, no integration ones.
My question is, how do I test it? The static Activity class is null in my tests. Any ideas?
Starton that instance. That should make it Current. You can do this in TestSetup and dispose in TestCleanup.