Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@opentelemetry/exporter-metrics-otlp-proto
Advanced tools
OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector using protobuf over HTTP
@opentelemetry/exporter-metrics-otlp-proto is an npm package that allows you to export metrics data from your application to the OpenTelemetry Collector using the OTLP (OpenTelemetry Protocol) over gRPC in a protobuf format. This package is part of the OpenTelemetry project, which provides a set of APIs, libraries, agents, and instrumentation to enable observability in your applications.
Exporting Metrics
This code sample demonstrates how to set up the OTLPMetricExporter to export metrics data to an OpenTelemetry Collector. It creates a MeterProvider with the exporter and an interval for exporting metrics. A counter metric is then created and incremented.
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto');
const exporter = new OTLPMetricExporter({
url: 'http://localhost:4317',
});
const meterProvider = new MeterProvider({
exporter,
interval: 2000,
});
const meter = meterProvider.getMeter('example-meter');
const counter = meter.createCounter('example_counter');
counter.add(10, { key: 'value' });
@opentelemetry/exporter-metrics-otlp-http is another exporter for OpenTelemetry metrics, but it uses the OTLP over HTTP instead of gRPC. This can be useful in environments where HTTP is preferred or required over gRPC.
@opentelemetry/exporter-prometheus allows you to export metrics in a format that can be scraped by Prometheus. This is useful if you are using Prometheus as your monitoring solution and want to integrate OpenTelemetry metrics with it.
@opentelemetry/exporter-collector is a more general exporter that can send both traces and metrics to the OpenTelemetry Collector. It supports multiple transport protocols including gRPC and HTTP, making it a versatile choice for exporting telemetry data.
This module provides exporter for node to be used with opentelemetry-collector - last tested with version 0.25.0.
npm install --save @opentelemetry/exporter-metrics-otlp-proto
The OpenTelemetry Collector Exporter does not have a service name configuration.
In order to set the service name, use the service.name
resource attribute as prescribed in the OpenTelemetry Resource Semantic Conventions.
To see sample code and documentation for the traces exporter, visit the Collector Trace Exporter for web and node.
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto');
const collectorOptions = {
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics
};
const exporter = new OTLPMetricExporter(collectorOptions);
// Register the exporter
const meter = new MeterProvider({
exporter,
interval: 60000,
}).getMeter('example-meter');
// Now, start recording data
const counter = meter.createCounter('metric_name');
counter.add(10, { 'key': 'value' });
npm run docker:start
http://localhost:9411/zipkin/
to observe the metricsApache 2.0 - See LICENSE for more information.
1.0.1 / Experimental 0.27.0
opentelemetry-core
opentelemetry-core
opentelemetry-semantic-conventions
opentelemetry-core
, opentelemetry-sdk-trace-base
opentelemetry-core
opentelemetry-exporter-zipkin
opentelemetry-core
opentelemetry-sdk-trace-base
, opentelemetry-sdk-trace-node
, opentelemetry-sdk-trace-web
opentelemetry-context-async-hooks
, opentelemetry-context-zone-peer-dep
, opentelemetry-core
, opentelemetry-exporter-jaeger
, opentelemetry-exporter-zipkin
, opentelemetry-propagator-b3
, opentelemetry-propagator-jaeger
, opentelemetry-resources
, opentelemetry-sdk-trace-base
, opentelemetry-sdk-trace-node
, opentelemetry-sdk-trace-web
, opentelemetry-shim-opentracing
opentelemetry-core
FAQs
OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector using protobuf over HTTP
The npm package @opentelemetry/exporter-metrics-otlp-proto receives a total of 365,720 weekly downloads. As such, @opentelemetry/exporter-metrics-otlp-proto popularity was classified as popular.
We found that @opentelemetry/exporter-metrics-otlp-proto demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.