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

@opentelemetry/otlp-grpc-exporter-base

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/otlp-grpc-exporter-base

OpenTelemetry OTLP-gRPC Exporter base (for internal use only)

  • 0.55.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2M
decreased by-12.9%
Maintainers
3
Weekly downloads
 
Created

What is @opentelemetry/otlp-grpc-exporter-base?

@opentelemetry/otlp-grpc-exporter-base is a base package for OpenTelemetry that provides functionality to export telemetry data (traces and metrics) using the gRPC protocol. It is designed to be extended by other packages to provide specific implementations for different telemetry data types.

What are @opentelemetry/otlp-grpc-exporter-base's main functionalities?

Exporting Traces

This code demonstrates how to set up a trace exporter using the OTLP gRPC protocol. It initializes a NodeTracerProvider, sets up an OTLPTraceExporter with a specified URL, and registers a SimpleSpanProcessor to handle the spans.

const { OTLPTraceExporter } = require('@opentelemetry/otlp-grpc-exporter-base');
const { NodeTracerProvider } = require('@opentelemetry/node');
const { SimpleSpanProcessor } = require('@opentelemetry/tracing');

const provider = new NodeTracerProvider();
const exporter = new OTLPTraceExporter({
  url: 'http://localhost:4317',
});
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.register();

const tracer = provider.getTracer('example-tracer');
const span = tracer.startSpan('example-span');
span.end();

Exporting Metrics

This code demonstrates how to set up a metric exporter using the OTLP gRPC protocol. It initializes a MeterProvider, sets up an OTLPMetricExporter with a specified URL, and creates a counter metric to be exported.

const { OTLPMetricExporter } = require('@opentelemetry/otlp-grpc-exporter-base');
const { MeterProvider } = require('@opentelemetry/metrics');

const meterProvider = new MeterProvider();
const exporter = new OTLPMetricExporter({
  url: 'http://localhost:4317',
});
meterProvider.addMetricReader(exporter);

const meter = meterProvider.getMeter('example-meter');
const counter = meter.createCounter('example_counter');
counter.add(10, { key: 'value' });

Other packages similar to @opentelemetry/otlp-grpc-exporter-base

Keywords

FAQs

Package last updated on 18 Nov 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