Socket
Socket
Sign inDemoInstall

@opentelemetry/resources

Package Overview
Dependencies
3
Maintainers
3
Versions
164
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @opentelemetry/resources

OpenTelemetry SDK resources


Version published
Weekly downloads
6.3M
decreased by-1.46%
Maintainers
3
Install size
2.92 MB
Created
Weekly downloads
 

Package description

What is @opentelemetry/resources?

The @opentelemetry/resources package is part of the OpenTelemetry project, which provides a set of APIs, libraries, agents, and instrumentation to create and manage telemetry data (metrics, logs, and traces) for cloud-native software. This package specifically offers a way to describe the entity producing telemetry, such as service, environment, and versioning information. It allows users to define and attach these details to their telemetry data.

What are @opentelemetry/resources's main functionalities?

Creating a Resource

This feature allows the creation of a Resource object that describes the service generating telemetry data. It includes attributes like service name, version, and deployment environment.

{"const { Resource } = require('@opentelemetry/resources');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');

const resource = new Resource({
  [SemanticResourceAttributes.SERVICE_NAME]: 'my-service',
  [SemanticResourceAttributes.SERVICE_VERSION]: '1.0.0',
  [SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: 'production'
});
"}

Merging Resources

This feature demonstrates how to merge two Resource objects into one, combining their attributes. This is useful when you have resource information coming from different sources and want to create a unified view.

{"const { Resource } = require('@opentelemetry/resources');

const resource1 = new Resource({
  'service.name': 'my-service'
});
const resource2 = new Resource({
  'service.version': '1.0.0'
});

const mergedResource = resource1.merge(resource2);
"}

Other packages similar to @opentelemetry/resources

Changelog

Source

1.24.0

:rocket: (Enhancement)

  • feat(sdk-trace-base): log resource attributes in ConsoleSpanExporter #4605 @pichlermarc
  • feat(propagator-aws-xray): moved AWS Xray propagator from contrib 4603 @martinkuba
  • feat(resources): new experimental detector ServiceInstanceIdDetectorSync that sets the value for service.instance.id as random UUID. #4608 @maryliag

:bug: (Bug Fix)

  • fix(sdk-trace-web): fix invalid timings in span events #4486 @Abinet18
  • fix(resources): ensure BrowserDetector does not think Node.js v21 is a browser #4561 @trentm

Readme

Source

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 { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
import { Resource } from '@opentelemetry/resources';

const resource = new Resource({
    [SEMRESATTRS_SERVICE_NAME]: 'api-service',
});

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

License

Apache 2.0 - See LICENSE for more information.

Keywords

FAQs

Last updated on 24 Apr 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc