Gathering detailed insights and metrics for @opentelemetry/instrumentation
Gathering detailed insights and metrics for @opentelemetry/instrumentation
Gathering detailed insights and metrics for @opentelemetry/instrumentation
Gathering detailed insights and metrics for @opentelemetry/instrumentation
@opentelemetry/instrumentation-winston
OpenTelemetry instrumentation for `winston` logger
@opentelemetry/instrumentation-bunyan
OpenTelemetry instrumentation for `bunyan` logger
@opentelemetry/instrumentation-connect
OpenTelemetry instrumentation for `connect` http middleware framework
@opentelemetry/instrumentation-pino
OpenTelemetry instrumentation for `pino` logger
OpenTelemetry JavaScript Client
npm install @opentelemetry/instrumentation
87.7
Supply Chain
99.2
Quality
93.5
Maintenance
100
Vulnerability
98.9
License
semconv/v1.28.0
Published on 20 Nov 2024
experimental/v0.55.0
Published on 18 Nov 2024
v1.28.0
Published on 18 Nov 2024
experimental/v0.54.2
Published on 07 Nov 2024
experimental/v0.54.1
Published on 05 Nov 2024
experimental/v0.54.0
Published on 23 Oct 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2,766 Stars
2,357 Commits
811 Forks
53 Watching
23 Branches
486 Contributors
Updated on 28 Nov 2024
Minified
Minified + Gzipped
TypeScript (96.7%)
JavaScript (3.1%)
Jinja (0.1%)
Shell (0.08%)
HTML (0.02%)
Cumulative downloads
Total Downloads
Last day
-3.2%
2,870,339
Compared to previous day
Last week
6.5%
16,080,266
Compared to previous week
Last month
35%
60,831,158
Compared to previous month
Last year
180.8%
413,377,218
Compared to previous year
6
1
28
Getting Started   •  API and SDK Reference
Contributing   •  Examples
This is the JavaScript version of OpenTelemetry, a framework for collecting traces, metrics, and logs from applications.
Much of OpenTelemetry JS documentation is written assuming the compiled application is run as CommonJS. For more details on ECMAScript Modules vs CommonJS, refer to esm-support.
The following describes how to set up tracing for a basic web application. For more detailed documentation, see the website at https://opentelemetry.io/docs/instrumentation/js/.
Dependencies with the latest
tag on NPM should be compatible with each other.
See the version compatibility matrix below for more information.
1npm install --save @opentelemetry/api 2npm install --save @opentelemetry/sdk-node 3npm install --save @opentelemetry/auto-instrumentations-node
Note: auto-instrumentations-node
is a meta package from opentelemetry-js-contrib that provides a simple way to initialize multiple Node.js instrumentations.
1// tracing.js 2 3'use strict' 4 5const process = require('process'); 6const opentelemetry = require('@opentelemetry/sdk-node'); 7const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node'); 8const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base'); 9const { Resource } = require('@opentelemetry/resources'); 10const { SEMRESATTRS_SERVICE_NAME } = require('@opentelemetry/semantic-conventions'); 11 12// configure the SDK to export telemetry data to the console 13// enable all auto-instrumentations from the meta package 14const traceExporter = new ConsoleSpanExporter(); 15const sdk = new opentelemetry.NodeSDK({ 16 resource: new Resource({ 17 [SEMRESATTRS_SERVICE_NAME]: 'my-service', 18 }), 19 traceExporter, 20 instrumentations: [getNodeAutoInstrumentations()] 21}); 22 23// initialize the SDK and register with the OpenTelemetry API 24// this enables the API to record telemetry 25sdk.start(); 26 27// gracefully shut down the SDK on process exit 28process.on('SIGTERM', () => { 29 sdk.shutdown() 30 .then(() => console.log('Tracing terminated')) 31 .catch((error) => console.log('Error terminating tracing', error)) 32 .finally(() => process.exit(0)); 33});
1node -r ./tracing.js app.js
The above example will emit auto-instrumented telemetry about your Node.js application to the console. For a more in-depth example, see the Getting Started Guide. For more information about automatic instrumentation see @opentelemetry/sdk-trace-node, which provides auto-instrumentation for Node.js applications. If the automatic instrumentation does not suit your needs, or you would like to create manual traces, see @opentelemetry/sdk-trace-base
If you are a library author looking to build OpenTelemetry into your library, please see the documentation. As a library author, it is important that you only depend on properties and methods published on the public API. If you use any properties or methods from the SDK that are not officially a part of the public API, your library may break if an application owner uses a different SDK implementation.
Platform Version | Supported |
---|---|
Node.JS v22 | :heavy_check_mark: |
Node.JS v20 | :heavy_check_mark: |
Node.JS v18 | :heavy_check_mark: |
Node.JS v16 | :heavy_check_mark: |
Node.JS v14 | :heavy_check_mark: |
Older Node Versions | See Node Support |
Web Browsers | See Browser Support below |
Only Node.js Active or Maintenance LTS versions are supported.
Previous versions of node may work, but they are not tested by OpenTelemetry and they are not guaranteed to work.
Note that versions of Node.JS v8 prior to v8.12.0
will NOT work, because OpenTelemetry Node depends on the
perf_hooks
module introduced in v8.5.0
and performance.timeOrigin
that is set correctly starting in v8.12.0
.
[!IMPORTANT] Client instrumentation for the browser is experimental and mostly unspecified. If you are interested in helping out, get in touch with the Client Instrumentation SIG.
There is currently no list of officially supported browsers. OpenTelemetry is developed using standard web technologies and aims to work in currently supported versions of major browsers.
OpenTelemetry is released as a set of distinct packages in 3 categories: API, stable SDK, and experimental. The API is located at /api, the stable SDK packages are in the /packages directory, and the experimental packages are listed in the /experimental/packages directory. There may also be API packages for experimental signals in the experimental directory. All stable packages are released with the same version, and all experimental packages are released with the same version. The below table describes which versions of each set of packages are expected to work together.
Stable Packages | Experimental Packages |
---|---|
1.21.x | 0.48.x |
1.20.x | 0.47.x |
1.19.x | 0.46.x |
1.18.x | 0.45.x |
1.17.x | 0.44.x |
Stable Packages | Experimental Packages |
---|---|
1.16.x | 0.42.x |
1.15.x | 0.41.x |
1.14.x | 0.40.x |
1.13.x | 0.39.x |
1.12.x | 0.38.x |
1.11.x | 0.37.x |
1.10.x | 0.36.x |
1.9.x | 0.35.x |
1.8.x (this and later versions require API >=1.3.0 for metrics) | 0.34.x |
1.7.x | 0.33.x |
1.6.x | 0.32.x |
1.5.x | 0.31.x |
1.4.x | 0.30.x |
1.3.x | 0.29.x |
1.2.x | 0.29.x |
1.1.x | 0.28.x |
1.0.x | 0.27.x |
1.0.x (this and later versions require API >=1.0.0 for traces) | 0.26.x |
The current version for each package can be found in the respective package.json
file for that module. For additional details see the versioning and stability document in the specification.
Signal | API Status | SDK Status |
---|---|---|
Tracing | Stable | Stable |
Metrics | Stable | Stable |
Logs | Development | Development |
For a more detailed breakdown of feature support see the specification compliance matrix.
We'd love your help!. Use tags up-for-grabs and good first issue to get started with the project. For instructions to build and make changes to this project, see the CONTRIBUTING guide.
We have a weekly SIG meeting! See the community page for meeting details and notes.
Find more about the maintainer role in the community repository.
Find more about the approver role in the community repository.
Find more about the triager role in the community repository.
Find more about the emeritus role in community repository.
Package | Description |
---|---|
@opentelemetry/api | This package provides TypeScript interfaces, enums and no-op implementations for the OpenTelemetry core trace and metrics model. It is intended for use both on the server and in the browser. |
@opentelemetry/core | This package provides default and no-op implementations of the OpenTelemetry api for trace and metrics. It's intended for use both on the server and in the browser. |
Package | Description |
---|---|
@opentelemetry/sdk-trace-base | This module provides a full control over instrumentation and span creation. It doesn't load async_hooks or any instrumentation by default. It is intended for use both on the server and in the browser. |
@opentelemetry/sdk-metrics | This module provides instruments and meters for reporting of time series data. |
@opentelemetry/sdk-trace-node | This module provides automatic tracing for Node.js applications. It is intended for use on the server only. |
@opentelemetry/sdk-trace-web | This module provides automated instrumentation and tracing for Web applications. It is intended for use in the browser only. |
OpenTelemetry is vendor-agnostic and can upload data to any backend with various exporter implementations. Even though, OpenTelemetry provides support for many backends, vendors/users can also implement their own exporters for proprietary and unofficially supported backends.
See the OpenTelemetry registry for a list of exporters available.
OpenTelemetry can collect tracing data automatically using instrumentations.
To request automatic tracing support for a module not on this list, please file an issue. Alternatively, Vendor/Users can write an instrumentation yourself.
Currently, OpenTelemetry supports automatic tracing for:
These instrumentations are hosted at https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node
These instrumentations are hosted at https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/web
Package | Description |
---|---|
@opentelemetry/shim-opentracing | OpenTracing shim allows existing OpenTracing instrumentation to report to OpenTelemetry |
Apache 2.0 - See LICENSE for more information.
The latest stable version of the package.
Stable Version
1
8.1/10
Summary
Unsanitized user controlled input in module generation
Affected Versions
>= 0.40.0, < 0.41.2
Patched Versions
0.41.2
Reason
all changesets reviewed
Reason
30 commit(s) and 19 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
SAST tool is run on all commits
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Project has not signed or included provenance with any releases.
Details
Reason
project is not fuzzed
Details
Reason
20 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More