Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/instrumentation-grpc

Package Overview
Dependencies
Maintainers
3
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-grpc

OpenTelemetry instrumentation for `@grpc/grpc-js` rpc client and server for gRPC framework

  • 0.56.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7M
increased by7.49%
Maintainers
3
Weekly downloads
 
Created

What is @opentelemetry/instrumentation-grpc?

@opentelemetry/instrumentation-grpc is an npm package that provides automatic instrumentation for gRPC services and clients using OpenTelemetry. This allows you to collect and export telemetry data such as traces and metrics from your gRPC-based applications, which can be used for monitoring and observability purposes.

What are @opentelemetry/instrumentation-grpc's main functionalities?

Automatic gRPC Server Instrumentation

This code sets up automatic instrumentation for a gRPC server. It initializes the OpenTelemetry tracer provider, adds a span processor to export spans to the console, and registers the gRPC instrumentation.

const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');
const { GrpcInstrumentation } = require('@opentelemetry/instrumentation-grpc');

const provider = new NodeTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.register();

const grpcInstrumentation = new GrpcInstrumentation();
grpcInstrumentation.setTracerProvider(provider);

Automatic gRPC Client Instrumentation

This code sets up automatic instrumentation for a gRPC client. Similar to the server instrumentation, it initializes the OpenTelemetry tracer provider, adds a span processor to export spans to the console, and registers the gRPC instrumentation.

const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');
const { GrpcInstrumentation } = require('@opentelemetry/instrumentation-grpc');

const provider = new NodeTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.register();

const grpcInstrumentation = new GrpcInstrumentation();
grpcInstrumentation.setTracerProvider(provider);

Other packages similar to @opentelemetry/instrumentation-grpc

Keywords

FAQs

Package last updated on 04 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc