Blip.Starter.Common.Traces
0.0.20
See the version list below for details.
dotnet add package Blip.Starter.Common.Traces --version 0.0.20
NuGet\Install-Package Blip.Starter.Common.Traces -Version 0.0.20
<PackageReference Include="Blip.Starter.Common.Traces" Version="0.0.20" />
paket add Blip.Starter.Common.Traces --version 0.0.20
#r "nuget: Blip.Starter.Common.Traces, 0.0.20"
// Install Blip.Starter.Common.Traces as a Cake Addin #addin nuget:?package=Blip.Starter.Common.Traces&version=0.0.20 // Install Blip.Starter.Common.Traces as a Cake Tool #tool nuget:?package=Blip.Starter.Common.Traces&version=0.0.20
Blip.Starter.Common.Traces
First of all, please read all pages of our Tracing documentation.
You should also read about how .NET Core
works with diagnostics distributed tracing.
You must configure your application to be able to instrument it with OpenTelemetry. Follow the configuration above and to instrument follow our .NET instrumentation guideline.
Configuring your application to use OpenTelemetry
To configure your applications to use OpenTelemetry, you need to add Blip.Starter.Common.Traces
NuGet package to your project.
The NuGet package is published in our private NuGet repository: https://dev.azure.com/curupira/BLiP/_artifacts/feed/BlipNuget/NuGet/Blip.Starter.Common.Traces/overview
To access it locally you will need to install Azure Artifacts credential provider.
ASP.NET Core
Then, in your Startup.cs
file or anywhere you configure the framework, add the following code:
// You can change the configuration if needed
ITraceConfiguration configuration = DefaultTraceConfiguration();
// Add the services to the IServiceCollection using the extension from AspNetIntegration
services.AddTracing(configuration);
If you currently use
OpenTracing
in your project, you can enable the integration with OpenTelemetry by using theEnableOpenTracingShim
option in the configuration. Then you can access theITracer
interface using theGlobalTracer.instance
global variable fromOpenTracing
.
Manual configuration
If you must configure OpenTelemetry manually because you do not use ASP.NET Core, you can do it like this:
// You can change the configuration if needed
ITraceConfiguration configuration = DefaultTraceConfiguration();
var builder = OpenTelemetryEngine.ConfigureTracer(configuration);
// After building the OpenTelemetry is ready to be used
// Here we are using the 'using var' keyword to dispose the tracer provider when the scope ends (application shutdown), so this code must be in your main method
using var tracerProvider = builder.build();
OpenTracing
If you currently have the OpenTracing
configured and is using the ITracer
interface you can also integrate OpenTelemetry
with it to obtain the ITracer
interface:
// Instantiate the OpenTracing shim for compatibility with ITracer
var tracer = new TracerShim(
tracerProvider.GetTracer(OpenTracingEngine.Source),
Propagators.DefaultTextMapPropagator);
GlobalTracer.Register(tracer);
// Get ITracer interface using GlobalTracer.Instance where needed
Sending traces to Grafana Tempo
After configuring the instrumentation, you must configure the exporter to send the traces to Grafana Tempo.
This can be done with several environment variables. Please read the documentation to learn what is needed to send traces to Grafana Tempo.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Blip.Starter.Common.Env (>= 0.0.20)
- OpenTelemetry.Exporter.Console (>= 1.6.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.6.0)
- OpenTelemetry.Extensions.Hosting (>= 1.6.0)
- OpenTelemetry.Extensions.Propagators (>= 1.6.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.5.1-beta.1)
- OpenTelemetry.Instrumentation.Http (>= 1.5.1-beta.1)
- OpenTelemetry.Shims.OpenTracing (>= 1.6.0-beta.1)
- OpenTracing (>= 0.12.1)
- System.Diagnostics.DiagnosticSource (>= 7.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.