1.0.1 • Published 7 months ago

@sesamecare-oss/opentelemetry-node-metrics v1.0.1

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
7 months ago

opentelemetry-node-metrics

A modernized set of node metrics for OpenTelemetry. Based on two excellent modules:

Usage:

yarn add @sesamecare-oss/opentelemetry-node-metrics

Wire up OTEL as normal - using node auto instrumentations or manual setup as you wish. Then, at an appropriate place, include something like the below:

import { metrics } from '@opentelemetry/api';
import { setupNodeMetrics } from '@sesamecare-oss/opentelemetry-node-metrics';

const meter = metrics.getMeterProvider().getMeter('node-metrics');
setupNodeMetrics(meter);

Now your Prometheus-exported metrics should be included along with whatever other metrics you ahve selected. See openapi-typescript-infra/service for a more complete example of metrics integrated with an express service host.

One notable change from the existing libraries - they divide active handles and active 'requests' using deprecated Node APIs. I've chosed to merge these into 'resources' using the new getActiveResourcesInfo API, which is Node17+. It should fail gracefully if that function is not available.