Hello!
I have a monolithic application with lots of services implemented as classes, in one process.
I'd like to have all my traces attributed to their services in Jaeger UI.
As far as I see, the only way to specify a service name is to create a TracerFactory:
c#
var factory = TracerFactory.Create(builder => builder.UseJaeger(o =>
{
o.ServiceName = serviceName;
o.AgentHost = ...
}));
But I'd like to avoid creating so many tracer factories.
I prefer having a single global tracer factory in my server process.
Is it possible to specify ServiceName for a tracer or for a telemetry span?
For the LAST span, this can be achieved when creating an activity with ActivityKind.Client ( see OpenTelemetry.Instrumentation.SqlClient ).
newAct.SetTag("peer.service", "whatever");
newAct.SetTag("net.peer.name", "whatever");
But your question remains for other spans ....
I think for monitoring purposes it makes sense to view them as a single service if they run in the same process. There is no isolation between them, so if e.g. you have GC issues in one "service" the other one will be just as affected.
@ignatandrei What do you mean by "LAST span"? The peer.service attribute you mentioned is for the remote service name, not for the service name of the span. And net.peer.name is rather unrelated, it is (usually) a DNS hostname of whatever you connect to.
@Oberon00 :
internal void AddConnectionLevelDetailsToActivity(string dataSource, Activity sqlActivity)
@Oberon00 is right that the monitoring is clearly written with process boundaries (think microservices).
Clearly. in the case of a monolithic app where you want to visualize component separation you are blocked with current implementation.
My goal was to leverage the different colors used in jaeger/zipkin to identify layers in my server app, or domain boundaries, as you can see on different screenshots from jaeger UI for example :



Currently, the UI is monochromatic for my entire server stack.
I think SQL achieve specific colors by using the ActivityKind.Client parameter, and because it involves calling an external resource.
Here, we just want to split visually the different layers of our big service.
I hoped that Activity.SetCustomProperty or Activity.SetTag could be used to override service.name. It seems not.
this problem is also UI specific, see this related issue #336 on jaeger ui project.
And I don't think there is a nice solution for that. Services are really per-process, and only operation are displayed. component or otel.library.name are never used visually. It's rooted in the initial use-case for these UI : micro and distributed services.
See also zipkin which has the same issue: #2512