在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:open-telemetry/opentelemetry-js开源软件地址:https://github.com/open-telemetry/opentelemetry-js开源编程语言:TypeScript 96.8%开源软件介绍:Getting Started • API Reference • SDK Reference Contributing • Development Guide • Examples About this projectThis is the JavaScript version of OpenTelemetry, a framework for collecting traces and metrics from applications. Compatibility Matrix
VersioningThe current version for each package can be found in the respective Quick startApplication OwnerInstall Dependenciesnpm install --save @opentelemetry/api
npm install --save @opentelemetry/sdk-node
npm install --save @opentelemetry/auto-instrumentations-node Note: Instantiate Tracing// tracing.js
'use strict'
const process = require('process');
const opentelemetry = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');
const { Resource } = require('@opentelemetry/resources');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
// configure the SDK to export telemetry data to the console
// enable all auto-instrumentations from the meta package
const traceExporter = new ConsoleSpanExporter();
const sdk = new opentelemetry.NodeSDK({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: 'my-service',
}),
traceExporter,
instrumentations: [getNodeAutoInstrumentations()]
});
// initialize the SDK and register with the OpenTelemetry API
// this enables the API to record telemetry
sdk.start()
.then(() => console.log('Tracing initialized'))
.catch((error) => console.log('Error initializing tracing', error));
// gracefully shut down the SDK on process exit
process.on('SIGTERM', () => {
sdk.shutdown()
.then(() => console.log('Tracing terminated'))
.catch((error) => console.log('Error terminating tracing', error))
.finally(() => process.exit(0));
}); Run Your Applicationnode -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 Library AuthorIf 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. Supported Runtimes
Node SupportOnly 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.
Please note that versions of Node.JS v8 prior to Browser SupportAutomated browser tests are run in the latest version of Headless Chrome. There is currently no list of officially supported browsers, but OpenTelemetry is developed using standard web technologies with wide support and should work in currently supported versions of major browsers. Feature Status
For a more detailed breakdown of feature support see the specification compliance matrix. ContributingWe'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. Approvers (@open-telemetry/js-approvers):
Find more about the approver role in community repository. Maintainers (@open-telemetry/js-maintainers):
Find more about the maintainer role in community repository. Thanks to all the people who already contributedThanks to all previous approvers and maintainers
PackagesAPI
Implementation / SDKs
Compatible ExportersOpenTelemetry 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. InstrumentationsOpenTelemetry 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: Node InstrumentationsCoreContribThese instrumentations are hosted at https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node Web InstrumentationsCoreContribThese instrumentations are hosted at https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/web Shims
Upgrade guidelines0.28.x to 0.29.x
0.27.x to 0.28.x
0.26.x to 0.27.xMetric and trace exporters are split into separate packages:
Metric types are renamed:
0.25.x to 1.x.yCollector exporter packages and types are renamed:
|