Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@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 which are accessible via @opentelemetry/semantic-conventions
.
npm install --save @opentelemetry/resources
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { Resource } from '@opentelemetry/resources';
const resource = new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: 'api-service',
});
const anotherResource = new Resource({
'service.version': '2.0.0',
'service.group': 'instrumentation-group'
});
const mergedResource = resource.merge(anotherResource);
Apache 2.0 - See LICENSE for more information.
FAQs
OpenTelemetry SDK resources
The npm package @opentelemetry/resources receives a total of 10,106,591 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.