- Supported .NET Versions
- Install the full package with all available instrumentations
- Install the base package
- Minimizing unneeded dependencies
The packages shipped from this repository generally support all the officially
supported versions of .NET and
.NET Framework (an
older Windows-based .NET implementation), except .NET Framework 3.5
.
Some instrumentations and instrumentation libraries referenced by the distribution don't support both .NET and .NET Framework, but only one of them. For details, refer to the list of supported instrumentations.
For installing the distribution with the full set of dependencies, add a
reference to the Grafana.OpenTelemetry
package to your project.
dotnet add package --prerelease Grafana.OpenTelemetry
The list of supported instrumentations specifies what instrumentations are included in the full package.
For installing the distribution with a minimal set of dependencies, add a
reference to the Grafana.OpenTelemetry.Base
package to your project.
dotnet add package --prerelease Grafana.OpenTelemetry.Base
The list of supported instrumentations and supported resource detectors specify which are included in the base package and enabled by default.
Users might utilize some instrumentation libraries the full package contains, while other contained libraries will not be needed. However, the full package still pulls in those unneeded instrumentations libraries with their dependencies.
To mitigate this situation, base package with a built-in lazy-loading mechanism can be used. This mechanism will initialize known available instrumentation library or resource detectors assembly, regardless of whether it's added as dependency of the full package or as part of the instrumented project.
For example, if it is desired to use the AspNetCore
instrumentation without
pulling in any other dependencies from the full package,
it suffices to install the AspNetCore
instrumentation library along with the
base package.
dotnet add package --prerelease Grafana.OpenTelemetry.Base
dotnet add package --prerelease OpenTelemetry.Instrumentation.AspNetCore
Then, the AspNetCore
instrumentation will be lazy-loaded during the
invocation of the UseGrafana
extension method, no further code changes are
necessary.
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.UseGrafana()
.Build();
This way, any other instrumentation library or resource detector supported by the distribution can be added via lazy loading.