Skip to content

Files

opentelemetry-resources

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 14, 2025
Mar 19, 2025
May 21, 2020
Jul 6, 2023
Mar 2, 2020
Apr 16, 2024
Apr 10, 2025
Jan 29, 2022
Jun 1, 2022
Mar 17, 2025
Aug 20, 2024
Aug 20, 2024
Aug 20, 2024

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);

Useful links

License

Apache 2.0 - See LICENSE for more information.