farol_grpc 0.1.2 copy "farol_grpc: ^0.1.2" to clipboard
farol_grpc: ^0.1.2 copied to clipboard

gRPC (package:grpc) instrumentation for the Faro RUM client — RPC measurements, errors, and W3C traceparent.

example/main.dart

// Minimal usage example for `farol_grpc`. See ../README.md for the
// host-scoping limitation and the injectTraceparent recommendation.
import 'package:farol/farol.dart';
import 'package:farol_grpc/farol_grpc.dart';
import 'package:grpc/grpc.dart';

Future<void> main() async {
  Faro.initialize(
    FaroConfig(
      collectorUrl: Uri.parse('https://faro-collector.example.com/collect'),
      app: const FaroApp(name: 'example-app'),
    ),
  );

  final channel = ClientChannel(
    'api.example.com',
    port: 443,
    options: const ChannelOptions(credentials: ChannelCredentials.secure()),
  );

  // Attach the interceptor only to channels you want instrumented — that is
  // the reliable way to scope by host (see README "Scoping instrumentation
  // by host").
  final interceptors = [FaroGrpcInterceptor(injectTraceparent: false)];
  // Pass `interceptors:` to your generated client's constructor, e.g.:
  //   final stub = MyServiceClient(channel, interceptors: interceptors);
  assert(interceptors.length == 1);
  await channel.shutdown();
}
1
likes
160
points
255
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

gRPC (package:grpc) instrumentation for the Faro RUM client — RPC measurements, errors, and W3C traceparent.

Repository (GitHub)
View/report issues

Topics

#observability #rum #faro #grpc

License

Apache-2.0 (license)

Dependencies

farol, grpc, meta

More

Packages that depend on farol_grpc