OpenTelemetry.Instrumentation.GrpcNetClient
1.13.0-beta.1
Prefix Reserved
dotnet add package OpenTelemetry.Instrumentation.GrpcNetClient --version 1.13.0-beta.1
NuGet\Install-Package OpenTelemetry.Instrumentation.GrpcNetClient -Version 1.13.0-beta.1
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.13.0-beta.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.13.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" />
paket add OpenTelemetry.Instrumentation.GrpcNetClient --version 1.13.0-beta.1
#r "nuget: OpenTelemetry.Instrumentation.GrpcNetClient, 1.13.0-beta.1"
#:package OpenTelemetry.Instrumentation.GrpcNetClient@1.13.0-beta.1
#addin nuget:?package=OpenTelemetry.Instrumentation.GrpcNetClient&version=1.13.0-beta.1&prerelease
#tool nuget:?package=OpenTelemetry.Instrumentation.GrpcNetClient&version=1.13.0-beta.1&prerelease
Grpc.Net.Client Instrumentation for OpenTelemetry
| Status | |
|---|---|
| Stability | Beta |
| Code Owners | @open-telemetry/dotnet-contrib-maintainers |
This is an Instrumentation Library which instruments Grpc.Net.Client and collects traces about outgoing gRPC requests.
This component is based on the OpenTelemetry semantic conventions for traces. These conventions are in Development, and hence, this package is a pre-release. Until a stable version is released, there can be breaking changes.
Supported .NET Versions
This package targets
NETSTANDARD2.1
and hence can be used in any .NET versions implementing NETSTANDARD2.1.
Steps to enable OpenTelemetry.Instrumentation.GrpcNetClient
Step 1: Install Package
Add a reference to the
OpenTelemetry.Instrumentation.GrpcNetClient
package. Also, add any other instrumentations & exporters you will need.
dotnet add package --prerelease OpenTelemetry.Instrumentation.GrpcNetClient
Step 2: Enable Grpc.Net.Client Instrumentation at application startup
Grpc.Net.Client instrumentation must be enabled at application startup.
The following example demonstrates adding Grpc.Net.Client instrumentation to a
console application. This example also sets up the OpenTelemetry Console
exporter and adds instrumentation for HttpClient, which requires adding the
packages
OpenTelemetry.Exporter.Console
and
OpenTelemetry.Instrumentation.Http
to the application. As Grpc.Net.Client uses HttpClient underneath, it is
recommended to enable HttpClient instrumentation as well to ensure proper
context propagation. This would cause an activity being produced for both a gRPC
call and its underlying HTTP call. This behavior can be
configured.
using OpenTelemetry.Trace;
public class Program
{
public static void Main(string[] args)
{
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation()
.AddConsoleExporter()
.Build();
}
}
For an ASP.NET Core application, adding instrumentation is typically done in
the ConfigureServices of your Startup class. Refer to documentation for
OpenTelemetry.Instrumentation.AspNetCore.
Advanced configuration
This instrumentation can be configured to change the default behavior by using
GrpcClientInstrumentationOptions.
SuppressDownstreamInstrumentation
SuppressDownstreamInstrumentation no longer works when used in conjunction
with the OpenTelemetry.Instrumentation.Http package version 1.6.0 and greater.
This option may change or even be removed in a future release.
This option prevents downstream instrumentation from being invoked.
Grpc.Net.Client is built on top of HttpClient. When instrumentation for both
libraries is enabled, SuppressDownstreamInstrumentation prevents the
HttpClient instrumentation from generating an additional activity. Additionally,
since HttpClient instrumentation is normally responsible for propagating context
(ActivityContext and Baggage), Grpc.Net.Client instrumentation propagates
context when SuppressDownstreamInstrumentation is enabled.
The following example shows how to use SuppressDownstreamInstrumentation.
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.AddGrpcClientInstrumentation(
opt => opt.SuppressDownstreamInstrumentation = true)
.AddHttpClientInstrumentation()
.Build();
Enrich
This instrumentation library provides EnrichWithHttpRequestMessage and
EnrichWithHttpResponseMessage options that can be used to enrich the activity
with additional information from the raw HttpRequestMessage and
HttpResponseMessage objects respectively. These actions are called only when
activity.IsAllDataRequested is true. It contains the activity itself (which
can be enriched), the name of the event, and the actual raw object. The
following code snippet shows how to add additional tags using these options.
services.AddOpenTelemetry()
.WithTracing(builder => builder
.AddGrpcClientInstrumentation(options =>
{
options.EnrichWithHttpRequestMessage = (activity, httpRequestMessage) =>
{
activity.SetTag("requestVersion", httpRequestMessage.Version);
};
options.EnrichWithHttpResponseMessage = (activity, httpResponseMessage) =>
{
activity.SetTag("responseVersion", httpResponseMessage.Version);
};
});
Processor,
is the general extensibility point to add additional properties to any activity.
The Enrich option is specific to this instrumentation, and is provided to
get access to HttpRequest and HttpResponse.
References
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- OpenTelemetry (>= 1.13.1 && < 2.0.0)
-
.NETStandard 2.1
- OpenTelemetry (>= 1.13.1 && < 2.0.0)
-
net8.0
- OpenTelemetry (>= 1.13.1 && < 2.0.0)
NuGet packages (50)
Showing the top 5 NuGet packages that depend on OpenTelemetry.Instrumentation.GrpcNetClient:
| Package | Downloads |
|---|---|
|
OpenTelemetry.AutoInstrumentation.Runtime.Managed
Managed components used by the OpenTelemetry.AutoInstrumentation project. |
|
|
Grafana.OpenTelemetry.Base
Minimal Grafana distribution of OpenTelemetry .NET |
|
|
MyJetWallet.Sdk.Service
Package Description |
|
|
Sitko.Core.Grpc.Client
Sitko.Core is a set of libraries to help build .NET Core applications fast |
|
|
Honeycomb.OpenTelemetry.CommonInstrumentations
Honeycomb's OpenTelemetry common instrumentations package. Adds support for many common instrumentation libraries for you. |
GitHub repositories (25)
Showing the top 20 popular GitHub repositories that depend on OpenTelemetry.Instrumentation.GrpcNetClient:
| Repository | Stars |
|---|---|
|
dotnet/eShop
A reference .NET application implementing an eCommerce site
|
|
|
dotnet/aspire
Aspire is the tool for code-first, extensible, observable dev and deploy.
|
|
|
grpc/grpc-dotnet
gRPC for .NET
|
|
|
open-telemetry/opentelemetry-dotnet
The OpenTelemetry .NET Client
|
|
|
webprofusion/certify
Professional ACME Client for Windows. Certificate Management UI, powered by Let's Encrypt and compatible with all ACME v2 CAs. Used by over 150,000 organisations. Remember to Star us! Download from certifytheweb.com
|
|
|
GZTimeWalker/GZCTF
The GZ::CTF project, an open source CTF platform.
|
|
|
thangchung/clean-architecture-dotnet
🕸 Yet Another .NET Clean Architecture, but for Microservices project. It uses Minimal Clean Architecture with DDD-lite, CQRS-lite, and just enough Cloud-native patterns apply on the simple eCommerce sample and run on Tye with Dapr extension 🍻
|
|
|
meysamhadeli/booking-microservices
A practical microservices with the latest technologies and architectures like Vertical Slice Architecture, Event Sourcing, CQRS, DDD, gRpc, MongoDB, RabbitMq, Masstransit, and Aspire in .Net 9.
|
|
|
dotnet/aspire-samples
|
|
|
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
|
|
|
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.
|
|
|
mixcore/mix.core
🚀 A future-proof enterprise web CMS supporting both headless and decoupled approaches. Build any type of app with customizable APIs on ASP.NET Core/.NET Core. Completely open-source and designed for flexibility.
|
|
|
Eventuous/eventuous
Event Sourcing library for .NET
|
|
|
ChromaControl/ChromaControl
3rd party device lighting support for Razer Synapse.
|
|
|
foxminchan/BookWorm
The practical implementation of .NET Aspire using Microservices, AI-Agents
|
|
|
meysamhadeli/booking-modular-monolith
A practical Modular Monolith architecture with the latest technologies and architecture like Vertical Slice Architecture, Event Driven Architecture, CQRS, DDD, gRpc, Masstransit, and Aspire in .Net 9.
|
|
|
Azure-Samples/eShopOnAzure
A variant of https://github.com/dotnet/eShop that uses Azure services
|
|
|
mehdihadeli/vertical-slice-api-template
🍰 An asp.net core template based on .Net 9, Vertical Slice Architecture, CQRS, Minimal APIs, OpenTelemetry, API Versioning and OpenAPI.
|
|
|
alex289/CleanArchitecture
Sample .NET 9 API project including Clean Architecture principles, Onion Architecture, MediatR, and Entity Framework with unit and integration tests using xUnit
|
|
|
newbe36524/Newbe.Claptrap
This is a frameworks with reactive, event sourcing and Actor pattern as basic theories. On top of this, developers can create "distributed", "scale out", and "easy to test" application more simply. Claptrap and it`s Minions is on the way.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.13.0-beta.1 | 3,990 | 10/22/2025 |
| 1.12.0-beta.1 | 1,886,813 | 5/5/2025 |
| 1.11.0-beta.2 | 1,356,655 | 3/5/2025 |
| 1.11.0-beta.1 | 485,322 | 1/27/2025 |
| 1.10.0-beta.1 | 286,096 | 12/9/2024 |
| 1.9.0-beta.1 | 8,105,834 | 6/17/2024 |
| 1.8.0-beta.1 | 3,327,901 | 4/4/2024 |
| 1.7.0-beta.1 | 908,654 | 2/10/2024 |
| 1.6.0-beta.3 | 2,824,070 | 11/17/2023 |
| 1.6.0-beta.2 | 626,754 | 10/27/2023 |
| 1.5.1-beta.1 | 1,857,790 | 7/21/2023 |
| 1.5.0-beta.1 | 673,436 | 6/6/2023 |
| 1.0.0-rc9.14 | 4,364,111 | 2/24/2023 |
| 1.0.0-rc9.13 | 208,139 | 2/11/2023 |
| 1.0.0-rc9.12 | 151,060 | 2/2/2023 |
| 1.0.0-rc9.11 | 219,632 | 1/9/2023 |
| 1.0.0-rc9.10 | 119,172 | 12/12/2022 |
| 1.0.0-rc9.9 | 506,605 | 11/7/2022 |
| 1.0.0-rc9.8 | 109,854 | 10/17/2022 |
| 1.0.0-rc9.7 | 93,962 | 9/30/2022 |
| 1.0.0-rc9.6 | 106,244 | 8/18/2022 |
| 1.0.0-rc9.5 | 90,355 | 8/3/2022 |
| 1.0.0-rc9.4 | 1,671,345 | 6/3/2022 |
| 1.0.0-rc9.3 | 473,144 | 4/20/2022 |
| 1.0.0-rc9.2 | 68,199 | 4/13/2022 |
| 1.0.0-rc9.1 | 183,768 | 3/30/2022 |
| 1.0.0-rc9 | 403,952 | 2/3/2022 |
| 1.0.0-rc8 | 1,646,085 | 10/8/2021 |
| 1.0.0-rc7 | 344,419 | 7/13/2021 |
| 1.0.0-rc6 | 61,435 | 6/26/2021 |
| 1.0.0-rc5 | 103,667 | 6/9/2021 |
| 1.0.0-rc4 | 71,126 | 4/23/2021 |
| 1.0.0-rc3 | 73,455 | 3/19/2021 |
| 1.0.0-rc2 | 93,295 | 1/30/2021 |
| 1.0.0-rc1.1 | 61,376 | 11/18/2020 |
| 0.8.0-beta.1 | 1,818 | 11/5/2020 |
| 0.7.0-beta.1 | 1,551 | 10/16/2020 |
| 0.6.0-beta.1 | 6,579 | 9/16/2020 |
| 0.5.0-beta.2 | 1,439 | 8/28/2020 |