1 year ago
#347910
Oliver
Integrating OpenTelemetry into my .netCore (with akka.net) framework: ActivitySource or Tracer?
I'm completely new to OTel and tracing and have been learning a bit the past few days.
I've figured out, that Otel and .net have different names for the same things. ActivitySource in .Net is Tracer in OTel and Span in Otel is Activity in .Net. Is one of the two better practice to use?
What I'd like: I have a system where different kind of calls come in from one side and out of the other. I want to trace the calls through all the different files and classes and akka.actors and have one continuous trace with multiple child spans all the way. So essentially, when I export my data to Jaeger I need to have one trace with a big span tree per call.
(What I've tried) Now I have attempted this by creating an ActivitySource class and using static member variables to trace in multiple locations in my system, like so:
public class MyActivitySource
{
public static string Name = nameof(MyActivitySource);
public static ActivitySource Instance = new ActivitySource(Name);
}
When wanting to trace somewhere in my project, I then do:
using var activity = MyActivitySource.Instance.StartActivity("MyActivity");
activity?.AddTag("message status", message.ToString());
//do tasks
activity?.Stop();
Now this way I need to create the variable "activity" in every function I need it in, which in turn creates multiple traces.
Question: Is there a way of having only one trace/call to go through the entire system? Or is that not the way tracing is meant to be used?
Automatic Tracing - as far as I can see - is not an option, because pure .NetCore and akka is not supported. There is Phobos, but that isn't an option.
The approach I am using I have from here.
akka
akka.net
jaeger
open-telemetry
0 Answers
Your Answer