@vercel/otel 0.2.0 โ 1.0.0-57654ffd-20240125194853
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -9
- package/dist/edge/index.js +18 -0
- package/dist/edge/index.js.map +7 -0
- package/dist/node/index.js +21 -0
- package/dist/node/index.js.map +7 -0
- package/dist/types/exporters/exporter-trace-otlp-http-fetch.d.ts +13 -0
- package/dist/types/exporters/exporter-trace-otlp-proto-fetch.d.ts +13 -0
- package/dist/types/exporters/otlp-exporter-base.d.ts +14 -0
- package/dist/types/exporters/trace-config.d.ts +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/instrumentations/fetch.d.ts +18 -0
- package/dist/types/processor/composite-span-processor.d.ts +1 -0
- package/dist/types/sdk.d.ts +12 -0
- package/dist/types/types.d.ts +33 -0
- package/dist/types/util/attributes.d.ts +1 -0
- package/dist/types/util/request-id.d.ts +1 -0
- package/dist/types/vercel-request-context/api.d.ts +5 -0
- package/dist/types/vercel-request-context/attributes.d.ts +1 -0
- package/package.json +64 -40
- package/dist/index.edge.d.ts +0 -1
- package/dist/index.edge.js +0 -5
- package/dist/index.edge.js.map +0 -1
- package/dist/index.node.d.ts +0 -1
- package/dist/index.node.js +0 -15
- package/dist/index.node.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@vercel/otel)
|
|
4
4
|
|
|
5
|
-
> **Note:** This package is experimental.
|
|
5
|
+
> **Note:** This package is experimental. It doesn't follow semver yet. Minors can contain breaking changes.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`@vercel/otel` is a simple and easy-to-use package that sets up your tracing configuration.
|
|
8
8
|
|
|
9
9
|
๐ก Use this package to quickly instrument your applications and get started with OpenTelemetry!
|
|
10
10
|
|
|
11
11
|
## ๐ฆ Installation
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
npm install vercel/otel
|
|
14
|
+
npm install @vercel/otel
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## ๐ Usage
|
|
@@ -20,7 +20,7 @@ npm install vercel/otel
|
|
|
20
20
|
import { registerOTel } from "@vercel/otel";
|
|
21
21
|
import { trace } from "@opentelemetry/api";
|
|
22
22
|
|
|
23
|
-
// Register the OpenTelemetry
|
|
23
|
+
// Register the OpenTelemetry.
|
|
24
24
|
registerOTel("your-service-name");
|
|
25
25
|
|
|
26
26
|
// Now you can use the OpenTelemetry APIs
|
|
@@ -31,16 +31,23 @@ const span = trace.getTracer("your-component").startSpan("your-operation");
|
|
|
31
31
|
|
|
32
32
|
### `registerOTel(serviceName: string)`
|
|
33
33
|
|
|
34
|
-
Registers the OpenTelemetry
|
|
35
|
-
This is all that is needed to trace your app on Vercel.
|
|
34
|
+
Registers the OpenTelemetry SDK with the specified service name and the default configuration.
|
|
36
35
|
|
|
37
36
|
- `serviceName`: The name of your service, used as the app name in many OpenTelemetry backends.
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
### `registerOTel(config: Configuration)`
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
Registers the OpenTelemetry SDK with the specified configuration. Configuration options include:
|
|
42
41
|
|
|
43
|
-
The
|
|
42
|
+
- `serviceName`: The name of your service, used as the app name in many OpenTelemetry backends.
|
|
43
|
+
- `attributes`: The resource attributes. By default, `@vercel/otel` configures relevant Vercel attributes based on [the environment](https://vercel.com/docs/projects/environment-variables/system-environment-variables), such as `vercel.env`, `vercel.runtime`, `vercel.host`, etc.
|
|
44
|
+
- `instrumentations`: A set of instrumentations. By default, `@vercel/otel` configures "fetch" instrumentation.
|
|
45
|
+
- `instrumentationConfig`: Customize configuration for predefined instrumentations, such as "fetch".
|
|
46
|
+
- `propagators`: A set of propagators that may extend inbound and outbound contexts. By default, `@vercel/otel` configures [W3C Trace Context](https://www.w3.org/TR/trace-context/) propagator.
|
|
47
|
+
- `traceSampler`: The sampler to be used to decide which requests should be traced. By default, all requests are traced. This option can be changed to, for instance, only trace 1% of all requests.
|
|
48
|
+
- `spanProcessors` and `traceExporter`: The export mechanism for traces. By default, `@vercel/otel` configures the best export mechanism for the environment. For instance, if a [tracing integrations](https://vercel.com/docs/observability/otel-overview/quickstart) is configured on Vercel, this integration will be automatically used for export; otherwise an [OTLP exporter](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#otlp-exporter) can be used if configured in environment variables.
|
|
49
|
+
|
|
50
|
+
See API for more details.
|
|
44
51
|
|
|
45
52
|
## ๐ License
|
|
46
53
|
|