![Introducing Dashboard Analytics](https://cdn.sanity.io/images/cgdhsj6q/production/af327c5bd94708db501516a75da6870aef894c64-2286x1522.png?w=400&fit=max&auto=format)
Product
Introducing Dashboard Analytics
We're introducing a new Analytics feature in the Socket dashboard so you can view changes in your organization's and repositories' alerts over time.
@opentelemetry/resources
Advanced tools
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.
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);
"}
Winston is a popular logging library for Node.js. While it does not directly offer the same functionality as @opentelemetry/resources, it allows users to add custom metadata to logs, which can include similar resource attributes. However, it is not part of the OpenTelemetry ecosystem and does not provide a standardized way to describe resources.
Bunyan is another Node.js logging library that supports the addition of arbitrary metadata to log records, which can be used to include resource information. Like winston, it is not designed to work with the OpenTelemetry ecosystem and lacks the standardization that @opentelemetry/resources provides.
Pino is a very low overhead Node.js logger. It supports the addition of custom metadata to log messages, which could include resource-like data. Pino focuses on performance and is not part of the OpenTelemetry project, so it does not offer the same standardized resource description capabilities.
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.
npm install --save @opentelemetry/resources
import { Resource, SERVICE_RESOURCE } from '@opentelemetry/resources';
const resource = new Resource({
[SERVICE_RESOURCE.NAME]: 'api-service',
});
const another_resource = new Resource({
'service.version': 2.0.0,
'service.group': 'instrumentation-group'
});
const merged_resource = resource.merge(another_resource);
Apache 2.0 - See LICENSE for more information.
0.20.0
opentelemetry-sdk-node
, opentelemetry-tracing
opentelemetry-node
, opentelemetry-propagator-jaeger
, opentelemetry-shim-opentracing
opentelemetry-core
, opentelemetry-instrumentation-grpc
, opentelemetry-shim-opentracing
, opentelemetry-tracing
opentelemetry-shim-opentracing
opentelemetry-tracing
opentelemetry-core
, opentelemetry-exporter-collector-grpc
, opentelemetry-exporter-collector-proto
, opentelemetry-exporter-collector
, opentelemetry-exporter-jaeger
, opentelemetry-exporter-zipkin
, opentelemetry-metrics
, opentelemetry-resources
, opentelemetry-sdk-node
, opentelemetry-tracing
opentelemetry-api-metrics
, opentelemetry-context-async-hooks
, opentelemetry-context-zone-peer-dep
, opentelemetry-context-zone
, opentelemetry-core
, opentelemetry-exporter-collector-grpc
, opentelemetry-exporter-collector-proto
, opentelemetry-exporter-collector
, opentelemetry-exporter-jaeger
, opentelemetry-exporter-prometheus
, opentelemetry-exporter-zipkin
, opentelemetry-instrumentation-fetch
, opentelemetry-instrumentation-grpc
, opentelemetry-instrumentation-http
, opentelemetry-instrumentation-xml-http-request
, opentelemetry-instrumentation
, opentelemetry-metrics
, opentelemetry-node
, opentelemetry-propagator-b3
, opentelemetry-propagator-jaeger
, opentelemetry-resource-detector-aws
, opentelemetry-resource-detector-gcp
, opentelemetry-resources
, opentelemetry-sdk-node
, opentelemetry-shim-opentracing
, opentelemetry-tracing
, opentelemetry-web
opentelemetry-instrumentation
opentelemetry-core
, opentelemetry-instrumentation-http
, opentelemetry-propagator-b3
, opentelemetry-propagator-jaeger
, opentelemetry-tracing
opentelemetry-core
, opentelemetry-tracing
opentelemetry-core
, opentelemetry-exporter-collector-grpc
, opentelemetry-exporter-collector-proto
, opentelemetry-exporter-collector
opentelemetry-exporter-collector
, opentelemetry-exporter-zipkin
, opentelemetry-tracing
opentelemetry-exporter-collector-grpc
opentelemetry-semantic-conventions
opentelemetry-instrumentation-xml-http-request
opentelemetry-exporter-prometheus
opentelemetry-api-metrics
, opentelemetry-exporter-collector-grpc
, opentelemetry-exporter-collector-proto
, opentelemetry-exporter-collector
, opentelemetry-metrics
opentelemetry-exporter-collector-grpc
opentelemetry-tracing
opentelemetry-instrumentation-grpc
opentelemetry-core
opentelemetry-node
opentelemetry-instrumentation-fetch
, opentelemetry-instrumentation-grpc
, opentelemetry-instrumentation-http
, opentelemetry-instrumentation-xml-http-request
, opentelemetry-instrumentation
, opentelemetry-node
, opentelemetry-sdk-node
, opentelemetry-web
opentelemetry-api-metrics
, opentelemetry-context-async-hooks
, opentelemetry-context-zone-peer-dep
, opentelemetry-context-zone
, opentelemetry-core
, opentelemetry-exporter-collector-grpc
, opentelemetry-exporter-collector-proto
, opentelemetry-exporter-collector
, opentelemetry-exporter-jaeger
, opentelemetry-exporter-prometheus
, opentelemetry-exporter-zipkin
, opentelemetry-instrumentation-fetch
, opentelemetry-instrumentation-grpc
, opentelemetry-instrumentation-http
, opentelemetry-instrumentation-xml-http-request
, opentelemetry-instrumentation
, opentelemetry-metrics
, opentelemetry-node
, opentelemetry-propagator-b3
, opentelemetry-propagator-jaeger
, opentelemetry-resource-detector-aws
, opentelemetry-resource-detector-gcp
, opentelemetry-resources
, opentelemetry-sdk-node
, opentelemetry-semantic-conventions
, opentelemetry-shim-opentracing
, opentelemetry-tracing
, opentelemetry-web
, template
opentelemetry-instrumentation-http
, opentelemetry-instrumentation
, opentelemetry-tracing
opentelemetry-node
, opentelemetry-sdk-node
, opentelemetry-web
opentelemetry-api-metrics
, opentelemetry-context-zone-peer-dep
, opentelemetry-context-zone
, opentelemetry-core
, opentelemetry-exporter-collector
, opentelemetry-exporter-zipkin
, opentelemetry-instrumentation-fetch
, opentelemetry-instrumentation-xml-http-request
, opentelemetry-instrumentation
, opentelemetry-propagator-jaeger
, opentelemetry-tracing
, opentelemetry-web
opentelemetry-sdk-node
opentelemetry-core
opentelemetry-api-metrics
, opentelemetry-context-zone-peer-dep
, opentelemetry-context-zone
, opentelemetry-core
, opentelemetry-exporter-collector
, opentelemetry-exporter-zipkin
, opentelemetry-instrumentation-fetch
, opentelemetry-instrumentation-xml-http-request
, opentelemetry-instrumentation
, opentelemetry-metrics
, opentelemetry-propagator-b3
, opentelemetry-propagator-jaeger
, opentelemetry-resources
, opentelemetry-semantic-conventions
, opentelemetry-tracing
, opentelemetry-web
, template
FAQs
OpenTelemetry SDK resources
The npm package @opentelemetry/resources receives a total of 6,009,853 weekly downloads. As such, @opentelemetry/resources popularity was classified as popular.
We found that @opentelemetry/resources 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
We're introducing a new Analytics feature in the Socket dashboard so you can view changes in your organization's and repositories' alerts over time.
Security News
A new OpenSSF report uncovers critical gaps in secure software training, with 75% of new developers unfamiliar with secure practices, highlighting urgent educational needs.
Security News
The 2023 Python Developers Survey reveals key trends in packaging, web frameworks, and developer demographics, highlighting a shift toward innovative tools as the Python community diversifies and grows among less experienced developers.