Package Exports
- @azure/monitor-opentelemetry
- @azure/monitor-opentelemetry/dist-esm/src/index.js
- @azure/monitor-opentelemetry/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@azure/monitor-opentelemetry) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Azure Monitor OpenTelemetry client library for JavaScript
Getting started
Install the package
npm install @azure/monitor-opentelemetry
Currently supported environments
See our support policy for more details.
Prerequisites
Enable Azure Monitor OpenTelemetry Client
Important:
AzureMonitorOpenTelemetryClientmust be setup and started before you import anything else. There may be resulting telemetry loss if other libraries are imported first.
const { AzureMonitorOpenTelemetryClient, AzureMonitorOpenTelemetryOptions } = require("@azure/monitor-opentelemetry");
const options: AzureMonitorOpenTelemetryOptions = {
azureMonitorExporterConfig: {
connectionString:
process.env["APPLICATIONINSIGHTS_CONNECTION_STRING"] || "<your connection string>",
},
}
const client = new AzureMonitorOpenTelemetryClient(options);- Connection String could be set using the environment variable APPLICATIONINSIGHTS_CONNECTION_STRING
Examples
For complete samples of a few champion scenarios, see the samples/ folder.
Key concepts
For more information on the OpenTelemetry project, please review the OpenTelemetry Specifications.
Troubleshooting
Enable debug logging
You can enable debug logging by changing the logging level of your provider.
const { DiagConsoleLogger, DiagLogLevel, diag } = require("@opentelemetry/api");
const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node");
const provider = new NodeTracerProvider();
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ALL);
provider.register();Plugin Registry
To see if a plugin has already been made for a library you are using, please check out the OpenTelemetry Registry.
If you cannot your library in the registry, feel free to suggest a new plugin request at opentelemetry-js-contrib.
Contributing
If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.
