@vercel/otel 1.3.1-8e5cc8ea-20240221193849 → 1.4.0

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.
@@ -1,12 +1,24 @@
1
- import type { TracerProvider } from "@opentelemetry/api";
1
+ import type { Attributes, TracerProvider } from "@opentelemetry/api";
2
2
  import type { Instrumentation, InstrumentationConfig } from "@opentelemetry/instrumentation";
3
3
  /**
4
4
  * Configuration for the "fetch" instrumentation.
5
+ *
6
+ * Some of this configuration can be overriden on a per-fetch call basis by
7
+ * using the `opentelemetry` property in the `RequestInit` object (requires Next 14.1.1 or above).
8
+ * This property can include:
9
+ * - `ignore`: boolean - whether to ignore the fetch call from tracing. Overrides
10
+ * `ignoreUrls`.
11
+ * - `propagateContext: boolean`: overrides `propagateContextUrls` for this call.
12
+ * - `spanName: string`: overrides the computed span name for this call.
13
+ * - `attributes: Attributes`: overrides the computed attributes for this call.
5
14
  */
6
15
  export interface FetchInstrumentationConfig extends InstrumentationConfig {
7
16
  /**
8
17
  * A set of URL matchers (string prefix or regex) that should be ignored from tracing.
9
- * By default all URLs are traced. Example: `fetch: { ignoreUrls: [/example.com/] }`.
18
+ * By default all URLs are traced.
19
+ * Can be overriden by the `opentelemetry.ignore` property in the `RequestInit` object.
20
+ *
21
+ * Example: `fetch: { ignoreUrls: [/example.com/] }`.
10
22
  */
11
23
  ignoreUrls?: (string | RegExp)[];
12
24
  /**
@@ -15,6 +27,8 @@ export interface FetchInstrumentationConfig extends InstrumentationConfig {
15
27
  * By default the context is propagated _only_ for the
16
28
  * [deployment URLs](https://vercel.com/docs/deployments/generated-urls), all
17
29
  * other URLs should be enabled explicitly.
30
+ * Can be overriden by the `opentelemetry.propagateContext` property in the `RequestInit` object.
31
+ *
18
32
  * Example: `fetch: { propagateContextUrls: [ /my.api/ ] }`.
19
33
  */
20
34
  propagateContextUrls?: (string | RegExp)[];
@@ -22,14 +36,27 @@ export interface FetchInstrumentationConfig extends InstrumentationConfig {
22
36
  * A set of URL matchers (string prefix or regex) for which the tracing context
23
37
  * should not be propagated (see [`propagators`](Configuration#propagators)). This allows you to exclude a
24
38
  * subset of URLs allowed by the [`propagateContextUrls`](FetchInstrumentationConfig#propagateContextUrls).
39
+ * Can be overriden by the `opentelemetry.propagateContext` property in the `RequestInit` object.
25
40
  */
26
41
  dontPropagateContextUrls?: (string | RegExp)[];
27
42
  /**
28
43
  * A string for the "resource.name" attribute that can include attribute expressions in `{}`.
44
+ * Can be overriden by the `opentelemetry.attributes` property in the `RequestInit` object.
45
+ *
29
46
  * Example: `fetch: { resourceNameTemplate: "{http.host}" }`.
30
47
  */
31
48
  resourceNameTemplate?: string;
32
49
  }
50
+ declare global {
51
+ interface RequestInit {
52
+ opentelemetry?: {
53
+ ignore?: boolean;
54
+ propagateContext?: boolean;
55
+ spanName?: string;
56
+ attributes?: Attributes;
57
+ };
58
+ }
59
+ }
33
60
  export declare class FetchInstrumentation implements Instrumentation {
34
61
  instrumentationName: string;
35
62
  instrumentationVersion: string;
@@ -56,6 +56,7 @@ export interface Configuration {
56
56
  * Use the "auto" value to include all default propagators.
57
57
  * By default, `@vercel/otel` configures [W3C Trace Context](https://www.w3.org/TR/trace-context/) propagator.
58
58
  * This option can be also configured via the [`OTEL_PROPAGATORS`](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/) environment variable.
59
+ *
59
60
  * Example: `{ propagators: ["auto", new MyPropagator()] }`
60
61
  */
61
62
  propagators?: PropagatorOrName[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/otel",
3
- "version": "1.3.1-8e5cc8ea-20240221193849",
3
+ "version": "1.4.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -43,8 +43,7 @@
43
43
  "types": "./dist/types/index.d.ts",
44
44
  "files": [
45
45
  "dist",
46
- "LICENSE",
47
- "CHANGELOG.md"
46
+ "LICENSE"
48
47
  ],
49
48
  "engines": {
50
49
  "node": ">=18"
package/CHANGELOG.md DELETED
@@ -1,58 +0,0 @@
1
- # @vercel/otel
2
-
3
- ## 1.3.1-8e5cc8ea-20240221193849
4
-
5
- ### Patch Changes
6
-
7
- - 58ed7f9: Include API docs
8
-
9
- ## 1.3.0
10
-
11
- ### Minor Changes
12
-
13
- - 79110fc: resource.name and resourceNameTemplate for fetch instrumentation
14
- - 965fce6: DataDog resource/operation mapping
15
-
16
- ### Patch Changes
17
-
18
- - 67b5337: Edge performance.timeOrigin is set as 0
19
- - bc65efe: Automatically propagate context to localhost on dev, and same branch_host on preview/prod
20
- - bc65efe: Added vercel.branch_host resource attribute
21
-
22
- ## 1.2.1
23
-
24
- ### Patch Changes
25
-
26
- - 79fbec0: Eliminate race condition between response end and trace end
27
- - 31ce66b: More docs on fetch instrumentation
28
-
29
- ## 1.2.0
30
-
31
- ### Minor Changes
32
-
33
- - 7a04c92: Avoid OTLP longbits to avoid compatibility problems with some OTLP collectors
34
-
35
- ## 1.1.0
36
-
37
- ### Minor Changes
38
-
39
- - 83ad945: Ensure that fetch receives the original input
40
-
41
- ## 1.0.1
42
-
43
- ### Patch Changes
44
-
45
- - a9d3a36: Remove "experimental" warning
46
-
47
- ## 1.0.0
48
-
49
- ### Major Changes
50
-
51
- - 2daf631: - Support for Node and Edge environments
52
- - Telemetry context propagation, including [W3C Trace Context](https://www.w3.org/TR/trace-context/)
53
- - Fetch API instrumentation with context propagation.
54
- - Support and auto-configuration for [Vercel OTEL collector](https://vercel.com/docs/observability/otel-overview/quickstart).
55
- - Enhanced metadata reporting.
56
- - Sampling support.
57
- - Custom tracing exporter support.
58
- - Batched trace exporting.