Skip to content

odeyAbdulrahman/Distributed.Tracing

Repository files navigation

Distributed.Tracing with Opentelemetry and Openzipkin

Logo

Distributed tracing is a method for tracking requests as they flow through a complex system made up of multiple servers and services. It enables developers to understand the behavior of their distributed systems by providing visibility into the path of a request as it traverses different components of the system.

How to use:

After adding the library to our project, we have to follow the following steps:

1 - We will add some lines to Program.cs

using Distributed.Tracing.Extensions;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDistributedTracingServies(builder.Configuration);
var app = builder.Build();
app.UseHttpsRedirection();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
    StartDiagnosticExtension.StartActivity("App-Service1", "StartEndPoint", "Service1 is stated !!");
    endpoints.MapControllers();
});
app.Run();

2 - add Elastic URL in appseting.json .

{
   "OpenTelemetryConfig": {
    "ListenerName": "Service1",
    "ServiceName": "Service1.API",
    "ServiceVersion": "1.0.0"
  },
  "ZipkinConfig": {
    "ZipkinAddress": "http://localhost:9411/api/v2/spans"
  },
}

Result in zipkin:

Logo

Result in zipkin / dependency

Logo

About

Distributed tracing is a technique used to monitor and troubleshoot complex distributed systems by following the path of requests as they travel through multiple services.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published