![]() |
VOOZH | about |
dotnet add package Microsoft.Extensions.Telemetry.Abstractions --version 10.7.0
NuGet\Install-Package Microsoft.Extensions.Telemetry.Abstractions -Version 10.7.0
<PackageReference Include="Microsoft.Extensions.Telemetry.Abstractions" Version="10.7.0" />
<PackageVersion Include="Microsoft.Extensions.Telemetry.Abstractions" Version="10.7.0" />Directory.Packages.props
<PackageReference Include="Microsoft.Extensions.Telemetry.Abstractions" />Project file
paket add Microsoft.Extensions.Telemetry.Abstractions --version 10.7.0
#r "nuget: Microsoft.Extensions.Telemetry.Abstractions, 10.7.0"
#:package Microsoft.Extensions.Telemetry.Abstractions@10.7.0
#addin nuget:?package=Microsoft.Extensions.Telemetry.Abstractions&version=10.7.0Install as a Cake Addin
#tool nuget:?package=Microsoft.Extensions.Telemetry.Abstractions&version=10.7.0Install as a Cake Tool
This package contains common abstractions for high-level telemetry primitives. Here are the main features it provides:
From the command-line:
dotnet add package Microsoft.Extensions.Telemetry.Abstractions
Or directly in the C# project file:
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Telemetry.Abstractions" Version="[CURRENTVERSION]" />
</ItemGroup>
The package includes a custom logging generator that enhances the default .NET logging capabilities by replacing the default generator. This generator automatically logs the contents of collections and offers advanced logging features, significantly improving the debugging and monitoring process.
[LoggerMessage(1, LogLevel.Information, "These are the contents of my dictionary: {temperature}")]
internal static partial void LogMyDictionary(ILogger<Program> logger, Dictionary<int, string> temperature);
It also adds the LogProperties attribute which can be applied to an object parameter of a LoggerMessage method. It introspects the passed-in object and automatically adds tags for all its properties. This leads to more informative logs without the need for manual tagging of each property.
[LoggerMessage(1, LogLevel.Information, "Detected a new temperature: {temperature}")]
internal static partial void LogNewTemperature(ILogger<Program> logger, [LogProperties] Temperature temperature);
internal record Temperature(double value, TemperatureUnit unit);
The TagName attribute can be used to specify a custom tag name for each parameter or property. This is useful when you want to have more control over the naming of tags in your logs.
[LoggerMessage(1, LogLevel.Information, "My custom tag name: {my.custom.tagname}")]
public static partial void LogMyCustomTagName(
this ILogger logger,
[TagName("my.custom.tagname")] string name);
Logging data can be enriched by adding custom log enrichers to the service collection. This can be done using specific implementations or generic types.
// Using a specific implementation
builder.Services.AddLogEnricher(new CustomLogEnricher());
// Using a generic type
builder.Services.AddLogEnricher<AnotherLogEnricher>();
Create custom log enrichers by implementing the ILogEnricher interface.
public class CustomLogEnricher : ILogEnricher
{
public void Enrich(IEnrichmentTagCollector collector)
{
// Add custom logic to enrich log data
collector.Add("CustomTag", "CustomValue");
}
}
To track latency in an application it is possible to register checkpoint, measure, and tag names using the following methods:
builder.Services.RegisterCheckpointNames("databaseQuery", "externalApiCall");
builder.Services.RegisterMeasureNames("responseTime", "processingTime");
builder.Services.RegisterTagNames("userId", "transactionId");
Implement the ILatencyDataExporter to export latency data. This can be integrated with external systems or logging frameworks.
public class CustomLatencyDataExporter : ILatencyDataExporter
{
public async Task ExportAsync(LatencyData data, CancellationToken cancellationToken)
{
// Export logic here
}
}
Use the latency context to track performance metrics in your application.
public void YourMethod(ILatencyContextProvider contextProvider)
{
var context = contextProvider.CreateContext();
var checkpointToken = context.GetCheckpointToken("databaseQuery");
// Start measuring
context.AddCheckpoint(checkpointToken);
// Perform operations...
// End measuring
context.AddCheckpoint(checkpointToken);
// Optionally, record measures and tags
context.RecordMeasure(context.GetMeasureToken("responseTime"), measureValue);
context.SetTag(context.GetTagToken("userId"), "User123");
}
The IDownstreamDependencyMetadata interface is designed to capture and store metadata about the downstream dependencies of an HTTP request. This is particularly useful for understanding external service dependencies and their impact on your application's performance and reliability.
The IOutgoingRequestContext interface provides a mechanism for associating metadata with outgoing HTTP requests. This allows you to enrich outbound requests with additional information that can be used for logging, telemetry, and analysis.
We welcome feedback and contributions in our GitHub repo.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Microsoft.Extensions.Telemetry.Abstractions:
| Package | Downloads |
|---|---|
|
Microsoft.Extensions.Telemetry
Provides canonical implementations of telemetry abstractions. |
|
|
Microsoft.Extensions.Resilience
Extensions to the Polly libraries to enrich telemetry with metadata and exception summaries. |
|
|
Duende.AccessTokenManagement
Automatic access token management for OAuth client credential flows |
|
|
Microsoft.Extensions.Diagnostics.Testing
Hand-crafted fakes to make telemetry-related testing easier. |
|
|
Microsoft.Extensions.Diagnostics.HealthChecks.Common
Health check implementations. |
Showing the top 7 popular GitHub repositories that depend on Microsoft.Extensions.Telemetry.Abstractions:
| Repository | Stars |
|---|---|
|
open-telemetry/opentelemetry-dotnet
The OpenTelemetry .NET Client
|
|
|
Azure/azure-functions-host
The host/runtime that powers Azure Functions
|
|
|
featbit/featbit
Enterprise-grade feature flag platform that you can self-host. Get started - free.
|
|
|
mehdihadeli/food-delivery-microservices
🍔 A practical and cloud-native food delivery microservices, built with .Net Aspire, .Net 9, MassTransit, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
|
|
|
destructurama/attributed
Use attributes to control how complex types are logged to Serilog.
|
|
|
DuendeSoftware/foss
Duende's Free and Open Source software.
|
|
|
stbychkov/AutoLoggerMessage
A source generator that automatically migrates your logging calls to the LoggerMessage version
|
| Version | Downloads | Last Updated |
|---|---|---|
| 10.7.0 | 371,183 | 6/9/2026 |
| 10.6.0 | 2,543,974 | 5/12/2026 |
| 10.5.0 | 4,165,976 | 4/15/2026 |
| 10.4.0 | 4,434,303 | 3/10/2026 |
| 10.3.0 | 4,526,870 | 2/10/2026 |
| 10.2.0 | 4,517,066 | 1/13/2026 |
| 10.1.0 | 5,035,222 | 12/9/2025 |
| 10.0.0 | 7,956,545 | 11/11/2025 |
| 9.10.0 | 6,261,507 | 10/14/2025 |
| 9.9.0 | 5,427,307 | 9/9/2025 |
| 9.8.0 | 3,157,426 | 8/12/2025 |
| 9.7.0 | 4,365,666 | 7/8/2025 |
| 9.6.0 | 3,966,516 | 6/10/2025 |
| 9.5.0 | 3,198,626 | 5/13/2025 |
| 9.4.0 | 4,335,252 | 4/8/2025 |
| 9.3.0 | 3,068,041 | 3/11/2025 |
| 9.2.0 | 4,398,922 | 2/11/2025 |
| 9.1.0 | 3,837,444 | 1/14/2025 |
| 9.0.0 | 7,486,305 | 11/12/2024 |
| 8.10.0 | 20,745,848 | 10/8/2024 |