Set up gRPC instrumentation
| Package | Supported versions |
|---|---|
Grpc.Net.Client |
≥2.23.2 <3.0.0 |
gRPC server-side instrumentation is built in to ASP.NET Core (≥8.0.0 ≤10.0.x) and does not require an additional package.
For the full compatibility matrix including supported installation methods, refer to RPC frameworks.
This page assumes the core agent is already set up. If not, see Set up the APM .NET Agent first.
Server-side gRPC instrumentation is automatically included when using the ASP.NET Core setup. No additional package is required.
Add the Elastic.Apm.GrpcClient NuGet package to your project:
dotnet add package Elastic.Apm.GrpcClient
Pass GrpcClientDiagnosticListener to the AddElasticApm method in case of ASP.NET Core:
using Elastic.Apm.GrpcClient;
app.Services.AddElasticApm(new GrpcClientDiagnosticListener());
or passing GrpcClientDiagnosticSubscriber to the Subscribe method
using Elastic.Apm;
using Elastic.Apm.GrpcClient;
Agent.Subscribe(new GrpcClientDiagnosticSubscriber());
Diagnostic events from Grpc.Net.Client are captured as spans.