
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
otel-agent-nodejs
Advanced tools
This package provides a reusable OpenTelemetry agent for Node.js applications. It simplifies the process of setting up distributed tracing and metrics collection by allowing developers to quickly integrate OpenTelemetry into their projects with minimal co
otel-agent-nodejs
is a reusable OpenTelemetry agent for Node.js applications, designed to simplify the setup of distributed tracing and metrics collection. This package allows developers to quickly integrate OpenTelemetry into their projects with minimal configuration.
Dockerfile
, configure NODE_OPTIONS
, and set environment variables.You can install the otel-agent-nodejs
package via NPM:
npm install otel-agent-nodejs
To use the OpenTelemetry agent in your Node.js application, follow these steps:
Add the following lines to your Dockerfile
to install and configure the OpenTelemetry agent:
FROM node:20
WORKDIR /app
COPY package*.json ./
RUN npm install
# Install the OpenTelemetry agent
RUN npm install otel-agent-nodejs
COPY . .
# Set NODE_OPTIONS to preload the agent before the application starts
ENV NODE_OPTIONS="--require otel-agent-nodejs"
EXPOSE 3000
CMD ["node", "index.js"]
In your docker-compose.yml
or directly in the environment where your application runs, configure the necessary environment variables:
services:
app:
build: .
ports:
- "3000:3000"
environment:
- OTEL_SERVICE_NAME=nodejs-otel-agent
- OTEL_TRACES_EXPORTER=otlp
- OTEL_METRICS_EXPORTER=otlp
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4318/v1/traces
- OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://otel-collector:4318/v1/metrics
Build and run your Docker container as usual. The OpenTelemetry agent will automatically start and instrument your application:
docker-compose up --build
You can customize the behavior of the OpenTelemetry agent by setting additional environment variables:
otlp
(OpenTelemetry Protocol).otlp
.For a complete example project that uses otel-agent-nodejs
, refer to the example repository on GitHub.
Contributions are welcome! Please open an issue or submit a pull request if you have any improvements or new features you'd like to see.
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
This package provides a reusable OpenTelemetry agent for Node.js applications. It simplifies the process of setting up distributed tracing and metrics collection by allowing developers to quickly integrate OpenTelemetry into their projects with minimal co
The npm package otel-agent-nodejs receives a total of 755 weekly downloads. As such, otel-agent-nodejs popularity was classified as not popular.
We found that otel-agent-nodejs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.