Reputation: 23
Our application consist of angular 6 for the UI and .netcore 2.0 for the back end, looking to implement tracing to it and so far opentracing seems the most prominent but I can't seem to find any good help documentations for .netcore 2.0 apps.
Upvotes: 1
Views: 567
Reputation: 5935
There is several components which works together and can fully satisfy your requirement.
Common opentracing library, consisted of abstract layer for span, tracer, injectors and extractors, etc.
Official jaeger-client-csharp. Full list of clients can be found here, which implement opentracing abstraction layer mentioned earlier.
The final piece is the OpenTracing API for .NET, which is glue between opentracing library and DiagnosticSource concept in dotnet.
Actually, the final library has sample which uses jaeger csharp implementation of ITracer and configure it as default GlobalTracer.
At the rest in your Startup.cs, you will end up with something like from that sample (services is IServiceCollection):
services.AddSingleton<ITracer>(serviceProvider =>
{
string serviceName = Assembly.GetEntryAssembly().GetName().Name;
ILoggerFactory loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
ISampler sampler = new ConstSampler(sample: true);
ITracer tracer = new Tracer.Builder(serviceName)
.WithLoggerFactory(loggerFactory)
.WithSampler(sampler)
.Build();
GlobalTracer.Register(tracer);
return tracer;
});
// Prevent endless loops when OpenTracing is tracking HTTP requests to Jaeger.
services.Configure<HttpHandlerDiagnosticOptions>(options =>
{
options.IgnorePatterns.Add(request => _jaegerUri.IsBaseOf(request.RequestUri));
});
Upvotes: 1