sentry_grpc 10.0.0-alpha.2
sentry_grpc: ^10.0.0-alpha.2 copied to clipboard
An integration which adds support for performance tracing and error monitoring for gRPC calls.
Sentry integration for gRPC package #
| package | build | pub | likes | popularity | pub points |
|---|---|---|---|---|---|
| sentry_grpc |
Integration for the gRPC package.
Usage
-
Sign up for a Sentry.io account and get a DSN at https://sentry.io.
-
Follow the installing instructions on pub.dev.
-
Initialize the Sentry SDK using the DSN issued by Sentry.io.
-
Call your client with the gRPC interceptor
SentryGrpcInterceptorand you should get gRPC integration out of the box.
import 'package:grpc/grpc.dart';
import 'package:sentry/sentry.dart';
import 'package:sentry_grpc/sentry_grpc.dart';
Future<void> main() async {
await Sentry.init(
(options) {
options.dsn = 'https://example@sentry.io/example';
options.tracesSampleRate = 1.0;
options.captureFailedRequests = true;
},
appRunner: runApp,
);
}
Future<void> runApp() async {
final channel = ClientChannel(
'api.example.com',
options: const ChannelOptions(credentials: ChannelCredentials.secure()),
);
final client = MyServiceClient(
channel,
interceptors: [SentryGrpcInterceptor()],
);
// Calls are now automatically instrumented with Sentry tracing
// and failed requests are captured as Sentry exceptions.
}