0

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.

Oliver
  • 117
  • 2
  • 15
  • 1
    > 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. .NET Core and Akka are absolutely supported. Phobos 2.0 does all of this with OTel. – Aaronontheweb Mar 29 '22 at 20:27
  • @Aaronontheweb true, but Phobos isn't an option for us due to pricing. I only need to log telemetry data in one specific class after all, so I'm looking for a way to do that. – Oliver Mar 30 '22 at 08:27
  • 2
    I promise Phobos will be cheaper in the end than trying to roll it yourself - but best of luck. – Aaronontheweb Mar 30 '22 at 12:23
  • @Aaronontheweb I defenitely agree with you but the company I work for want a "free" solution. Although I don't see a way to do what they want anyway, so either they'll pay or they'll have 1 span per actor and therefore no usable jaeger outputs :P – Oliver Mar 31 '22 at 05:27
  • 1
    @Aaronontheweb (I'm asking this because I obviously know who you are in all of this): Just to clarify, so I can pitch Phobos properly to my team - when wanting to create a new span, each time an actor sends a message, there is no way of doing so except using phobos or essentially writing phobos myself, right? Can Phobos detect when the message is leaving the system and automtically start a new trace with respective sub-spans for all the akka.actor calls? I know its not convention for asking this here in SO but no that I have you here.... – Oliver Mar 31 '22 at 05:39
  • 3
    Yep, Phobos can do all of that. It uses the same context propagation methodologies that the rest of OTel does and we integration test against HttpClient, Entity Framework, and ASP.NET's built-in OTel integration. Works in both directions (ASP.NET -> Akka ->HttpClient -> ASP.NET). Let us know if we can demo it for you: https://sdkbin.com/publisher/petabridge/products/phobos/contact – Aaronontheweb Mar 31 '22 at 23:58

0 Answers0