@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 CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@vercel/otel.svg)](https://www.npmjs.com/package/@vercel/otel)
4
4
 
5
- > **Note:** This package is experimental. Updates can contain breaking changes.
5
+ > **Note:** This package is experimental. It doesn't follow semver yet. Minors can contain breaking changes.
6
6
 
7
- `vercel/otel` is a simple and easy-to-use package that sets up your trace provider and exporter.
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 provider with an HTTP exporter
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 provider with an HTTP exporter using the given service name.
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
- ## ๐Ÿงช What exactly is this package doing
38
+ ### `registerOTel(config: Configuration)`
40
39
 
41
- This package utilizes the [`exports`](https://nodejs.org/api/packages.html#exports) API, enabling us to import the OpenTelemetry SDK in Node only. When you import `registerOTel` in a file intended for the edge, it returns an empty function because OpenTelemetry doesn't support the edge. However, if you import the same function in a file designed for Node, you'll receive a standard function that sets up the OpenTelemetry SDK correctly.
40
+ Registers the OpenTelemetry SDK with the specified configuration. Configuration options include:
42
41
 
43
- The OpenTelemetry SDK initialization itself is straightforward. For more details, please see [the code](https://github.com/vercel/otel/blob/main/src/index.node.ts).
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