open-index/open-npm huggingface dataset:
npm package: @opentelemetry/plugin-fetch
Description: OpenTelemetry fetch automatic instrumentation package.
Author: OpenTelemetry Authors
Latest version: 0.14.0
Deprecated: Deprecated in favor of @opentelemetry/instrumentation-fetch

# OpenTelemetry Fetch Instrumentation for web

[![Gitter chat][gitter-image]][gitter-url]
[![NPM Published Version][npm-img]][npm-url]
[![dependencies][dependencies-image]][dependencies-url]
[![devDependencies][devDependencies-image]][devDependencies-url]
[![Apache License][license-image]][license-image]

This module provides auto instrumentation for web using fetch.

## Installation

```bash
npm install --save @opentelemetry/plugin-fetch
```

## Usage

```js
'use strict';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { FetchPlugin } from '@opentelemetry/plugin-fetch';
import { ZoneContextManager } from '@opentelemetry/context-zone';

const provider = new WebTracerProvider({
  plugins: [
    new FetchPlugin(),
  ],
});

provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));

provider.register({
  contextManager: new ZoneContextManager(),
});

// and some test

fetch('http://localhost:8090/fetch.js');

```

## Example Screenshots

![Screenshot of the running example](images/trace1.png)
![Screenshot of the running example](images/trace2.png)
![Screenshot of the running example](images/trace3.png)

See [examples/tracer-web/fetch](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/tracer-web) for a short example.

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us on [gitter][gitter-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-plugin-fetch
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-plugin-fetch
[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-plugin-fetch
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-plugin-fetch&type=dev
[npm-url]: https://www.npmjs.com/package/@opentelemetry/plugin-fetch
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fplugin-fetch.svg
npm package: @opentelemetry/plugin-react-load
Description: OpenTelemetry instrumentation for React class component lifecycle methods
Author: OpenTelemetry Authors
Latest version: 0.46.0

# OpenTelemetry Plugin React Load

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

This module provides automatic instrumentation for *React lifecycles* for Web applications, which may be loaded using the [`@opentelemetry/sdk-trace-web`](https://www.npmjs.com/package/@opentelemetry/sdk-trace-web) package.

If total installation size is not constrained, it is recommended to use the [`@opentelemetry/auto-instrumentations-web`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-web) bundle with [`@opentelemetry/sdk-trace-web`](https://www.npmjs.com/package/@opentelemetry/sdk-trace-web) for the most seamless instrumentation experience.

Compatible with OpenTelemetry JS API and SDK `1.0+`.

## Status

| Maturity                              | [Component Owner](../../.github/component_owners.yml) | Compatibility         |
|---------------------------------------|-------------------------------------------------------|-----------------------|
| [Unmaintained](../../CONTRIBUTING.md) | N/A                                                   | API 1.0+<br/>SDK 1.0+ |

## Installation

```bash
npm install --save @opentelemetry/plugin-react-load
```

## Usage

```js
import { BaseOpenTelemetryComponent } from '@opentelemetry/plugin-react-load';

// Set once for the entire plugin
BaseOpenTelemetryComponent.setLogger(logger);
BaseOpenTelemetryComponent.setTracer('name', 'version');
```

To instrument components, extend `BaseOpenTelemetryComponent`:

```js
import { BaseOpenTelemetryComponent } from '@opentelemetry/plugin-react-load';

export class Component1 extends BaseOpenTelemetryComponent { ... }
```

See [/examples/react-load](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/react-load) for a short example.

## Semantic Conventions

This package does not currently generate any attributes from semantic conventions.

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/plugin-react-load
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fplugin-react-load.svg
npm package: @opentelemetry/propagation-utils
Description: Propagation utilities for opentelemetry instrumentations
Author: OpenTelemetry Authors
Latest version: 0.31.17

# OpenTelemetry Propagation Utils

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

A collection of propagation utils for opentelemetry.

## Install

```sh
npm install --save @opentelemetry/propagation-utils
```

## Usage

### PubSub

To make sure each message handled by pubsub creates a new `process` span, and propagates to any internal operation, do as follow:

```ts
import { pubsubPropagation } from '@opentelemetry/propagation-utils';
import { Span, propagation, trace, Context } from '@opentelemetry/api';

const patch = (message: Message[], rootSpan: Span) => {
    const tracer = trace.getTracer('my-tracer');
    pubsubPropagation.patchArrayForProcessSpans(messages, tracer);

    pubsubPropagation.patchMessagesArrayToStartProcessSpans<Message>({
        messages,
        tracer,
        parentSpan: rootSpan,
        messageToSpanDetails: (message) => ({
            attributes: { ... },
            name: 'some-name',
            parentContext: propagation.extract(....) as Context
        }),
    });
}
```

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

### License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/propagation-utils
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fpropagation-utils.svg
npm package: @opentelemetry/propagator-aws-xray-lambda
Description: OpenTelemetry AWS Xray propagator provides context propagation for systems that are using AWS X-Ray format.
Author: OpenTelemetry Authors
Latest version: 0.56.0

# OpenTelemetry Propagator AWS X-Ray-Lambda

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

**Note: This is an experimental package under active development. New releases may include breaking changes.**

The OpenTelemetry Propagator for AWS X-Ray Lambda provides propagation based on the X-Ray `_X_AMZN_TRACE_ID` environment
variable in addition to the AWS X-Ray HTTP headers. This propagator should be used only for an AWS Lambda instrumentation.

## Usage

The preferred method for using this propagator is by using the `OTEL_PROPAGATORS` environment variable. For more details,
see the [semantic conventions specification for AWS Lambda](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/faas/aws-lambda.md).

## Propagator Details

The propagator extracts context from the `_X_AMZN_TRACE_ID` environment variable, except when there is already another
context active. It also automatically uses the [AWS X-Ray propagator](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/propagators/opentelemetry-propagator-aws-xray).

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/propagator-aws-xray
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fpropagator-aws-xray.svg
npm package: @opentelemetry/propagator-jaeger
Description: OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.
Author: OpenTelemetry Authors
Latest version: 2.6.1

# OpenTelemetry Propagator Jaeger

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.

Format:
{trace-id}:{span-id}:{parent-span-id}:{flags}

- {trace-id}
  - 64-bit or 128-bit random number in base16 format.
  - Can be variable length, shorter values are 0-padded on the left.
  - Value of 0 is invalid.

- {span-id}
  - 64-bit random number in base16 format.

- {parent-span-id}
  - Set to 0 because this field is deprecated.
- {flags}
  - One byte bitmap, as two hex digits.

Example of usage:

```javascript
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { JaegerPropagator } = require('@opentelemetry/propagator-jaeger');

const provider = new NodeTracerProvider();
provider.register({
  propagator: new JaegerPropagator()
});
```

## Baggage Notes

Jeager Baggage is represented as multiple headers where the names are carrier dependent. For this reason, they are omitted from the `fields` method. This behavior should be taken into account if your application relies on the `fields` functionality. See the [specification][fields-spec-url] for more details.

## Trace on Jaeger UI

![example image](jaeger-tracing.png)

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/propagator-jaeger
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fpropagator-jaeger.svg
[fields-spec-url]: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/context/api-propagators.md#fields
npm package: @opentelemetry/resource-detector-alibaba-cloud
Description: OpenTelemetry resource detector for Alibaba Cloud
Author: OpenTelemetry Authors
Latest version: 0.33.4

# OpenTelemetry Resource Detector for Alibaba Cloud

Resource detector for Alibaba Cloud.

The OpenTelemetry Resource is an immutable representation of the entity producing telemetry. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace and possibly is part of a Deployment which also has a name. All three of these attributes can be included in the `Resource`.

[This document][resource-semantic_conventions] defines standard attributes for resources.

Supports OpenTelemetry JS SDK 1.0

## Installation

```bash
npm install --save @opentelemetry/resource-detector-alibaba-cloud
```

## Usage

```typescript
import { detectResources } from '@opentelemetry/resources';
import { alibabaCloudEcsDetector } from '@opentelemetry/resource-detector-alibaba-cloud'
const resource = await detectResources({
   detectors: [alibabaCloudEcsDetector],
})

const tracerProvider = new NodeTracerProvider({ resource });
```

## Available detectors

This package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)

### Alibaba Cloud Ecs Detector

Populates `cloud` and `host` for processes running on [Alibaba Cloud ECS](https://www.alibabacloud.com/product/ecs). More info about Alibaba Instance Identities can be found [in the Alibaba Cloud documentation](https://www.alibabacloud.com/help/en/ecs/user-guide/use-instance-identities).

| Resource Attribute      | Description                                                     |
|-------------------------|-----------------------------------------------------------------|
| cloud.account.id        | Value of `owner-account-id` on Alibaba Cloud                    |
| cloud.availability_zone | Value of `zone-id` on Alibaba Cloud                             |
| cloud.platform          | In this context, it's always `alibaba_cloud_ecs`                |
| cloud.provider          | In this context, it's always `alibaba_cloud`                    |
| cloud.region            | Value of `region-id` on Alibaba Cloud                           |
| host.id                 | Value of `instance-id` on Alibaba Cloud                         |
| host.name               | The hostname for the app, retrieve from the `hostname` endpoint |
| host.type               | Value of `instance-type` on Alibaba Cloud                       |

[resource-semantic_conventions]: https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions
npm package: @opentelemetry/resource-detector-container
Description: Opentelemetry resource detector to get container resource attributes
Author: OpenTelemetry Authors
Latest version: 0.8.5

# OpenTelemetry Resource Detector for Container

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

[component owners](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/.github/component_owners.yml): @abhee11

Resource detector for container id.
Compatible with OpenTelemetry JS SDK `2.0+`.

## Installation

```bash
npm install --save @opentelemetry/resource-detector-container
```

## Usage

```typescript
import { detectResources } from '@opentelemetry/resources';
import { containerDetector } from '@opentelemetry/resource-detector-container'
const resource = await detectResources({
   detectors: [containerDetector],
})

const tracerProvider = new NodeTracerProvider({ resource });
```

## Available detectors

This package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)

### Container Detector

Populates `container.id` for processes running on containers supporting : docker( cgroup v1 or v2 ) or with containerd

| Resource Attribute |  Description                                                                                                                             |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `container.id`     | Value parsed from file `/proc/self/cgroup` (cgroup v1). If it doesn't exist, parse the value from file `/proc/self/mountinfo` (cgroup v2)|

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/resource-detector-container
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fresource-detector-container.svg
npm package: @opentelemetry/resource-detector-docker
Description: Opentelemetry resource detector to get docker resource attributes
Author: OpenTelemetry Authors
Latest version: 0.1.2
Deprecated: This package is deprecated, please use @opentelemetry/resource-detector-container instead

# OpenTelemetry Resource Detector for Docker

[![NPM Published Version][npm-img]][npm-url]
[![dependencies][dependencies-image]][dependencies-url]
[![devDependencies][devDependencies-image]][devDependencies-url]
[![Apache License][license-image]][license-image]

[component owners](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/.github/component_owners.yml): @abhee11

Resource detector for docker.

Compatible with OpenTelemetry JS API and SDK `1.0+`.

## Installation

```bash
npm install --save @opentelemetry/resource-detector-docker
```

## Usage

```typescript
import { detectResources } from '@opentelemetry/resources';
import { dockerCGroupV1Detector } from '@opentelemetry/resource-detector-docker'
const resource = await detectResources({
   detectors: [dockerCGroupV1Detector],
})

const tracerProvider = new NodeTracerProvider({ resource });
```

## Available detectors

- `dockerCGroupV1Detector`: Populates `container.id` for processes running on docker cgroup v1

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
npm package: @opentelemetry/resource-detector-github
Description: OpenTelemetry SDK resource detector for GitHub
Author: OpenTelemetry Authors
Latest version: 0.32.0

# OpenTelemetry Resource Detector for GitHub Actions

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

Resource detector for GitHub Actions.

Detects `GITHUB_*` environment variables [specified here](https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables) and adds as attributes on a resource.

This is useful for collecting telemetry in GitHub Actions-powered CI/CD workflows.

The OpenTelemetry Resource is an immutable representation of the entity producing telemetry. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace and possibly is part of a Deployment which also has a name. All three of these attributes can be included in the `Resource`.

Compatible with OpenTelemetry JS API and SDK `1.0+`.

## Installation

```bash
npm install --save @opentelemetry/resource-detector-github
```

## Usage

```js
const { gitHubDetector } = require('@opentelemetry/resource-detector-github')

async function run() {
  // Initialize GitHub Resource Detector
  const resource = await gitHubDetector.detect();
};

run()
```

## Available detectors

### GitHub Detector

| Resource Attribute | Description                                               |
| ------------------ | --------------------------------------------------------- |
| github.actor       | Value of Process Environment Variable `GITHUB_ACTOR`      |
| github.base_ref    | Value of Process Environment Variable `GITHUB_BASE_REF`   |
| github.head_ref    | Value of Process Environment Variable `GITHUB_HEAD_REF`   |
| github.ref         | Value of Process Environment Variable `GITHUB_REF`        |
| github.run_id      | Value of Process Environment Variable `GITHUB_RUN_ID`     |
| github.run_number  | Value of Process Environment Variable `GITHUB_RUN_NUMBER` |
| github.sha         | Value of Process Environment Variable `GITHUB_SHA`        |
| github.workflow    | Value of Process Environment Variable `GITHUB_WORKFLOW`   |

## Useful links

- [GitHub Action Environment Variables](https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables)
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/resource-detector-github
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fresource-detector-github.svg
npm package: @opentelemetry/resource-detector-instana
Description: OpenTelemetry SDK resource detector for Instana
Author: OpenTelemetry Authors
Latest version: 0.33.0

# OpenTelemetry Resource Detector for Instana

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

This resource detector will detect the Instana agent to register the Opentelemetry as a Node.js process. The created resource will be automatically merged with the existing resources and contains the real PID, which is returned from the Instana agent. This mechanism is needed to connect the Node.js Otel process with the incoming Opentelemetry spans.

## Installation

```bash
npm install --save @opentelemetry/resource-detector-instana
```

## Environment variables

- INSTANA_AGENT_HOST: The Instana agent hostname.
- INSTANA_AGENT_PORT: The Instana agent port.
- INSTANA_RETRY_TIMEOUT_MS: The resource detector does three retries to connect to the Instana agent. This is the timeout between the retries.
- INSTANA_AGENT_TIMEOUT_MS: The client timeout when connecting the Instana agent.

## Usage

```typescript
import {
  processDetector,
  envDetector,
} from "@opentelemetry/resources";
import { NodeSDK } from "@opentelemetry/sdk-node";
import { instanaAgentDetector } from "@opentelemetry/resource-detector-instana";

const sdk = new NodeSDK({
   serviceName: "TestService",
   resourceDetectors: [envDetector, processDetector, instanaAgentDetector],
});

sdk.start()
```

## Available detectors

This package implements Semantic Convention v1.33.1.

### Instana Agent Detector

| Resource Attribute           | Description                                                                                                              |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| process.pid                  | The ID of the process. Value of parameter `pid` from the response to a request to `/com.instana.plugin.nodejs.discovery` |
| service.instance.id          | The agent UUID. Value of parameter `agentUuid` from the response to a request to `/com.instana.plugin.nodejs.discovery`  |

## Useful links

- For more information about Instana Agent, visit: <https://www.ibm.com/docs/en/instana-observability/current?topic=instana-host-agent>
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/resource-detector-instana
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fresource-detector-instana.svg
npm package: @opentelemetry/resources
Description: OpenTelemetry SDK resources
Author: OpenTelemetry Authors
Latest version: 2.6.1

# OpenTelemetry Resources Util

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

The OpenTelemetry Resource is an immutable representation of the entity producing telemetry. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace and possibly is part of a Deployment which also has a name. All three of these attributes can be included in the `Resource`.

[This document][resource-semantic_conventions] defines standard attributes for resources which are accessible via [`@opentelemetry/semantic-conventions`](https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions).

## Installation

```bash
npm install --save @opentelemetry/resources
```

## Usage

```typescript
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
import { resourceFromAttributes } from '@opentelemetry/resources';

const resource = resourceFromAttributes({
    [ATTR_SERVICE_NAME]: 'api-service',
});

const anotherResource = resourceFromAttributes({
    'service.version': '2.0.0',
    'service.group': 'instrumentation-group'
});
const mergedResource = resource.merge(anotherResource);
```

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/resources
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fresources.svg

[resource-semantic_conventions]: https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions
npm package: @opentelemetry/sampler-aws-xray
Description: OpenTelemetry Remote Sampler for AWS X-Ray
Author: OpenTelemetry Authors
Latest version: 0.2.0

# AWS X-Ray Remote Sampler

This module provides the remote/centralized sampler for AWS X-Ray.

## Status

| Maturity                               | [Component Owner](../../.github/component_owners.yml) | Compatibility         |
| -------------------------------------- | ----------------------------------------------------- | --------------------- |
| [Beta](../../CONTRIBUTING.md#beta)     | @jj22ee @yiyuan-he                                    | API 1.1+<br/>SDK 2.0+ |


## Usage

```js

const { AWSXRayRemoteSampler } = require('@opentelemetry/sampler-aws-xray');
const opentelemetry = require("@opentelemetry/sdk-node");
const { Resource } = require("@opentelemetry/resources");
const { BatchSpanProcessor} = require('@opentelemetry/sdk-trace-base');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');
const { AWSXRayPropagator } = require("@opentelemetry/propagator-aws-xray");
const { AWSXRayIdGenerator } = require("@opentelemetry/id-generator-aws-xray");


// Initialize trace exporter, span processor, and ID generator
const _traceExporter = new OTLPTraceExporter();
const _spanProcessor = new BatchSpanProcessor(_traceExporter);
const _tracerConfig = {
    // add x-ray remote sampler
    sampler: new AWSXRayRemoteSampler(),
    idGenerator: new AWSXRayIdGenerator(),
}

const sdk = new opentelemetry.NodeSDK({
    serviceName: "remote-sampler-app",
    textMapPropagator: new AWSXRayPropagator(),
    instrumentations: [
        new HttpInstrumentation(),
        new AwsInstrumentation({
            suppressInternalInstrumentation: true
        }),
    ],
    spanProcessor: _spanProcessor,
    traceExporter: _traceExporter,
});

sdk.configureTracerProvider(_tracerConfig, _spanProcessor);

```

For more details on setting up the global tracer provider to send traces to AWS X-Ray, refer to [this documentation](https://aws-otel.github.io/docs/getting-started/js-sdk/trace-manual-instr#setting-up-the-global-tracer).

Please note that AWS Lambda does not support X-Ray remote sampling.

## Semantic Conventions

This package does not currently generate any attributes from semantic conventions.

## Useful links

- [More information on OpenTelemetry](https://opentelemetry.io/)
- [More about OpenTelemetry JavaScript](https://github.com/open-telemetry/opentelemetry-js)
- [More in-depth documentation on setting up OpenTelemetry to send traces to AWS X-Ray](https://aws-otel.github.io/docs/getting-started/javascript-sdk)

## License

Apache 2.0 - See [LICENSE](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE) for more information.
npm package: @opentelemetry/sampler-jaeger-remote
Description: Jaeger Remote Sampler
Author: OpenTelemetry Authors
Latest version: 0.214.0

# Jaeger Remote Sampler

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

**Note: This is an experimental package under active development. Minor releases may include breaking changes.**

The Jaeger Remote Sampler package is designed for OpenTelemetry to dynamically fetch and update sampling strategies from a Jaeger agent or collector. This enables applications to adjust their sampling strategies based on the current configuration provided by Jaeger, optimizing for both performance and observability.

## Installation

```bash
npm install --save @opentelemetry/sampler-jaeger-remote
```

## Usage

To integrate the Jaeger Remote Sampler with your application, configure it with the endpoint of your Jaeger agent or collector. The sampler can be set up as follows:

```javascript
const { JaegerRemoteSampler } = require('@opentelemetry/sampler-jaeger-remote');
const { defaultResource, resourceFromAttributes } = require('@opentelemetry/resources');
const { NodeTracerProvider } = require('@opentelemetry/node');

// Jaeger agent endpoint
const sampler = new JaegerRemoteSampler({
  endpoint: 'http://your-jaeger-agent:14268/api/sampling',
  serviceName: 'your-service-name',
  initialSampler: new AlwaysOnSampler(),
  poolingInterval: 60000  // 60 seconds
});
const provider = new NodeTracerProvider({
  resource: defaultResource().merge(resourceFromAttributes({
    'service.name': 'your-service-name'
  })),
  sampler
});

provider.register();
```

## Supported Configuration Options

The Jaeger Remote Sampler supports the following sampling strategies based on the configuration received from the remote endpoint:

1. **Per-Operation Sampling**: If the remote configuration includes `operationSampling` with `perOperationStrategies`, it creates a `PerOperationSampler`. This allows for different sampling rates for different operations.

2. **Probabilistic Sampling**: If the remote configuration specifies `StrategyType.PROBABILISTIC`, it creates a `TraceIdRatioBasedSampler`. This samples a percentage of traces based on the trace ID.

3. **Default Sampling**: If none of the above apply, it falls back to the initial sampler provided in the constructor.

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/sampler-jaeger-remote
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fsampler-jaeger-remote.svg
npm package: @opentelemetry/sdk-events
Description: OpenTelemetry events SDK
Author: OpenTelemetry Authors
Latest version: 0.202.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# OpenTelemetry Events SDK

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

**Note: This is an experimental package under active development. New releases may include breaking changes.**

This package provides an experimental Events SDK implementation. The Events SDK is implemented on top of the Logs SDK.

## Installation

```bash
npm install --save @opentelemetry/api-logs
npm install --save @opentelemetry/api-events
npm install --save @opentelemetry/sdk-events
```

## Usage

Here is an example of configuring and using the Events SDK:

```js
const { logs } = require('@opentelemetry/api-logs');
const { events } = require('@opentelemetry/api-events');
const { EventLoggerProvider } = require('@opentelemetry/sdk-events');
const {
  LoggerProvider,
  SimpleLogRecordProcessor,
  ConsoleLogRecordExporter,
} = require('@opentelemetry/sdk-logs');

// The Events SDK has a dependency on the Logs SDK.
// Any processing of events (e.g. export) is done through the Logs SDK.
const loggerProvider = new LoggerProvider();
loggerProvider.addLogRecordProcessor(
  new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())
);

// Register a global EventLoggerProvider.
// This would be used by instrumentations, similar to how the global TracerProvider,
// LoggerProvider and MeterProvider work.
const eventLoggerProvider = new EventLoggerProvider(loggerProvider);
events.setGlobalEventLoggerProvider(eventLoggerProvider);

// Get an EventLogger from the global EventLoggerProvider
const eventLogger = events.getEventLogger('default');

// Emit an event
eventLogger.emit({
  name: 'my-domain.my-event',
  data: {
    field1: 'abc',
    field2: 123
  }
});

// Shutdown is done directly on the LoggerProvider
loggerProvider.shutdown();
```

## Example

See [examples/events](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/examples/events)

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/sdk-logs
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fsdk%2Dlogs.svg
npm package: @opentelemetry/sdk-trace-web
Description: OpenTelemetry Web Tracer
Author: OpenTelemetry Authors
Latest version: 2.6.1

# OpenTelemetry Web SDK

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

This module provides *automated instrumentation and tracing* for Web applications.

For manual instrumentation see the
[@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base) package.

## How does automatic tracing work

This package exposes a class `WebTracerProvider` that will be able to automatically trace things in Browser only.

See the example how to use it.

OpenTelemetry comes with a growing number of instrumentations for well know modules (see [supported modules](https://github.com/open-telemetry/opentelemetry-js#plugins)) and an API to create custom instrumentations (see [the instrumentation developer guide](https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/instrumentation-guide.md)).

Web Tracer currently supports one plugin for document load.
Unlike Node Tracer (`NodeTracerProvider`), the plugins needs to be initialized and passed in configuration.
The reason is to give user full control over which plugin will be bundled into web page.

You can choose to use the `ZoneContextManager` if you want to trace asynchronous operations. Please note that the `ZoneContextManager` does not work with JS code targeting `ES2017+`. In order to use the `ZoneContextManager`, please transpile back to `ES2015`.

## Installation

```bash
npm install --save @opentelemetry/sdk-trace-web
```

## Usage

```js
import {
  ConsoleSpanExporter,
  SimpleSpanProcessor,
  WebTracerProvider,
} from '@opentelemetry/sdk-trace-web';
import { DocumentLoad } from '@opentelemetry/plugin-document-load';
import { ZoneContextManager } from '@opentelemetry/context-zone';
import { registerInstrumentations } from '@opentelemetry/instrumentation';

const provider = new WebTracerProvider({
  spanProcessors: [new SimpleSpanProcessor(new ConsoleSpanExporter())]
});

provider.register({
  // Changing default contextManager to use ZoneContextManager - supports asynchronous operations - optional
  contextManager: new ZoneContextManager(),
});

// Registering instrumentations / plugins
registerInstrumentations({
  instrumentations: [
    new DocumentLoad(),
  ],
});

```

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/sdk-trace-web
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fsdk-trace-web.svg
npm package: @opentelemetry/shim-opentracing
Description: OpenTracing to OpenTelemetry shim
Author: OpenTelemetry Authors
Latest version: 2.6.1

# OpenTracing shim

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

OpenTracing shim allows existing OpenTracing instrumentation to report to OpenTelemetry

## Installation

```bash
npm install --save @opentelemetry/shim-opentracing
```

## Usage

Use the TracerShim wherever you initialize your OpenTracing tracers.

```javascript
const opentracing = require('opentracing');

// Old tracer initialization.
const tracer = myOpenTracingTracer(...);
opentracing.initGlobalTracer(tracer);

// New tracer initialization.
import { TracerShim } from '@opentelemetry/shim-opentracing';

const tracer = myOpenTelemetryTracer(...)
opentracing.initGlobalTracer(new TracerShim(tracer));

```

Optionally, you can specify propagators to be used for the OpenTracing `TextMap` and `HttpHeaders` formats:

```javascript
var b3Propagator = new B3Propagator();
new TracerShim(tracer, {
  textMapPropagator: b3Propagator,
  httpHeadersPropagator: b3Propagator
})
```

If propagators are not specified, OpenTelemetry's global propagator will be used.

See [examples/opentracing-shim](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/opentracing-shim) for a short example.

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

## Limitation

The OpenTracing shim does not currently include a scope manager.
This feature was never implemented in OpenTracing JS therefore the
shim does not provide that feature.

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/shim-opentracing
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fshim-opentracing.svg
npm package: @opentelemetry/types
Description: TypeScript types for OpenTelemetry
Author: OpenTelemetry Authors
Latest version: 0.3.3
Deprecated: Package renamed to @opentelemetry/api, see https://github.com/open-telemetry/opentelemetry-js

# OpenTelemetry API for JavaScript
[![Gitter chat][gitter-image]][gitter-url]
[![NPM Published Version][npm-img]][npm-url]
[![dependencies][dependencies-image]][dependencies-url]
[![devDependencies][devDependencies-image]][devDependencies-url]
[![Apache License][license-image]][license-image]

This package provides TypeScript interfaces and enums for the OpenTelemetry core trace and metrics model. It is intended for use both on the server and in the browser.


## Useful links
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us on [gitter][gitter-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-types
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-types
[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-types
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-types&type=dev
[npm-url]: https://www.npmjs.com/package/@opentelemetry/types
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Ftypes.svg
npm package: @opentelemetry/winston-transport
Description: OpenTelemetry Transport for winston
Author: OpenTelemetry Authors
Latest version: 0.24.0

# OpenTelemetry transport for winston

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

This module provides a Transport for [`winston`](https://www.npmjs.com/package/winston) module to send Winston logging to the OpenTelemetry Logging SDK.

Compatible with OpenTelemetry JS API and SDK `1.0+`.

## Installation

```bash
npm install --save @opentelemetry/winston-transport
```

## Usage

This package exports the Winston transport class that is used to send records to the
OpenTelemetry Logs SDK. It can be used directly when configuring a Winston logger. If using
[`@opentelemetry/instrumenation-winston`](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-winston)
package there is no need to instantiate the transport as the instrumentation will take care of that.
For example:

```js
const logsAPI = require('@opentelemetry/api-logs');
const {
    LoggerProvider,
    SimpleLogRecordProcessor,
    ConsoleLogRecordExporter,
} = require('@opentelemetry/sdk-logs');
const { OpenTelemetryTransportV3 } = require('@opentelemetry/winston-transport');
const winston = require('winston');


// To start a logger, you first need to initialize the Logger provider.
// And add a processor to export log record.
const loggerProvider = new LoggerProvider({
  processors: [new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())],
});
logsAPI.logs.setGlobalLoggerProvider(loggerProvider);

const logger = winston.createLogger({
  level: 'info',
  transports: [
    new winston.transports.Console(),
    new OpenTelemetryTransportV3()
  ]
});
```

> [!IMPORTANT]
> Logs will be duplicated if `@opentelemetry/winston-transport` is added as a transport in `winston` and `@opentelemetry/instrumentation-winston` is configured with `disableLogSending: false`.

### Supported versions

- [`winston`](https://www.npmjs.com/package/winston) versions `>=3.0.0 <4`

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/winston-transport
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fwinston-transport.svg