@effect/opentelemetry 4.0.0-beta.70 → 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/src/Logger.ts CHANGED
@@ -1,24 +1,35 @@
1
1
  /**
2
- * Connects Effect's logging system to the OpenTelemetry Logs SDK.
3
- *
4
- * This module provides a logger provider service, an Effect `Logger` that
5
- * emits OpenTelemetry log records, and layers for installing that logger in an
6
- * application. It is commonly used to send Effect logs to OTLP, console, or
7
- * vendor-specific exporters through OpenTelemetry `LogRecordProcessor`s while
8
- * keeping logs correlated with Effect fibers and spans. Emitted records include
9
- * the current fiber id, span identifiers when a parent span is present, log
10
- * annotations, log spans, severity text, and the matching OpenTelemetry
11
- * severity number.
12
- *
13
- * Log export depends on the configured OpenTelemetry processors and exporters;
14
- * this module creates the provider and logger, but does not choose an exporter.
15
- * Use the `Resource` layer to attach service and deployment metadata to the
16
- * provider rather than repeating that data on every log record. When using
17
- * `layerLoggerProvider`, the provider is scoped and is force-flushed and shut
18
- * down when the layer is released, with a configurable shutdown timeout. If you
19
- * supply or manage an OpenTelemetry provider yourself, make sure it is flushed
20
- * and shut down during application shutdown, especially when using batching
21
- * processors that may otherwise drop buffered logs.
2
+ * Connects Effect logging to the OpenTelemetry Logs SDK.
3
+ *
4
+ * This module turns Effect log events into OpenTelemetry log records. It
5
+ * provides the `OtelLoggerProvider` service, a `Logger` implementation created
6
+ * by {@link make}, a {@link layer} that installs it into Effect logging, and
7
+ * {@link layerLoggerProvider} for creating a scoped SDK `LoggerProvider` from
8
+ * one or more `LogRecordProcessor`s.
9
+ *
10
+ * **Mental model**
11
+ *
12
+ * Effect decides when a log is emitted and supplies the message, fiber id, log
13
+ * level, annotations, log spans, and active parent span. This module maps that
14
+ * data into an OpenTelemetry log record, including severity text/number, trace
15
+ * and span identifiers when available, and timestamps from the Effect `Clock`.
16
+ *
17
+ * **Common tasks**
18
+ *
19
+ * Use {@link layerLoggerProvider} when the application wants this package to own
20
+ * the OpenTelemetry logger provider lifecycle. Provide it with processors such
21
+ * as OTLP, console, or vendor-specific exporters, then install {@link layer} so
22
+ * regular Effect logging emits records through that provider. If the provider is
23
+ * created elsewhere, supply `OtelLoggerProvider` yourself and still use
24
+ * {@link layer} or {@link make}.
25
+ *
26
+ * **Gotchas**
27
+ *
28
+ * This module does not choose an exporter. Export behavior, batching, retries,
29
+ * and delivery guarantees come from the configured OpenTelemetry processors.
30
+ * The scoped provider is force-flushed and shut down when the layer is released,
31
+ * using the configured shutdown timeout; externally managed providers should be
32
+ * flushed and shut down by the owner to avoid dropping buffered logs.
22
33
  *
23
34
  * @since 4.0.0
24
35
  */
@@ -134,6 +145,20 @@ export const make: Effect.Effect<
134
145
  /**
135
146
  * Creates a layer that installs the OpenTelemetry-backed Effect logger, merging with existing loggers by default.
136
147
  *
148
+ * **When to use**
149
+ *
150
+ * Use to install the OpenTelemetry-backed Effect logger in an application that
151
+ * has an `OtelLoggerProvider`, so standard Effect logging emits OpenTelemetry
152
+ * log records.
153
+ *
154
+ * **Details**
155
+ *
156
+ * The layer installs the logger created by `make`. `mergeWithExisting` defaults
157
+ * to `true`; set it to `false` to replace the current logger set.
158
+ *
159
+ * @see {@link make} for constructing the logger directly
160
+ * @see {@link layerLoggerProvider} for creating the required logger provider
161
+ *
137
162
  * @category layers
138
163
  * @since 4.0.0
139
164
  */
package/src/Metrics.ts CHANGED
@@ -1,19 +1,35 @@
1
1
  /**
2
- * Bridges Effect metrics into OpenTelemetry by exposing the current Effect
3
- * metric snapshot as an OpenTelemetry `MetricProducer` and registering it with
4
- * one or more SDK `MetricReader`s. Use this module when an application already
5
- * records metrics with Effect and needs those counters, gauges, histograms,
6
- * frequencies, or summaries exported through OTLP, Prometheus, or another
7
- * OpenTelemetry-compatible reader/exporter.
8
- *
9
- * The `layer` constructor is the usual entry point, and is also used by the
10
- * Node and Web SDK layers when `metricReader` configuration is supplied. Metric
11
- * readers are acquired inside the layer scope and shut down when the scope is
12
- * released, so periodic exporters need the runtime to stay alive long enough to
13
- * collect and export data. The exporter or backend determines whether
14
- * cumulative or delta aggregation is expected; this module defaults to
15
- * cumulative temporality and can be configured with `temporality: "delta"` for
16
- * backends that require interval-based values.
2
+ * OpenTelemetry metric export bridge for Effect metrics.
3
+ *
4
+ * Effect applications record metrics through Effect's metric APIs. This module
5
+ * exposes the current Effect metric snapshot as an OpenTelemetry
6
+ * `MetricProducer` and registers it with SDK `MetricReader`s so existing
7
+ * OpenTelemetry exporters can deliver those metrics to OTLP, Prometheus, or
8
+ * vendor backends.
9
+ *
10
+ * **Mental model**
11
+ *
12
+ * {@link makeProducer} captures the current Effect context and `Resource` and
13
+ * builds a producer that OpenTelemetry readers can pull from.
14
+ * {@link registerProducer} attaches that producer to one or more readers for
15
+ * the lifetime of a scope. {@link layer} composes both steps and is the path
16
+ * used by the Node and Web SDK layers when metric readers are configured.
17
+ *
18
+ * **Common tasks**
19
+ *
20
+ * - Install Effect metrics into OpenTelemetry with {@link layer}
21
+ * - Build a producer manually with {@link makeProducer}
22
+ * - Attach an existing producer to readers with {@link registerProducer}
23
+ * - Choose cumulative or delta export with {@link TemporalityPreference}
24
+ *
25
+ * **Gotchas**
26
+ *
27
+ * Readers are shut down when the layer scope closes, so periodic exporters need
28
+ * the application runtime to stay alive long enough for collection and export.
29
+ * This module defaults to cumulative temporality; configure
30
+ * `temporality: "delta"` only when the backend expects interval values. Export
31
+ * protocol, batching, and delivery behavior come from the OpenTelemetry
32
+ * reader/exporter, not from this bridge.
17
33
  *
18
34
  * @since 4.0.0
19
35
  */
@@ -46,6 +62,20 @@ export type TemporalityPreference = "cumulative" | "delta"
46
62
  /**
47
63
  * Creates an OpenTelemetry metric producer from Effect metrics.
48
64
  *
65
+ * **When to use**
66
+ *
67
+ * Use to create a `MetricProducer` when you need to wire Effect metrics into
68
+ * OpenTelemetry manually instead of using the scoped `layer` helper.
69
+ *
70
+ * **Details**
71
+ *
72
+ * Requires the current OpenTelemetry `Resource`, captures the current Effect
73
+ * context, and uses cumulative temporality by default. Pass `"delta"` for
74
+ * interval-based values.
75
+ *
76
+ * @see {@link registerProducer} for attaching a producer to metric readers
77
+ * @see {@link layer} for creating and registering a producer in a scoped layer
78
+ *
49
79
  * @category constructors
50
80
  * @since 4.0.0
51
81
  */
package/src/NodeSdk.ts CHANGED
@@ -99,6 +99,23 @@ export const layerTracerProvider = (
99
99
  /**
100
100
  * Creates a Node OpenTelemetry layer from configuration, enabling tracing, metrics, and logging only when their processors or readers are supplied.
101
101
  *
102
+ * **When to use**
103
+ *
104
+ * Use to install OpenTelemetry support for a Node.js Effect application from
105
+ * one configuration object, enabling tracing, metrics, logging, or any
106
+ * combination of those signals based on the processors and readers supplied.
107
+ *
108
+ * **Details**
109
+ *
110
+ * The configuration can be provided lazily or effectfully. The layer always
111
+ * provides `Resource.Resource`, building it from environment variables and any
112
+ * explicit resource metadata in the configuration.
113
+ *
114
+ * **Gotchas**
115
+ *
116
+ * Register Node auto-instrumentations before importing modules that should be
117
+ * patched, because many Node instrumentations hook module loading.
118
+ *
102
119
  * @category layers
103
120
  * @since 4.0.0
104
121
  */
@@ -106,6 +123,23 @@ export const layer: {
106
123
  /**
107
124
  * Creates a Node OpenTelemetry layer from configuration, enabling tracing, metrics, and logging only when their processors or readers are supplied.
108
125
  *
126
+ * **When to use**
127
+ *
128
+ * Use to install OpenTelemetry support for a Node.js Effect application from
129
+ * one configuration object, enabling tracing, metrics, logging, or any
130
+ * combination of those signals based on the processors and readers supplied.
131
+ *
132
+ * **Details**
133
+ *
134
+ * The configuration can be provided lazily or effectfully. The layer always
135
+ * provides `Resource.Resource`, building it from environment variables and any
136
+ * explicit resource metadata in the configuration.
137
+ *
138
+ * **Gotchas**
139
+ *
140
+ * Register Node auto-instrumentations before importing modules that should be
141
+ * patched, because many Node instrumentations hook module loading.
142
+ *
109
143
  * @category layers
110
144
  * @since 4.0.0
111
145
  */
@@ -113,6 +147,23 @@ export const layer: {
113
147
  /**
114
148
  * Creates a Node OpenTelemetry layer from configuration, enabling tracing, metrics, and logging only when their processors or readers are supplied.
115
149
  *
150
+ * **When to use**
151
+ *
152
+ * Use to install OpenTelemetry support for a Node.js Effect application from
153
+ * one configuration object, enabling tracing, metrics, logging, or any
154
+ * combination of those signals based on the processors and readers supplied.
155
+ *
156
+ * **Details**
157
+ *
158
+ * The configuration can be provided lazily or effectfully. The layer always
159
+ * provides `Resource.Resource`, building it from environment variables and any
160
+ * explicit resource metadata in the configuration.
161
+ *
162
+ * **Gotchas**
163
+ *
164
+ * Register Node auto-instrumentations before importing modules that should be
165
+ * patched, because many Node instrumentations hook module loading.
166
+ *
116
167
  * @category layers
117
168
  * @since 4.0.0
118
169
  */
package/src/Resource.ts CHANGED
@@ -1,20 +1,33 @@
1
1
  /**
2
- * Provides the OpenTelemetry resource used by the Effect OpenTelemetry layers.
3
- *
4
- * A resource describes the entity that produces telemetry, such as a service,
5
- * process, deployment, or browser application. The tracing, metrics, logging,
6
- * and SDK layers use this module's `Resource` service to configure providers
7
- * and identify emitted telemetry with service-level metadata.
8
- *
9
- * Use `layer` when service metadata is known in code, `layerFromEnv` when
10
- * deploying with `OTEL_SERVICE_NAME` and `OTEL_RESOURCE_ATTRIBUTES`, and
11
- * `layerEmpty` when no resource attributes should be provided. Resource
12
- * attributes are for stable process or service metadata, not per-span or
13
- * per-log data. The explicit `layer` helper sets `service.name` and the
14
- * `telemetry.sdk.*` attributes after merging custom attributes, so those keys
15
- * are controlled by this integration. With `layerFromEnv`, `OTEL_SERVICE_NAME`
16
- * overrides `service.name` from `OTEL_RESOURCE_ATTRIBUTES`, and additional
17
- * attributes passed to the layer are merged last.
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.
18
31
  *
19
32
  * @since 4.0.0
20
33
  */
@@ -57,6 +70,26 @@ export const layer = (config: {
57
70
  /**
58
71
  * Converts resource configuration into OpenTelemetry attributes, adding service name, optional service version, and telemetry SDK metadata.
59
72
  *
73
+ * **When to use**
74
+ *
75
+ * Use to turn explicit service metadata into a raw OpenTelemetry attribute map
76
+ * for lower-level resource construction or for merging with environment-derived
77
+ * attributes via `layerFromEnv`.
78
+ *
79
+ * **Details**
80
+ *
81
+ * The returned record copies `attributes` first, then sets `service.name`,
82
+ * `telemetry.sdk.name`, and `telemetry.sdk.language`. `service.version` is
83
+ * included only when `serviceVersion` is provided.
84
+ *
85
+ * **Gotchas**
86
+ *
87
+ * Custom values for `service.name` and `telemetry.sdk.*` are overwritten by this
88
+ * helper. An empty `serviceVersion` is treated as absent.
89
+ *
90
+ * @see {@link layer} for creating a `Resource` layer from explicit metadata
91
+ * @see {@link layerFromEnv} for merging attributes with OpenTelemetry environment variables
92
+ *
60
93
  * @category configuration
61
94
  * @since 4.0.0
62
95
  */
package/src/Tracer.ts CHANGED
@@ -222,6 +222,16 @@ export const layerWithoutOtelTracer: Layer.Layer<never, never, OtelTracer> = Lay
222
222
  /**
223
223
  * Layer that creates an OpenTelemetry tracer from a provider and resource, then installs it as the Effect tracer.
224
224
  *
225
+ * **When to use**
226
+ *
227
+ * Use when your application already supplies an `OtelTracerProvider` and a
228
+ * `Resource`, and you want Effect spans to be created by an OpenTelemetry
229
+ * tracer derived from those services.
230
+ *
231
+ * @see {@link layerTracer} for creating only the OpenTelemetry tracer service
232
+ * @see {@link layerGlobal} for installing the Effect tracer from the global provider
233
+ * @see {@link layerWithoutOtelTracer} for installing an already-provided `OtelTracer`
234
+ *
225
235
  * @category layers
226
236
  * @since 4.0.0
227
237
  */
@@ -348,7 +358,7 @@ const convertOtelTimeInput = (input: Otel.TimeInput | undefined, clock: Clock.Cl
348
358
  *
349
359
  * **When to use**
350
360
  *
351
- * Use this when OpenTelemetry instrumentation outside Effect has already
361
+ * Use when OpenTelemetry instrumentation outside Effect has already
352
362
  * produced a parent span context and an effect should continue that trace.
353
363
  *
354
364
  * @category propagation
@@ -360,7 +370,7 @@ export const withSpanContext: {
360
370
  *
361
371
  * **When to use**
362
372
  *
363
- * Use this when OpenTelemetry instrumentation outside Effect has already
373
+ * Use when OpenTelemetry instrumentation outside Effect has already
364
374
  * produced a parent span context and an effect should continue that trace.
365
375
  *
366
376
  * @category propagation
@@ -374,7 +384,7 @@ export const withSpanContext: {
374
384
  *
375
385
  * **When to use**
376
386
  *
377
- * Use this when OpenTelemetry instrumentation outside Effect has already
387
+ * Use when OpenTelemetry instrumentation outside Effect has already
378
388
  * produced a parent span context and an effect should continue that trace.
379
389
  *
380
390
  * @category propagation
package/src/WebSdk.ts CHANGED
@@ -97,6 +97,25 @@ export const layerTracerProvider = (
97
97
  /**
98
98
  * Creates a Web OpenTelemetry layer from configuration, providing the resource and enabling tracing, metrics, and logging when configured.
99
99
  *
100
+ * **When to use**
101
+ *
102
+ * Use to install browser OpenTelemetry support for an Effect application when
103
+ * service metadata is provided in code and tracing, metrics, or logging should
104
+ * be enabled from supplied span processors, metric readers, or log record
105
+ * processors.
106
+ *
107
+ * **Details**
108
+ *
109
+ * The configuration can be provided lazily or effectfully. The layer always
110
+ * provides `Resource.Resource`; tracing, metrics, and logging are installed only
111
+ * when the corresponding processors or readers are non-empty.
112
+ *
113
+ * **Gotchas**
114
+ *
115
+ * Browser resource metadata is explicit; this layer does not read
116
+ * OpenTelemetry environment variables. Empty processor or reader arrays are
117
+ * treated as not configured.
118
+ *
100
119
  * @category layers
101
120
  * @since 4.0.0
102
121
  */
@@ -104,6 +123,25 @@ export const layer: {
104
123
  /**
105
124
  * Creates a Web OpenTelemetry layer from configuration, providing the resource and enabling tracing, metrics, and logging when configured.
106
125
  *
126
+ * **When to use**
127
+ *
128
+ * Use to install browser OpenTelemetry support for an Effect application when
129
+ * service metadata is provided in code and tracing, metrics, or logging should
130
+ * be enabled from supplied span processors, metric readers, or log record
131
+ * processors.
132
+ *
133
+ * **Details**
134
+ *
135
+ * The configuration can be provided lazily or effectfully. The layer always
136
+ * provides `Resource.Resource`; tracing, metrics, and logging are installed only
137
+ * when the corresponding processors or readers are non-empty.
138
+ *
139
+ * **Gotchas**
140
+ *
141
+ * Browser resource metadata is explicit; this layer does not read
142
+ * OpenTelemetry environment variables. Empty processor or reader arrays are
143
+ * treated as not configured.
144
+ *
107
145
  * @category layers
108
146
  * @since 4.0.0
109
147
  */
@@ -111,6 +149,25 @@ export const layer: {
111
149
  /**
112
150
  * Creates a Web OpenTelemetry layer from configuration, providing the resource and enabling tracing, metrics, and logging when configured.
113
151
  *
152
+ * **When to use**
153
+ *
154
+ * Use to install browser OpenTelemetry support for an Effect application when
155
+ * service metadata is provided in code and tracing, metrics, or logging should
156
+ * be enabled from supplied span processors, metric readers, or log record
157
+ * processors.
158
+ *
159
+ * **Details**
160
+ *
161
+ * The configuration can be provided lazily or effectfully. The layer always
162
+ * provides `Resource.Resource`; tracing, metrics, and logging are installed only
163
+ * when the corresponding processors or readers are non-empty.
164
+ *
165
+ * **Gotchas**
166
+ *
167
+ * Browser resource metadata is explicit; this layer does not read
168
+ * OpenTelemetry environment variables. Empty processor or reader arrays are
169
+ * treated as not configured.
170
+ *
114
171
  * @category layers
115
172
  * @since 4.0.0
116
173
  */
package/src/index.ts CHANGED
@@ -5,150 +5,31 @@
5
5
  // @barrel: Auto-generated exports. Do not edit manually.
6
6
 
7
7
  /**
8
- * Connects Effect's logging system to the OpenTelemetry Logs SDK.
9
- *
10
- * This module provides a logger provider service, an Effect `Logger` that
11
- * emits OpenTelemetry log records, and layers for installing that logger in an
12
- * application. It is commonly used to send Effect logs to OTLP, console, or
13
- * vendor-specific exporters through OpenTelemetry `LogRecordProcessor`s while
14
- * keeping logs correlated with Effect fibers and spans. Emitted records include
15
- * the current fiber id, span identifiers when a parent span is present, log
16
- * annotations, log spans, severity text, and the matching OpenTelemetry
17
- * severity number.
18
- *
19
- * Log export depends on the configured OpenTelemetry processors and exporters;
20
- * this module creates the provider and logger, but does not choose an exporter.
21
- * Use the `Resource` layer to attach service and deployment metadata to the
22
- * provider rather than repeating that data on every log record. When using
23
- * `layerLoggerProvider`, the provider is scoped and is force-flushed and shut
24
- * down when the layer is released, with a configurable shutdown timeout. If you
25
- * supply or manage an OpenTelemetry provider yourself, make sure it is flushed
26
- * and shut down during application shutdown, especially when using batching
27
- * processors that may otherwise drop buffered logs.
28
- *
29
8
  * @since 4.0.0
30
9
  */
31
10
  export * as Logger from "./Logger.ts"
32
11
 
33
12
  /**
34
- * Bridges Effect metrics into OpenTelemetry by exposing the current Effect
35
- * metric snapshot as an OpenTelemetry `MetricProducer` and registering it with
36
- * one or more SDK `MetricReader`s. Use this module when an application already
37
- * records metrics with Effect and needs those counters, gauges, histograms,
38
- * frequencies, or summaries exported through OTLP, Prometheus, or another
39
- * OpenTelemetry-compatible reader/exporter.
40
- *
41
- * The `layer` constructor is the usual entry point, and is also used by the
42
- * Node and Web SDK layers when `metricReader` configuration is supplied. Metric
43
- * readers are acquired inside the layer scope and shut down when the scope is
44
- * released, so periodic exporters need the runtime to stay alive long enough to
45
- * collect and export data. The exporter or backend determines whether
46
- * cumulative or delta aggregation is expected; this module defaults to
47
- * cumulative temporality and can be configured with `temporality: "delta"` for
48
- * backends that require interval-based values.
49
- *
50
13
  * @since 4.0.0
51
14
  */
52
15
  export * as Metrics from "./Metrics.ts"
53
16
 
54
17
  /**
55
- * Provides an Effect layer for configuring OpenTelemetry in Node.js
56
- * processes. The module wires the Effect tracer, metrics producer, and logger
57
- * into OpenTelemetry SDK providers when span processors, metric readers, or log
58
- * record processors are supplied, and it builds the shared resource from
59
- * `OTEL_SERVICE_NAME`, `OTEL_RESOURCE_ATTRIBUTES`, and optional explicit
60
- * service metadata.
61
- *
62
- * Use this module in Node services, workers, CLIs, or server runtimes that need
63
- * Effect spans, metrics, and logs exported through OpenTelemetry processors and
64
- * exporters. Telemetry is enabled only for the configured signal types, so an
65
- * application can install tracing alone, metrics alone, logging alone, or any
66
- * combination of them from the same layer.
67
- *
68
- * The layer is scoped. Tracer and logger providers are force-flushed and shut
69
- * down when the scope is released, metric readers are shut down with the same
70
- * lifecycle, and all shutdown waits are bounded by `shutdownTimeout` with a
71
- * default of three seconds. Keep the layer scope alive for the lifetime of the
72
- * process and release it during graceful shutdown so batched exporters have a
73
- * chance to export final telemetry. When combining this layer with Node
74
- * auto-instrumentations, register instrumentation before importing modules that
75
- * should be patched, because many Node instrumentations hook module loading.
76
- *
77
18
  * @since 4.0.0
78
19
  */
79
20
  export * as NodeSdk from "./NodeSdk.ts"
80
21
 
81
22
  /**
82
- * Provides the OpenTelemetry resource used by the Effect OpenTelemetry layers.
83
- *
84
- * A resource describes the entity that produces telemetry, such as a service,
85
- * process, deployment, or browser application. The tracing, metrics, logging,
86
- * and SDK layers use this module's `Resource` service to configure providers
87
- * and identify emitted telemetry with service-level metadata.
88
- *
89
- * Use `layer` when service metadata is known in code, `layerFromEnv` when
90
- * deploying with `OTEL_SERVICE_NAME` and `OTEL_RESOURCE_ATTRIBUTES`, and
91
- * `layerEmpty` when no resource attributes should be provided. Resource
92
- * attributes are for stable process or service metadata, not per-span or
93
- * per-log data. The explicit `layer` helper sets `service.name` and the
94
- * `telemetry.sdk.*` attributes after merging custom attributes, so those keys
95
- * are controlled by this integration. With `layerFromEnv`, `OTEL_SERVICE_NAME`
96
- * overrides `service.name` from `OTEL_RESOURCE_ATTRIBUTES`, and additional
97
- * attributes passed to the layer are merged last.
98
- *
99
23
  * @since 4.0.0
100
24
  */
101
25
  export * as Resource from "./Resource.ts"
102
26
 
103
27
  /**
104
- * Bridges Effect tracing into OpenTelemetry by installing an Effect `Tracer`
105
- * that creates OpenTelemetry spans, records attributes, events, links, errors,
106
- * and status, and keeps OpenTelemetry context active while traced effects run.
107
- * Use this module when an application already has an OpenTelemetry
108
- * `TracerProvider`, or when the Node and Web SDK layers should expose Effect
109
- * spans to OTLP, console, or other OpenTelemetry-compatible exporters.
110
- *
111
- * The layer constructors wire Effect's tracer service to either the global
112
- * OpenTelemetry tracer provider or an explicitly provided `OtelTracer`. This
113
- * module does not create exporters or span processors by itself, so spans are
114
- * exported only when the provider has been configured by the application or by
115
- * the Node/Web SDK layers. Parentage is taken from Effect spans first and can
116
- * also attach to the active OpenTelemetry context, while `makeExternalSpan` and
117
- * `withSpanContext` are the entry points for continuing an incoming remote
118
- * trace. Preserve `traceFlags` and `traceState` when building external spans;
119
- * otherwise sampling defaults to sampled and trace state cannot be propagated.
120
- *
121
28
  * @since 4.0.0
122
29
  */
123
30
  export * as Tracer from "./Tracer.ts"
124
31
 
125
32
  /**
126
- * Provides an Effect layer for configuring OpenTelemetry in browser
127
- * applications. The module builds a shared resource from explicit service
128
- * metadata and wires Effect tracing, metrics, and logging into OpenTelemetry
129
- * SDK providers when span processors, metric readers, or log record processors
130
- * are supplied.
131
- *
132
- * Use this module in client-side applications that need Effect spans, metrics,
133
- * and logs exported from browser runtimes, such as single-page apps,
134
- * multi-page apps with hydrated Effect code, frontend workers, or UI flows
135
- * that should be correlated with backend traces. Telemetry is enabled only for
136
- * the configured signal types, so tracing, metrics, and logging can be
137
- * installed independently from the same layer.
138
- *
139
- * Browser SDKs cannot rely on process environment resource configuration, so
140
- * provide stable service metadata explicitly and use resource attributes for
141
- * application, release, deployment, or page-shell identity rather than
142
- * per-event data. This module does not create exporters; supply
143
- * browser-compatible processors, readers, and exporters yourself, and make sure
144
- * their endpoints are reachable from the browser with the required CORS and
145
- * authentication behavior. The layer is scoped: tracer providers are
146
- * force-flushed and shut down when the scope is released, while metric readers
147
- * and logger providers follow their respective layer lifecycles. Keep the
148
- * scope alive for the lifetime of the browser application and release it during
149
- * application teardown when possible so batched exporters and periodic metric
150
- * readers can deliver buffered telemetry before the page is unloaded.
151
- *
152
33
  * @since 4.0.0
153
34
  */
154
35
  export * as WebSdk from "./WebSdk.ts"