@opentelemetry/resources

License
Apache-2.0
Install Size
439 kB(12.8 MB)
Vulns
0
Published

Get started

$npm install @opentelemetry/resources
$pnpm add @opentelemetry/resources
$yarn add @opentelemetry/resources
$bun add @opentelemetry/resources
$deno add npm:@opentelemetry/resources
$vlt install @opentelemetry/resources
$vp add @opentelemetry/resources

Readme

OpenTelemetry Resources Util

NPM Published Version Apache License

The OpenTelemetry Resource is an immutable representation of the entity producing telemetry. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace and possibly is part of a Deployment which also has a name. All three of these attributes can be included in the Resource.

This document defines standard attributes for resources which are accessible via @opentelemetry/semantic-conventions.

Installation

npm install --save @opentelemetry/resources

Usage

import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
import { resourceFromAttributes } from '@opentelemetry/resources';

const resource = resourceFromAttributes({
    [ATTR_SERVICE_NAME]: 'api-service',
});

const anotherResource = resourceFromAttributes({
    'service.version': '2.0.0',
    'service.group': 'instrumentation-group'
});
const mergedResource = resource.merge(anotherResource);

License

Apache 2.0 - See LICENSE for more information.