@effect/opentelemetry 4.0.0-beta.7 → 4.0.0-beta.71

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/dist/NodeSdk.d.ts CHANGED
@@ -1,5 +1,27 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Provides an Effect layer for configuring OpenTelemetry in Node.js
3
+ * processes. The module wires the Effect tracer, metrics producer, and logger
4
+ * into OpenTelemetry SDK providers when span processors, metric readers, or log
5
+ * record processors are supplied, and it builds the shared resource from
6
+ * `OTEL_SERVICE_NAME`, `OTEL_RESOURCE_ATTRIBUTES`, and optional explicit
7
+ * service metadata.
8
+ *
9
+ * Use this module in Node services, workers, CLIs, or server runtimes that need
10
+ * Effect spans, metrics, and logs exported through OpenTelemetry processors and
11
+ * exporters. Telemetry is enabled only for the configured signal types, so an
12
+ * application can install tracing alone, metrics alone, logging alone, or any
13
+ * combination of them from the same layer.
14
+ *
15
+ * The layer is scoped. Tracer and logger providers are force-flushed and shut
16
+ * down when the scope is released, metric readers are shut down with the same
17
+ * lifecycle, and all shutdown waits are bounded by `shutdownTimeout` with a
18
+ * default of three seconds. Keep the layer scope alive for the lifetime of the
19
+ * process and release it during graceful shutdown so batched exporters have a
20
+ * chance to export final telemetry. When combining this layer with Node
21
+ * auto-instrumentations, register instrumentation before importing modules that
22
+ * should be patched, because many Node instrumentations hook module loading.
23
+ *
24
+ * @since 4.0.0
3
25
  */
4
26
  import type * as Otel from "@opentelemetry/api";
5
27
  import type { LoggerProviderConfig, LogRecordProcessor } from "@opentelemetry/sdk-logs";
@@ -14,8 +36,10 @@ import * as Metrics from "./Metrics.ts";
14
36
  import * as Resource from "./Resource.ts";
15
37
  import * as Tracer from "./Tracer.ts";
16
38
  /**
17
- * @since 1.0.0
18
- * @category Models
39
+ * Configuration for the Node OpenTelemetry layer, including optional tracing, metrics, logging, resource, and shutdown settings.
40
+ *
41
+ * @category models
42
+ * @since 4.0.0
19
43
  */
20
44
  export interface Configuration {
21
45
  readonly spanProcessor?: SpanProcessor | ReadonlyArray<SpanProcessor> | undefined;
@@ -33,31 +57,92 @@ export interface Configuration {
33
57
  readonly shutdownTimeout?: Duration.Input | undefined;
34
58
  }
35
59
  /**
36
- * @since 1.0.0
37
- * @category Layers
60
+ * Creates a scoped Node OpenTelemetry tracer provider from one or more span processors and shuts it down when the layer is released.
61
+ *
62
+ * @category layers
63
+ * @since 4.0.0
38
64
  */
39
65
  export declare const layerTracerProvider: (processor: SpanProcessor | NonEmptyReadonlyArray<SpanProcessor>, config?: Omit<TracerConfig, "resource"> & {
40
66
  readonly shutdownTimeout?: Duration.Input | undefined;
41
67
  }) => Layer.Layer<Tracer.OtelTracerProvider, never, Resource.Resource>;
42
68
  /**
43
- * @since 1.0.0
44
- * @category Layers
69
+ * Creates a Node OpenTelemetry layer from configuration, enabling tracing, metrics, and logging only when their processors or readers are supplied.
70
+ *
71
+ * **When to use**
72
+ *
73
+ * Use to install OpenTelemetry support for a Node.js Effect application from
74
+ * one configuration object, enabling tracing, metrics, logging, or any
75
+ * combination of those signals based on the processors and readers supplied.
76
+ *
77
+ * **Details**
78
+ *
79
+ * The configuration can be provided lazily or effectfully. The layer always
80
+ * provides `Resource.Resource`, building it from environment variables and any
81
+ * explicit resource metadata in the configuration.
82
+ *
83
+ * **Gotchas**
84
+ *
85
+ * Register Node auto-instrumentations before importing modules that should be
86
+ * patched, because many Node instrumentations hook module loading.
87
+ *
88
+ * @category layers
89
+ * @since 4.0.0
45
90
  */
46
91
  export declare const layer: {
47
92
  /**
48
- * @since 1.0.0
49
- * @category Layers
93
+ * Creates a Node OpenTelemetry layer from configuration, enabling tracing, metrics, and logging only when their processors or readers are supplied.
94
+ *
95
+ * **When to use**
96
+ *
97
+ * Use to install OpenTelemetry support for a Node.js Effect application from
98
+ * one configuration object, enabling tracing, metrics, logging, or any
99
+ * combination of those signals based on the processors and readers supplied.
100
+ *
101
+ * **Details**
102
+ *
103
+ * The configuration can be provided lazily or effectfully. The layer always
104
+ * provides `Resource.Resource`, building it from environment variables and any
105
+ * explicit resource metadata in the configuration.
106
+ *
107
+ * **Gotchas**
108
+ *
109
+ * Register Node auto-instrumentations before importing modules that should be
110
+ * patched, because many Node instrumentations hook module loading.
111
+ *
112
+ * @category layers
113
+ * @since 4.0.0
50
114
  */
51
115
  (evaluate: LazyArg<Configuration>): Layer.Layer<Resource.Resource>;
52
116
  /**
53
- * @since 1.0.0
54
- * @category Layers
117
+ * Creates a Node OpenTelemetry layer from configuration, enabling tracing, metrics, and logging only when their processors or readers are supplied.
118
+ *
119
+ * **When to use**
120
+ *
121
+ * Use to install OpenTelemetry support for a Node.js Effect application from
122
+ * one configuration object, enabling tracing, metrics, logging, or any
123
+ * combination of those signals based on the processors and readers supplied.
124
+ *
125
+ * **Details**
126
+ *
127
+ * The configuration can be provided lazily or effectfully. The layer always
128
+ * provides `Resource.Resource`, building it from environment variables and any
129
+ * explicit resource metadata in the configuration.
130
+ *
131
+ * **Gotchas**
132
+ *
133
+ * Register Node auto-instrumentations before importing modules that should be
134
+ * patched, because many Node instrumentations hook module loading.
135
+ *
136
+ * @category layers
137
+ * @since 4.0.0
55
138
  */
56
139
  <R, E>(evaluate: Effect.Effect<Configuration, E, R>): Layer.Layer<Resource.Resource, E, R>;
57
140
  };
58
141
  /**
142
+ * Layer that provides an empty OpenTelemetry `Resource`.
143
+ *
144
+ * @category layers
59
145
  * @since 2.0.0
60
- * @category layer
61
146
  */
62
147
  export declare const layerEmpty: Layer.Layer<Resource.Resource>;
63
148
  //# sourceMappingURL=NodeSdk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NodeSdk.d.ts","sourceRoot":"","sources":["../src/NodeSdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACvF,OAAO,KAAK,E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* as Resource from "./Resource.js";
9
9
  import * as Tracer from "./Tracer.js";
10
10
  /**
11
- * @since 1.0.0
12
- * @category Layers
11
+ * Creates a scoped Node OpenTelemetry tracer provider from one or more span processors and shuts it down when the layer is released.
12
+ *
13
+ * @category layers
14
+ * @since 4.0.0
13
15
  */
14
16
  export const layerTracerProvider = (processor, config) => Layer.effect(Tracer.OtelTracerProvider, Effect.gen(function* () {
15
17
  const resource = yield* Resource.Resource;
@@ -23,8 +25,27 @@ export const layerTracerProvider = (processor, config) => Layer.effect(Tracer.Ot
23
25
  }), provider => Effect.promise(() => provider.forceFlush().then(() => provider.shutdown())).pipe(Effect.ignore, Effect.interruptible, Effect.timeoutOption(config?.shutdownTimeout ?? 3000)));
24
26
  }));
25
27
  /**
26
- * @since 1.0.0
27
- * @category Layers
28
+ * Creates a Node OpenTelemetry layer from configuration, enabling tracing, metrics, and logging only when their processors or readers are supplied.
29
+ *
30
+ * **When to use**
31
+ *
32
+ * Use to install OpenTelemetry support for a Node.js Effect application from
33
+ * one configuration object, enabling tracing, metrics, logging, or any
34
+ * combination of those signals based on the processors and readers supplied.
35
+ *
36
+ * **Details**
37
+ *
38
+ * The configuration can be provided lazily or effectfully. The layer always
39
+ * provides `Resource.Resource`, building it from environment variables and any
40
+ * explicit resource metadata in the configuration.
41
+ *
42
+ * **Gotchas**
43
+ *
44
+ * Register Node auto-instrumentations before importing modules that should be
45
+ * patched, because many Node instrumentations hook module loading.
46
+ *
47
+ * @category layers
48
+ * @since 4.0.0
28
49
  */
29
50
  export const layer = evaluate => Layer.unwrap(Effect.gen(function* () {
30
51
  const config = yield* Effect.isEffect(evaluate) ? evaluate : Effect.sync(evaluate);
@@ -46,8 +67,10 @@ export const layer = evaluate => Layer.unwrap(Effect.gen(function* () {
46
67
  return Layer.mergeAll(TracerLive, MetricsLive, LoggerLive).pipe(Layer.provideMerge(ResourceLive));
47
68
  }));
48
69
  /**
70
+ * Layer that provides an empty OpenTelemetry `Resource`.
71
+ *
72
+ * @category layers
49
73
  * @since 2.0.0
50
- * @category layer
51
74
  */
52
75
  export const layerEmpty = Resource.layerEmpty;
53
76
  //# sourceMappingURL=NodeSdk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NodeSdk.js","names":["NodeTracerProvider","Effect","constant","Layer","isNonEmpty","Logger","Metrics","Resource","Tracer","layerTracerProvider","processor","config","effect","OtelTracerProvider","gen","resource","acquireRelease","sync","provider","undefined","spanProcessors","Array","isArray","promise","forceFlush","then","shutdown","pipe","ignore","interruptible","timeoutOption","shutdownTimeout","layer","evaluate","unwrap","isEffect","ResourceLive","layerFromEnv","configToAttributes","TracerLive","spanProcessor","provide","tracerConfig","empty","MetricsLive","metricReader","temporality","metricTemporality","LoggerLive","logRecordProcessor","mergeWithExisting","loggerMergeWithExisting","layerLoggerProvider","loggerProviderConfig","mergeAll","provideMerge","layerEmpty"],"sources":["../src/NodeSdk.ts"],"sourcesContent":[null],"mappings":"AAOA,SAASA,kBAAkB,QAAQ,+BAA+B;AAGlE,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,QAAQ,QAAsB,iBAAiB;AACxD,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAASC,UAAU,QAAQ,yBAAyB;AACpD,OAAO,KAAKC,MAAM,MAAM,aAAa;AACrC,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AACzC,OAAO,KAAKC,MAAM,MAAM,aAAa;AAsBrC;;;;AAIA,OAAO,MAAMC,mBAAmB,GAAGA,CACjCC,SAA+D,EAC/DC,MAEC,KAEDR,KAAK,CAACS,MAAM,CACVJ,MAAM,CAACK,kBAAkB,EACzBZ,MAAM,CAACa,GAAG,CAAC,aAAS;EAClB,MAAMC,QAAQ,GAAG,OAAOR,QAAQ,CAACA,QAAQ;EACzC,OAAO,OAAON,MAAM,CAACe,cAAc,CACjCf,MAAM,CAACgB,IAAI,CAAC,MAAK;IACf,MAAMC,QAAQ,GAAG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,MAAMC,WAAW,GAAGxC,UAAU,CAACO,MAAM,CAACkC,YAAY,CAAC,GAC/CvC,OAAO,CAAC0B,KAAK,CAAC9B,QAAQ,CAACS,MAAM,CAACkC,YAAY,CAAC,EAAE;IAC7Cd,eAAe,EAAEpB,MAAM,CAACoB,eAAe;IACvCe,WAAW,EAAEnC,MAAM,CAACoC;GACrB,CAAC,GACA5C,KAAK,CAACwC,KAAK;EAEf,MAAMK,UAAU,GAAG5C,UAAU,CAACO,MAAM,CAACsC,kBAAkB,CAAC,GACpD9C,KAAK,CAACsC,OAAO,CACbpC,MAAM,CAAC2B,KAAK,CAAC;IAAEkB,iBAAiB,EAAEvC,MAAM,CAACwC;EAAuB,CAAE,CAAC,EACnE9C,MAAM,CAAC+C,mBAAmB,CAACzC,MAAM,CAACsC,kBAAkB,EAAE;IACpD,GAAGtC,MAAM,CAAC0C,oBAAoB;IAC9BtB,eAAe,EAAEpB,MAAM,CAACoB;GACzB,CAAC,CACH,GACC5B,KAAK,CAACwC,KAAK;EAEf,OAAOxC,KAAK,CAACmD,QAAQ,CAACf,UAAU,EAAEK,WAAW,EAAEI,UAAU,CAAC,CAACrB,IAAI,CAC7DxB,KAAK,CAACoD,YAAY,CAACnB,YAAY,CAAC,CACjC;AACH,CAAC,CAAC,CACH;AAEH;;;;AAIA,OAAO,MAAMoB,UAAU,GAAmCjD,QAAQ,CAACiD,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"NodeSdk.js","names":["NodeTracerProvider","Effect","constant","Layer","isNonEmpty","Logger","Metrics","Resource","Tracer","layerTracerProvider","processor","config","effect","OtelTracerProvider","gen","resource","acquireRelease","sync","provider","undefined","spanProcessors","Array","isArray","promise","forceFlush","then","shutdown","pipe","ignore","interruptible","timeoutOption","shutdownTimeout","layer","evaluate","unwrap","isEffect","ResourceLive","layerFromEnv","configToAttributes","TracerLive","spanProcessor","provide","tracerConfig","empty","MetricsLive","metricReader","temporality","metricTemporality","LoggerLive","logRecordProcessor","mergeWithExisting","loggerMergeWithExisting","layerLoggerProvider","loggerProviderConfig","mergeAll","provideMerge","layerEmpty"],"sources":["../src/NodeSdk.ts"],"sourcesContent":[null],"mappings":"AA6BA,SAASA,kBAAkB,QAAQ,+BAA+B;AAGlE,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,QAAQ,QAAsB,iBAAiB;AACxD,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAASC,UAAU,QAAQ,yBAAyB;AACpD,OAAO,KAAKC,MAAM,MAAM,aAAa;AACrC,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AACzC,OAAO,KAAKC,MAAM,MAAM,aAAa;AAwBrC;;;;;;AAMA,OAAO,MAAMC,mBAAmB,GAAGA,CACjCC,SAA+D,EAC/DC,MAEC,KAEDR,KAAK,CAACS,MAAM,CACVJ,MAAM,CAACK,kBAAkB,EACzBZ,MAAM,CAACa,GAAG,CAAC,aAAS;EAClB,MAAMC,QAAQ,GAAG,OAAOR,QAAQ,CAACA,QAAQ;EACzC,OAAO,OAAON,MAAM,CAACe,cAAc,CACjCf,MAAM,CAACgB,IAAI,CAAC,MAAK;IACf,MAAMC,QAAQ,GAAG,IAAIlB,kBAAkB,CAAC;MACtC,IAAIW,MAAM,IAAIQ,SAAS,CAAC;MACxBJ,QAAQ;MACRK,cAAc,EAAEC,KAAK,CAACC,OAAO,CAACZ,SAAS,CAAC,GAAIA,SAAiB,GAAG,CAACA,SAAS;KAC3E,CAAC;IACF,OAAOQ,QAAQ;EACjB,CAAC,CAAC,EACDA,QAAQ,IACPjB,MAAM,CAACsB,OAAO,CAAC,MAAML,QAAQ,CAACM,UAAU,EAAE,CAACC,IAAI,CAAC,MAAMP,QAAQ,CAACQ,QAAQ,EAAE,CAAC,CAAC,CAACC,IAAI,CAC9E1B,MAAM,CAAC2B,MAAM,EACb3B,MAAM,CAAC4B,aAAa,EACpB5B,MAAM,CAAC6B,aAAa,CAACnB,MA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,EACnE9C,MAAM,CAAC+C,mBAAmB,CAACzC,MAAM,CAACsC,kBAAkB,EAAE;IACpD,GAAGtC,MAAM,CAAC0C,oBAAoB;IAC9BtB,eAAe,EAAEpB,MAAM,CAACoB;GACzB,CAAC,CACH,GACC5B,KAAK,CAACwC,KAAK;EAEf,OAAOxC,KAAK,CAACmD,QAAQ,CAACf,UAAU,EAAEK,WAAW,EAAEI,UAAU,CAAC,CAACrB,IAAI,CAC7DxB,KAAK,CAACoD,YAAY,CAACnB,YAAY,CAAC,CACjC;AACH,CAAC,CAAC,CACH;AAEH;;;;;;AAMA,OAAO,MAAMoB,UAAU,GAAmCjD,QAAQ,CAACiD,UAAU","ignoreList":[]}
@@ -1,20 +1,54 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * OpenTelemetry resource service for Effect telemetry layers.
3
+ *
4
+ * An OpenTelemetry resource identifies the process or service that emits spans,
5
+ * metrics, and logs. This module stores that resource in Effect context so
6
+ * tracer, metric, logger, Node SDK, and Web SDK layers can create providers with
7
+ * consistent service metadata.
8
+ *
9
+ * **Mental model**
10
+ *
11
+ * Resource attributes describe stable producer metadata such as `service.name`,
12
+ * `service.version`, deployment, process, or environment attributes. They are
13
+ * attached to telemetry providers, not to individual spans or log records.
14
+ *
15
+ * **Common tasks**
16
+ *
17
+ * Use `layer` when service metadata is configured in code, `layerFromEnv` when
18
+ * deployment supplies `OTEL_SERVICE_NAME` or `OTEL_RESOURCE_ATTRIBUTES`, and
19
+ * `layerEmpty` for tests or integrations that intentionally provide no resource
20
+ * attributes. `configToAttributes` converts the explicit configuration shape
21
+ * into OpenTelemetry semantic-convention attributes for composition with other
22
+ * resource sources.
23
+ *
24
+ * **Gotchas**
25
+ *
26
+ * `layer` merges custom attributes first and then writes `service.name` and
27
+ * `telemetry.sdk.*`, so those keys are controlled by this package. In
28
+ * `layerFromEnv`, `OTEL_SERVICE_NAME` overrides `service.name` from
29
+ * `OTEL_RESOURCE_ATTRIBUTES`, and any additional attributes passed to the layer
30
+ * are merged last.
31
+ *
32
+ * @since 4.0.0
3
33
  */
4
34
  import type * as OtelApi from "@opentelemetry/api";
5
35
  import * as Resources from "@opentelemetry/resources";
36
+ import * as Context from "effect/Context";
6
37
  import * as Layer from "effect/Layer";
7
- import * as ServiceMap from "effect/ServiceMap";
8
- declare const Resource_base: ServiceMap.ServiceClass<Resource, "@effect/opentelemetry/Resource", Resources.Resource>;
38
+ declare const Resource_base: Context.ServiceClass<Resource, "@effect/opentelemetry/Resource", Resources.Resource>;
9
39
  /**
10
- * @since 1.0.0
11
- * @category Services
40
+ * Context service containing the OpenTelemetry `Resource` associated with emitted telemetry.
41
+ *
42
+ * @category services
43
+ * @since 4.0.0
12
44
  */
13
45
  export declare class Resource extends Resource_base {
14
46
  }
15
47
  /**
16
- * @since 1.0.0
17
- * @category Layers
48
+ * Creates a `Resource` layer from service metadata and additional OpenTelemetry attributes.
49
+ *
50
+ * @category layers
51
+ * @since 4.0.0
18
52
  */
19
53
  export declare const layer: (config: {
20
54
  readonly serviceName: string;
@@ -22,8 +56,30 @@ export declare const layer: (config: {
22
56
  readonly attributes?: OtelApi.Attributes;
23
57
  }) => Layer.Layer<Resource, never, never>;
24
58
  /**
25
- * @since 1.0.0
26
- * @category Configuration
59
+ * Converts resource configuration into OpenTelemetry attributes, adding service name, optional service version, and telemetry SDK metadata.
60
+ *
61
+ * **When to use**
62
+ *
63
+ * Use to turn explicit service metadata into a raw OpenTelemetry attribute map
64
+ * for lower-level resource construction or for merging with environment-derived
65
+ * attributes via `layerFromEnv`.
66
+ *
67
+ * **Details**
68
+ *
69
+ * The returned record copies `attributes` first, then sets `service.name`,
70
+ * `telemetry.sdk.name`, and `telemetry.sdk.language`. `service.version` is
71
+ * included only when `serviceVersion` is provided.
72
+ *
73
+ * **Gotchas**
74
+ *
75
+ * Custom values for `service.name` and `telemetry.sdk.*` are overwritten by this
76
+ * helper. An empty `serviceVersion` is treated as absent.
77
+ *
78
+ * @see {@link layer} for creating a `Resource` layer from explicit metadata
79
+ * @see {@link layerFromEnv} for merging attributes with OpenTelemetry environment variables
80
+ *
81
+ * @category configuration
82
+ * @since 4.0.0
27
83
  */
28
84
  export declare const configToAttributes: (options: {
29
85
  readonly serviceName: string;
@@ -31,13 +87,17 @@ export declare const configToAttributes: (options: {
31
87
  readonly attributes?: OtelApi.Attributes;
32
88
  }) => Record<string, string>;
33
89
  /**
34
- * @since 1.0.0
35
- * @category Layers
90
+ * Creates a `Resource` layer from OpenTelemetry environment variables, optionally merging additional attributes.
91
+ *
92
+ * @category layers
93
+ * @since 4.0.0
36
94
  */
37
95
  export declare const layerFromEnv: (additionalAttributes?: OtelApi.Attributes | undefined) => Layer.Layer<Resource>;
38
96
  /**
39
- * @since 1.0.0
40
- * @category Layers
97
+ * Layer that provides an empty OpenTelemetry resource.
98
+ *
99
+ * @category layers
100
+ * @since 4.0.0
41
101
  */
42
102
  export declare const layerEmpty: Layer.Layer<Resource, never, never>;
43
103
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAA;AAKrD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;;AAE/C;;;GAGG;AACH,qBAAa,QAAS,SAAQ,aAGO;CAAG;AAExC;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,QAAQ;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAA;CACzC,wCAIE,CAAA;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS;IAC1C,QAAQ,CAAC,WAA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AAM,CAaxB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,uBACI,OAAO,CAAC,UAAU,GAClB,SAAS,KACZ,KAAK,CAAC,KAAK,CAAC,QAAQ,CA2BpB,CAAA;AAEH;;;;;GAKG;AACH,eAAO,MAAM,UAAU,qCAGtB,CAAA"}
package/dist/Resource.js CHANGED
@@ -2,22 +2,48 @@ import * as Resources from "@opentelemetry/resources";
2
2
  import * as OtelSemConv from "@opentelemetry/semantic-conventions";
3
3
  import * as Arr from "effect/Array";
4
4
  import * as Config from "effect/Config";
5
+ import * as Context from "effect/Context";
5
6
  import * as Effect from "effect/Effect";
6
7
  import * as Layer from "effect/Layer";
7
- import * as ServiceMap from "effect/ServiceMap";
8
8
  /**
9
- * @since 1.0.0
10
- * @category Services
9
+ * Context service containing the OpenTelemetry `Resource` associated with emitted telemetry.
10
+ *
11
+ * @category services
12
+ * @since 4.0.0
11
13
  */
12
- export class Resource extends /*#__PURE__*/ServiceMap.Service()("@effect/opentelemetry/Resource") {}
14
+ export class Resource extends /*#__PURE__*/Context.Service()("@effect/opentelemetry/Resource") {}
13
15
  /**
14
- * @since 1.0.0
15
- * @category Layers
16
+ * Creates a `Resource` layer from service metadata and additional OpenTelemetry attributes.
17
+ *
18
+ * @category layers
19
+ * @since 4.0.0
16
20
  */
17
21
  export const layer = config => Layer.succeed(Resource, Resources.resourceFromAttributes(configToAttributes(config)));
18
22
  /**
19
- * @since 1.0.0
20
- * @category Configuration
23
+ * Converts resource configuration into OpenTelemetry attributes, adding service name, optional service version, and telemetry SDK metadata.
24
+ *
25
+ * **When to use**
26
+ *
27
+ * Use to turn explicit service metadata into a raw OpenTelemetry attribute map
28
+ * for lower-level resource construction or for merging with environment-derived
29
+ * attributes via `layerFromEnv`.
30
+ *
31
+ * **Details**
32
+ *
33
+ * The returned record copies `attributes` first, then sets `service.name`,
34
+ * `telemetry.sdk.name`, and `telemetry.sdk.language`. `service.version` is
35
+ * included only when `serviceVersion` is provided.
36
+ *
37
+ * **Gotchas**
38
+ *
39
+ * Custom values for `service.name` and `telemetry.sdk.*` are overwritten by this
40
+ * helper. An empty `serviceVersion` is treated as absent.
41
+ *
42
+ * @see {@link layer} for creating a `Resource` layer from explicit metadata
43
+ * @see {@link layerFromEnv} for merging attributes with OpenTelemetry environment variables
44
+ *
45
+ * @category configuration
46
+ * @since 4.0.0
21
47
  */
22
48
  export const configToAttributes = options => {
23
49
  const attributes = {
@@ -32,12 +58,14 @@ export const configToAttributes = options => {
32
58
  return attributes;
33
59
  };
34
60
  /**
35
- * @since 1.0.0
36
- * @category Layers
61
+ * Creates a `Resource` layer from OpenTelemetry environment variables, optionally merging additional attributes.
62
+ *
63
+ * @category layers
64
+ * @since 4.0.0
37
65
  */
38
66
  export const layerFromEnv = additionalAttributes => Layer.effect(Resource, Effect.gen(function* () {
39
67
  const serviceName = yield* Config.option(Config.string("OTEL_SERVICE_NAME"));
40
- const attributes = yield* Config.string("OTEL_RESOURCE_ATTRIBUTES").pipe(Config.withDefault(() => ""), Config.map(s => {
68
+ const attributes = yield* Config.string("OTEL_RESOURCE_ATTRIBUTES").pipe(Config.withDefault(""), Config.map(s => {
41
69
  const attrs = s.split(",");
42
70
  return Arr.reduce(attrs, {}, (acc, attr) => {
43
71
  const parts = attr.split("=");
@@ -57,8 +85,10 @@ export const layerFromEnv = additionalAttributes => Layer.effect(Resource, Effec
57
85
  return Resources.resourceFromAttributes(attributes);
58
86
  }).pipe(Effect.orDie));
59
87
  /**
60
- * @since 1.0.0
61
- * @category Layers
88
+ * Layer that provides an empty OpenTelemetry resource.
89
+ *
90
+ * @category layers
91
+ * @since 4.0.0
62
92
  */
63
93
  export const layerEmpty = /*#__PURE__*/Layer.succeed(Resource, /*#__PURE__*/Resources.emptyResource());
64
94
  //# sourceMappingURL=Resource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Resource.js","names":["Resources","OtelSemConv","Arr","Config","Effect","Layer","ServiceMap","Resource","Service","layer","config","succeed","resourceFromAttributes","configToAttributes","options","attributes","undefined","ATTR_SERVICE_NAME","serviceName","ATTR_TELEMETRY_SDK_NAME","ATTR_TELEMETRY_SDK_LANGUAGE","globalThis","document","TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS","TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS","serviceVersion","ATTR_SERVICE_VERSION","layerFromEnv","additionalAttributes","effect","gen","option","string","pipe","withDefault","map","s","attrs","split","reduce","acc","attr","parts","length","trim","_tag","value","Object","assign","orDie","layerEmpty","emptyResource"],"sources":["../src/Resource.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,SAAS,MAAM,0BAA0B;AACrD,OAAO,KAAKC,WAAW,MAAM,qCAAqC;AAClE,OAAO,KAAKC,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAE/C;;;;AAIA,OAAM,MAAOC,QAAS,sBAAQD,UAAU,CAACE,OAAO,EAG7C,CAAC,gCAAgC,CAAC;AAErC;;;;AAIA,OAAO,MAAMC,KAAK,GAAIC,MAIrB,IACCL,KAAK,CAACM,OAAO,CACXJ,QAAQ,EACRP,SAAS,CAACY,sBAAsB,CAACC,kBAAkB,CAACH,MAAM,CAAC,CAAC,CAC7D;AAEH;;;;AAIA,OAAO,MAAMG,kBAAkB,GAAIC,OAIlC,IAA4B;EAC3B,MAAMC,UAAU,GAA2B;IACzC,IAAID,OAAO,CAACC,UAAU,IAAIC,SAAS,CAAC;IACpC,CAACf,WAAW,CAACgB,iBAAiB,GAAGH,OAAO,CAACI,WAAW;IACpD,CAACjB,WAAW,CAACkB,uBAAuB,GAAG,uBAAuB;IAC9D,CAAClB,WAAW,CAACmB,2BAA2B,GAAG,OAAQC,UAAkB,CAACC,QAAQ,KAAK,WAAW,GAC1FrB,WAAW,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,IAAIlB,oBAAoB,EAAE;IACxBmB,MAAM,CAACC,MAAM,CAACjC,UAAU,EAAEa,oBAAoB,CAAC;EACjD;EACA,OAAO5B,SAAS,CAACY,sBAAsB,CAACG,UAAU,CAAC;AACrD,CAAC,CAAC,CAACkB,IAAI,CAAC7B,MAAM,CAAC6C,KAAK,CAAC,CACtB;AAEH;;;;AAIA,OAAO,MAAMC,UAAU,gBAAG7C,KAAK,CAACM,OAAO,CACrCJ,QAAQ,eACRP,SAAS,CAACmD,aAAa,EAAE,CAC1B","ignoreList":[]}
1
+ {"version":3,"file":"Resource.js","names":["Resources","OtelSemConv","Arr","Config","Context","Effect","Layer","Resource","Service","layer","config","succeed","resourceFromAttributes","configToAttributes","options","attributes","undefined","ATTR_SERVICE_NAME","serviceName","ATTR_TELEMETRY_SDK_NAME","ATTR_TELEMETRY_SDK_LANGUAGE","globalThis","document","TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS","TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS","serviceVersion","ATTR_SERVICE_VERSION","layerFromEnv","additionalAttributes","effect","gen","option","string","pipe","withDefault","map","s","attrs","split","reduce","acc","attr","parts","length","trim","_tag","value","Object","assign","orDie","layerEmpty","emptyResource"],"sources":["../src/Resource.ts"],"sourcesContent":[null],"mappings":"AAkCA,OAAO,KAAKA,SAAS,MAAM,0BAA0B;AACrD,OAAO,KAAKC,WAAW,MAAM,qCAAqC;AAClE,OAAO,KAAKC,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAErC;;;;;;AAMA,OAAM,MAAOC,QAAS,sBAAQH,OAAO,CAACI,OAAO,EAG1C,CAAC,gCAAgC,CAAC;AAErC;;;;;;AAMA,OAAO,MAAMC,KAAK,GAAIC,MAIrB,IACCJ,KAAK,CAACK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