# @azure/opentelemetry-instrumentation-azure-sdk

> Instrumentation client for the Azure SDK.

Latest version **1.0.0** (published 2026-05-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @azure/opentelemetry-instrumentation-azure-sdk
pnpm add @azure/opentelemetry-instrumentation-azure-sdk
yarn add @azure/opentelemetry-instrumentation-azure-sdk
bun add @azure/opentelemetry-instrumentation-azure-sdk
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2026-05-05 |
| First published | 2022-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.0.0 |
| Dependencies | 7 |
| Unpacked size | 157.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2295 |
| Author | Microsoft Corporation |
| Maintainers | azure-sdk, microsoft1es, microsoft-oss-releases |
| Keywords | azure, cloud, tracing, typescript |

## Links

- npm: https://www.npmjs.com/package/@azure/opentelemetry-instrumentation-azure-sdk
- Repository: https://github.com/Azure/azure-sdk-for-js
- Homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/README.md
- Issues: https://github.com/Azure/azure-sdk-for-js/issues
- npm.io page: https://npm.io/package/@azure/opentelemetry-instrumentation-azure-sdk

## Dependencies (7)

- [tslib](https://npm.io/package/tslib.md) ^2.7.0
- [@azure/logger](https://npm.io/package/@azure/logger.md) ^1.0.0
- [@opentelemetry/api](https://npm.io/package/@opentelemetry/api.md) ^1.9.0
- [@azure/core-tracing](https://npm.io/package/@azure/core-tracing.md) ^1.2.0
- [@opentelemetry/core](https://npm.io/package/@opentelemetry/core.md) ^2.0.0
- [@opentelemetry/sdk-trace-web](https://npm.io/package/@opentelemetry/sdk-trace-web.md) ^2.0.0
- [@opentelemetry/instrumentation](https://npm.io/package/@opentelemetry/instrumentation.md) ^0.211.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2026-05-05
- 1.1.0-beta.1 (beta) — 2026-05-28
- 1.0.0-alpha.20260311.1 (dev) — 2026-03-11
- 1.0.0-beta.9 (next) — 2025-06-09
- 1.0.0-alpha.20260309.1 — 2026-03-09
- 1.0.0-alpha.20260305.1 — 2026-03-05
- 1.0.0-beta.10 — 2026-03-05
- 1.0.0-alpha.20260303.1 — 2026-03-03
- 1.0.0-alpha.20260302.2 — 2026-03-02
- 1.0.0-alpha.20260206.1 — 2026-02-06
- 1.0.0-alpha.20260205.1 — 2026-02-05
- 1.0.0-alpha.20260204.1 — 2026-02-04
- 1.0.0-alpha.20260126.1 — 2026-01-26
- 1.0.0-alpha.20260123.1 — 2026-01-23
- 1.0.0-alpha.20260121.1 — 2026-01-21
- … 362 more at https://npm.io/package/@azure/opentelemetry-instrumentation-azure-sdk/versions

## README

# Azure OpenTelemetry Instrumentation library for JavaScript

## Getting started

### Currently supported environments

- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
- Latest versions of Safari, Chrome, Edge, and Firefox.

See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.

### Prerequisites

- An [Azure subscription][azure_sub].
- The [@opentelemetry/instrumentation][otel_instrumentation] package.

You'll need to configure the OpenTelemetry SDK in order to produce Telemetry data. While configuring OpenTelemetry is outside the scope of this README, we encourage you to review the [OpenTelemetry documentation][otel_documentation] in order to get started using OpenTelemetry.

### Install the `@azure/opentelemetry-instrumentation-azure-sdk` package

Install the Azure OpenTelemetry Instrumentation client library with `npm`:

```bash
npm install @azure/opentelemetry-instrumentation-azure-sdk
```

### Browser support

#### JavaScript Bundle

To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).

## Key concepts

- The **createAzureSdkInstrumentation** function is the main hook exported by this library which provides a way to create an Azure SDK Instrumentation object to be registered with OpenTelemetry.

## Examples

### Enable OpenTelemetry instrumentation

```ts snippet:enable_instrumentation
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { SimpleSpanProcessor, ConsoleSpanExporter } from "@opentelemetry/tracing";
import { registerInstrumentations } from "@opentelemetry/instrumentation";
import { createAzureSdkInstrumentation } from "@azure/opentelemetry-instrumentation-azure-sdk";
import { KeyClient } from "@azure/keyvault-keys";
import { DefaultAzureCredential } from "@azure/identity";
import { trace, context } from "@opentelemetry/api";

// Set-up and configure a Node Tracer Provider using OpenTelemetry SDK.
const provider = new NodeTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.register();

registerInstrumentations({
  instrumentations: [createAzureSdkInstrumentation()],
});

// Continue to import any Azure SDK client libraries after registering the instrumentation.
// import { KeyClient } from "@azure/keyvault-keys";
// import { DefaultAzureCredential } from "@azure/identity";

const keyClient = new KeyClient("https://my.keyvault.azure.net", new DefaultAzureCredential());

// Tracing is now enabled using automatic span propagation with an active context.
await keyClient.getKey("MyKeyName");

// If your scenario requires manual span propagation, all Azure client libraries
// support explicitly passing a parent context via an `options` parameter.
// Get a tracer from a registered provider, create a span, and get the current context.
const tracer = trace.getTracer("my-tracer");
const span = tracer.startSpan("main");
const ctx = trace.setSpan(context.active(), span);

await keyClient.getKey("MyKeyName", {
  tracingOptions: {
    // ctx will be used as the parent context for all operations.
    tracingContext: ctx,
  },
});
```

## Troubleshooting

### Logging

Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:

```ts snippet:logging
import { setLogLevel } from "@azure/logger";

setLogLevel("info");
```

For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).

### Instrumentation for ES Modules

This package utilizes [@opentelemetry/instrumentation](https://www.npmjs.com/package/@opentelemetry/instrumentation) to setup the necessary hooks and loaders. Please refer to [@opentelemetry/instrumentation's README](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation/README.md#instrumentation-for-es-modules-in-nodejs-experimental) for instructions on configuring tracing for ESM packages.

## Contributing

If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.

## Related projects

- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)



[azure_sub]: https://azure.microsoft.com/free/
[otel_instrumentation]: https://www.npmjs.com/package/@opentelemetry/instrumentation
[otel_documentation]: https://opentelemetry.io/docs/languages/js/

---
_Source: https://npm.io/package/@azure/opentelemetry-instrumentation-azure-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
