This package turns an Asp.Net Core service into a istio-enabled application by propagating the ISTIO tracing headers from the incoming Asp.Net Core requests to the HttpClient outgoing requests using the HttpClient factory.
At @nosinovacao we believe that developers shouldn't have to worry about cross-concerns, that's why this package only needs 2 lines of code to enable.
- Install the NuGet package
dotnet add package Istio.Tracing.Propagation.AspNetCore
- Add all the services and middlewares to the
IWebHostBuilder
inProgram.cs
:
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
// The following line enables Istio.Tracing.Propagation
.PropagateIstioHeaders();
If you are using the HttpClientFactory extensions to create your HttpClient's you are ready to go and you can see your applications tracing and telemetry on ISTIO jaeger! 😊
If you are not using the HttpClientFactory
integration you need to explicitely add the CorrelationIdHeaderDelegatingHandler
to your HttpClients:
public class SomeClass
{
public SomeClass(string connectionString, HeadersPropagationDelegatingHandler propagationDelegatingHandler) {
// We need to set the InnerHandler to the default HttpClient one.
propagationDelegatingHandler.InnerHandler = new HttpClientHandler();
// This ensures all outgoing requests will contain the Correlation Id header
var client = new HttpClient(propagationDelegatingHandler);
}
}
To build and run unit tests execute the commands in the root of repository:
dotnet build -c Release
dotnet test -c Release
We really appreciate your interest in contributing for this project. 👍
All we ask is that you follow some simple guidelines, so please read the CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
Thank you, contributors!
Copyright © NOS Inovação.
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details