@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/Logger.d.ts CHANGED
@@ -1,32 +1,105 @@
1
1
  /**
2
- * @since 1.0.0
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.
33
+ *
34
+ * @since 4.0.0
3
35
  */
36
+ import { SeverityNumber } from "@opentelemetry/api-logs";
4
37
  import * as Otel from "@opentelemetry/sdk-logs";
5
38
  import type { NonEmptyReadonlyArray } from "effect/Array";
39
+ import * as Context from "effect/Context";
6
40
  import type * as Duration from "effect/Duration";
7
41
  import * as Effect from "effect/Effect";
8
42
  import * as Layer from "effect/Layer";
9
43
  import * as Logger from "effect/Logger";
10
- import * as ServiceMap from "effect/ServiceMap";
44
+ import type * as LogLevel from "effect/LogLevel";
11
45
  import { Resource } from "./Resource.ts";
12
- declare const OtelLoggerProvider_base: ServiceMap.ServiceClass<OtelLoggerProvider, "@effect/opentelemetry/Logger/OtelLoggerProvider", Otel.LoggerProvider>;
46
+ declare const OtelLoggerProvider_base: Context.ServiceClass<OtelLoggerProvider, "@effect/opentelemetry/Logger/OtelLoggerProvider", Otel.LoggerProvider>;
13
47
  /**
14
- * @since 1.0.0
15
- * @category Services
48
+ * Context service containing the OpenTelemetry `LoggerProvider` used to emit Effect log records.
49
+ *
50
+ * @category services
51
+ * @since 4.0.0
16
52
  */
17
53
  export declare class OtelLoggerProvider extends OtelLoggerProvider_base {
18
54
  }
19
55
  /**
20
- * @since 1.0.0
21
- * @category Constructors
56
+ * Maps an Effect `LogLevel` to the corresponding OpenTelemetry `SeverityNumber`.
57
+ *
58
+ * **Details**
59
+ *
60
+ * OpenTelemetry log severity numbers are in the range `1` through `24`. This
61
+ * function maps from Effect's log levels instead of using
62
+ * `LogLevel.getOrdinal`, whose internal sort ordinals, such as the `Info`
63
+ * ordinal `20000`, fall outside the OpenTelemetry logs data model and can be
64
+ * treated as `UNSPECIFIED` by validating backends.
65
+ *
66
+ * @category converting
67
+ * @since 4.0.0
68
+ */
69
+ export declare const logLevelToSeverityNumber: (level: LogLevel.LogLevel) => SeverityNumber;
70
+ /**
71
+ * Creates an Effect logger that emits log records through the configured OpenTelemetry logger provider.
72
+ *
73
+ * @category constructors
74
+ * @since 4.0.0
22
75
  */
23
76
  export declare const make: Effect.Effect<Logger.Logger<unknown, void>, never, OtelLoggerProvider>;
24
77
  /**
25
- * @since 1.0.0
26
- * @category Layers
78
+ * Creates a layer that installs the OpenTelemetry-backed Effect logger, merging with existing loggers by default.
79
+ *
80
+ * **When to use**
81
+ *
82
+ * Use to install the OpenTelemetry-backed Effect logger in an application that
83
+ * has an `OtelLoggerProvider`, so standard Effect logging emits OpenTelemetry
84
+ * log records.
85
+ *
86
+ * **Details**
87
+ *
88
+ * The layer installs the logger created by `make`. `mergeWithExisting` defaults
89
+ * to `true`; set it to `false` to replace the current logger set.
90
+ *
91
+ * @see {@link make} for constructing the logger directly
92
+ * @see {@link layerLoggerProvider} for creating the required logger provider
93
+ *
94
+ * @category layers
95
+ * @since 4.0.0
27
96
  */
28
97
  export declare const layer: (options: {
29
98
  /**
99
+ * Whether to merge the OpenTelemetry logger with existing loggers.
100
+ *
101
+ * **Details**
102
+ *
30
103
  * If set to `true`, the OpenTelemetry logger will be merged with existing
31
104
  * loggers in the application.
32
105
  *
@@ -38,8 +111,10 @@ export declare const layer: (options: {
38
111
  readonly mergeWithExisting?: boolean | undefined;
39
112
  }) => Layer.Layer<never, never, OtelLoggerProvider>;
40
113
  /**
41
- * @since 1.0.0
42
- * @category Layers
114
+ * Creates a scoped OpenTelemetry logger provider from one or more log record processors, using the current `Resource` and flushing and shutting down the provider when the layer is released.
115
+ *
116
+ * @category layers
117
+ * @since 4.0.0
43
118
  */
44
119
  export declare const layerLoggerProvider: (processor: Otel.LogRecordProcessor | NonEmptyReadonlyArray<Otel.LogRecordProcessor>, config?: Omit<Otel.LoggerProviderConfig, "resource"> & {
45
120
  readonly shutdownTimeout?: Duration.Input | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../src/Logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,IAAI,MAAM,yBAAyB,CAAA;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAGzD,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;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ects 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.
33
+ *
34
+ * @since 4.0.0
3
35
  */
36
+ import { SeverityNumber } from "@opentelemetry/api-logs";
4
37
  import * as Otel from "@opentelemetry/sdk-logs";
5
38
  import * as Arr from "effect/Array";
6
39
  import * as Clock from "effect/Clock";
40
+ import * as Context from "effect/Context";
7
41
  import * as Effect from "effect/Effect";
8
42
  import * as Layer from "effect/Layer";
9
43
  import * as Logger from "effect/Logger";
10
- import * as LogLevel from "effect/LogLevel";
11
44
  import * as Predicate from "effect/Predicate";
12
- import * as ServiceMap from "effect/ServiceMap";
45
+ import * as References from "effect/References";
13
46
  import * as Tracer from "effect/Tracer";
14
- import { unknownToAttributeValue } from "./internal/attributes.js";
47
+ import { nanosToHrTime, unknownToAttributeValue } from "./internal/attributes.js";
15
48
  import { Resource } from "./Resource.js";
16
49
  /**
17
- * @since 1.0.0
18
- * @category Services
50
+ * Context service containing the OpenTelemetry `LoggerProvider` used to emit Effect log records.
51
+ *
52
+ * @category services
53
+ * @since 4.0.0
19
54
  */
20
- export class OtelLoggerProvider extends /*#__PURE__*/ServiceMap.Service()("@effect/opentelemetry/Logger/OtelLoggerProvider") {}
55
+ export class OtelLoggerProvider extends /*#__PURE__*/Context.Service()("@effect/opentelemetry/Logger/OtelLoggerProvider") {}
21
56
  /**
22
- * @since 1.0.0
23
- * @category Constructors
57
+ * Maps an Effect `LogLevel` to the corresponding OpenTelemetry `SeverityNumber`.
58
+ *
59
+ * **Details**
60
+ *
61
+ * OpenTelemetry log severity numbers are in the range `1` through `24`. This
62
+ * function maps from Effect's log levels instead of using
63
+ * `LogLevel.getOrdinal`, whose internal sort ordinals, such as the `Info`
64
+ * ordinal `20000`, fall outside the OpenTelemetry logs data model and can be
65
+ * treated as `UNSPECIFIED` by validating backends.
66
+ *
67
+ * @category converting
68
+ * @since 4.0.0
69
+ */
70
+ export const logLevelToSeverityNumber = level => {
71
+ switch (level) {
72
+ case "Trace":
73
+ return SeverityNumber.TRACE;
74
+ case "Debug":
75
+ return SeverityNumber.DEBUG;
76
+ case "Info":
77
+ return SeverityNumber.INFO;
78
+ case "Warn":
79
+ return SeverityNumber.WARN;
80
+ case "Error":
81
+ return SeverityNumber.ERROR;
82
+ case "Fatal":
83
+ return SeverityNumber.FATAL;
84
+ default:
85
+ return SeverityNumber.UNSPECIFIED;
86
+ }
87
+ };
88
+ /**
89
+ * Creates an Effect logger that emits log records through the configured OpenTelemetry logger provider.
90
+ *
91
+ * @category constructors
92
+ * @since 4.0.0
24
93
  */
25
94
  export const make = /*#__PURE__*/Effect.gen(function* () {
26
95
  const loggerProvider = yield* OtelLoggerProvider;
@@ -30,40 +99,58 @@ export const make = /*#__PURE__*/Effect.gen(function* () {
30
99
  const attributes = {
31
100
  fiberId: options.fiber.id
32
101
  };
33
- const span = ServiceMap.getOrUndefined(options.fiber.services, Tracer.ParentSpan);
102
+ const span = Context.getOrUndefined(options.fiber.context, Tracer.ParentSpan);
34
103
  if (Predicate.isNotUndefined(span)) {
35
104
  attributes.spanId = span.spanId;
36
105
  attributes.traceId = span.traceId;
37
106
  }
38
- // TODO: add back after log spans / annotations
39
- // for (const [key, value] of options.annotations) {
40
- // attributes[key] = unknownToAttributeValue(value)
41
- // }
42
- // const now = options.date.getTime()
43
- // for (const span of options.spans) {
44
- // attributes[`logSpan.${span.label}`] = `${now - span.startTime}ms`
45
- // }
107
+ for (const [key, value] of Object.entries(options.fiber.getRef(References.CurrentLogAnnotations))) {
108
+ attributes[key] = unknownToAttributeValue(value);
109
+ }
110
+ const now = options.date.getTime();
111
+ for (const [label, startTime] of options.fiber.getRef(References.CurrentLogSpans)) {
112
+ attributes[`logSpan.${label}`] = `${now - startTime}ms`;
113
+ }
46
114
  const message = Arr.ensure(options.message).map(unknownToAttributeValue);
115
+ const hrTime = nanosToHrTime(clock.currentTimeNanosUnsafe());
47
116
  otelLogger.emit({
48
117
  body: message.length === 1 ? message[0] : message,
49
118
  severityText: options.logLevel,
50
- severityNumber: LogLevel.getOrdinal(options.logLevel),
51
- timestamp: options.date,
52
- observedTimestamp: clock.currentTimeMillisUnsafe(),
119
+ severityNumber: logLevelToSeverityNumber(options.logLevel),
120
+ timestamp: hrTime,
121
+ observedTimestamp: hrTime,
53
122
  attributes
54
123
  });
55
124
  });
56
125
  });
57
126
  /**
58
- * @since 1.0.0
59
- * @category Layers
127
+ * Creates a layer that installs the OpenTelemetry-backed Effect logger, merging with existing loggers by default.
128
+ *
129
+ * **When to use**
130
+ *
131
+ * Use to install the OpenTelemetry-backed Effect logger in an application that
132
+ * has an `OtelLoggerProvider`, so standard Effect logging emits OpenTelemetry
133
+ * log records.
134
+ *
135
+ * **Details**
136
+ *
137
+ * The layer installs the logger created by `make`. `mergeWithExisting` defaults
138
+ * to `true`; set it to `false` to replace the current logger set.
139
+ *
140
+ * @see {@link make} for constructing the logger directly
141
+ * @see {@link layerLoggerProvider} for creating the required logger provider
142
+ *
143
+ * @category layers
144
+ * @since 4.0.0
60
145
  */
61
146
  export const layer = options => Logger.layer([make], {
62
147
  mergeWithExisting: options.mergeWithExisting ?? true
63
148
  });
64
149
  /**
65
- * @since 1.0.0
66
- * @category Layers
150
+ * Creates a scoped OpenTelemetry logger provider from one or more log record processors, using the current `Resource` and flushing and shutting down the provider when the layer is released.
151
+ *
152
+ * @category layers
153
+ * @since 4.0.0
67
154
  */
68
155
  export const layerLoggerProvider = (processor, config) => Layer.effect(OtelLoggerProvider, Effect.gen(function* () {
69
156
  const resource = yield* Resource;
@@ -1 +1 @@
1
- {"version":3,"file":"Logger.js","names":["Otel","Arr","Clock","Effect","Layer","Logger","LogLevel","Predicate","ServiceMap","Tracer","unknownToAttributeValue","Resource","OtelLoggerProvider","Service","make","gen","loggerProvider","clock","otelLogger","getLogger","options","attributes","fiberId","fiber","id","span","getOrUndefined","services","ParentSpan","isNotUndefined","spanId","traceId","message","ensure","map","emit","body","length","severityText","logLevel","severityNumber","getOrdinal","timestamp","date","observedTimestamp","currentTimeMillisUnsafe","layer","mergeWithExisting","layerLoggerProvider","processor","config","effect","resource","acquireRelease","sync","LoggerProvider","undefined","processors","provider","promise","forceFlush","then","shutdown","pipe","ignore","interruptible","timeoutOption","shutdownTimeout"],"sources":["../src/Logger.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,IAAI,MAAM,yBAAyB;AAE/C,OAAO,KAAKC,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAErC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,QAAQ,MAAM,iB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","Context","Effect","Layer","Logger","Predicate","References","Tracer","nanosToHrTime","unknownToAttributeValue","Resource","OtelLoggerProvider","Service","logLevelToSeverityNumber","level","TRACE","DEBUG","INFO","WARN","ERROR","FATAL","UNSPECIFIED","make","gen","loggerProvider","clock","otelLogger","getLogger","options","attributes","fiberId","fiber","id","span","getOrUndefined","context","ParentSpan","isNotUndefined","spanId","traceId","key","value","Object","entries","getRef","CurrentLogAnnotations","now","date","getTime","label","startTime","CurrentLogSpans","message","ensure","map","hrTime","currentTimeNanosUnsafe","emit","body","length","severityText","logLevel","severityNumber","timestamp","observedTimestamp","layer","mergeWithExisting","layerLoggerProvider","processor","config","effect","resource","acquireRelease","sync","LoggerProvider","undefined","processors","provider","promise","forceFlush","then","shutdown","pipe","ignore","interruptible","timeoutOption","shutdownTimeout"],"sources":["../src/Logger.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAASA,cAAc,QAAQ,yBAAyB;AACxD,OAAO,KAAKC,IAAI,MAAM,yBAAyB;AAE/C,OAAO,KAAKC,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AAEzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eAAe;AAEvC,OAAO,KAAKC,SAAS,MAAM,kBAAkB;AAC7C,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,aAAa,EAAEC,uBAAuB,QAAQ,0BAA0B;AACjF,SAASC,QAAQ,QAAQ,eAAe;AAExC;;;;;;AAMA,OAAM,MAAOC,kBAAmB,sBAAQV,OAAO,CAACW,OAAO,EAGpD,CAAC,iDAAiD,CAAC;AAEtD;;;;;;;;;;;;;;AAcA,OAAO,MAAMC,wB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aAAS;EAClB,MAAMgD,QAAQ,GAAG,OAAO7D,QAAQ;EAChC,OAAO,OAAOR,MAAM,CAACsE,cAAc,CACjCtE,MAAM,CAACuE,IAAI,CAAC,MACV,IAAI3E,IAAI,CAAC4E,cAAc,CAAC;IACtB,IAAIL,MAAM,IAAIM,SAAS,CAAC;IACxBC,UAAU,EAAE7E,GAAG,CAACsD,MAAM,CAACe,SAAS,CAAC;IACjCG;GACD,CAAC,CACH,EACAM,QAAQ,IACP3E,MAAM,CAAC4E,OAAO,CAAC,MAAMD,QAAQ,CAACE,UAAU,EAAE,CAACC,IAAI,CAAC,MAAMH,QAAQ,CAACI,QAAQ,EAAE,CAAC,CAAC,CAACC,IAAI,CAC9EhF,MAAM,CAACiF,MAAM,EACbjF,MAAM,CAACkF,aAAa,EACpBlF,MAAM,CAACmF,aAAa,CAAChB,MAAM,EAAEiB,eAAe,IAAI,IAAI,CAAC,CACtD,CACJ;AACH,CAAC,CAAC,CACH","ignoreList":[]}
package/dist/Metrics.d.ts CHANGED
@@ -1,5 +1,37 @@
1
1
  /**
2
- * @since 1.0.0
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.
33
+ *
34
+ * @since 4.0.0
3
35
  */
4
36
  import type { MetricProducer, MetricReader } from "@opentelemetry/sdk-metrics";
5
37
  import type * as Arr from "effect/Array";
@@ -13,28 +45,43 @@ import { Resource } from "./Resource.ts";
13
45
  * Determines how metric values relate to the time interval over which they
14
46
  * are aggregated.
15
47
  *
16
- * - `cumulative`: Reports total since a fixed start time. Each data point
17
- * depends on all previous measurements. This is the default behavior.
48
+ * **Details**
18
49
  *
19
- * - `delta`: Reports changes since the last export. Each interval is
20
- * independent with no dependency on previous measurements.
50
+ * `cumulative` reports total since a fixed start time. Each data point depends
51
+ * on all previous measurements. This is the default behavior. `delta` reports
52
+ * changes since the last export. Each interval is independent with no
53
+ * dependency on previous measurements.
21
54
  *
22
- * @since 1.0.0
23
- * @category Models
55
+ * @category models
56
+ * @since 4.0.0
24
57
  */
25
58
  export type TemporalityPreference = "cumulative" | "delta";
26
59
  /**
27
60
  * Creates an OpenTelemetry metric producer from Effect metrics.
28
61
  *
29
- * @since 1.0.0
30
- * @category Constructors
62
+ * **When to use**
63
+ *
64
+ * Use to create a `MetricProducer` when you need to wire Effect metrics into
65
+ * OpenTelemetry manually instead of using the scoped `layer` helper.
66
+ *
67
+ * **Details**
68
+ *
69
+ * Requires the current OpenTelemetry `Resource`, captures the current Effect
70
+ * context, and uses cumulative temporality by default. Pass `"delta"` for
71
+ * interval-based values.
72
+ *
73
+ * @see {@link registerProducer} for attaching a producer to metric readers
74
+ * @see {@link layer} for creating and registering a producer in a scoped layer
75
+ *
76
+ * @category constructors
77
+ * @since 4.0.0
31
78
  */
32
79
  export declare const makeProducer: (temporality?: TemporalityPreference) => Effect.Effect<MetricProducer, never, Resource>;
33
80
  /**
34
81
  * Registers a metric producer with one or more metric readers.
35
82
  *
36
- * @since 1.0.0
37
- * @category Constructors
83
+ * @category constructors
84
+ * @since 4.0.0
38
85
  */
39
86
  export declare const registerProducer: (self: MetricProducer, metricReader: LazyArg<MetricReader | Arr.NonEmptyReadonlyArray<MetricReader>>, options?: {
40
87
  readonly shutdownTimeout?: Duration.Input | undefined;
@@ -42,7 +89,8 @@ export declare const registerProducer: (self: MetricProducer, metricReader: Lazy
42
89
  /**
43
90
  * Creates a Layer that registers a metric producer with metric readers.
44
91
  *
45
- * @example
92
+ * **Example** (Creating a metrics layer with temporality)
93
+ *
46
94
  * ```ts
47
95
  * import { Metrics } from "@effect/opentelemetry"
48
96
  * import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics"
@@ -66,8 +114,8 @@ export declare const registerProducer: (self: MetricProducer, metricReader: Lazy
66
114
  * )
67
115
  * ```
68
116
  *
69
- * @since 1.0.0
70
- * @category Layers
117
+ * @category layers
118
+ * @since 4.0.0
71
119
  */
72
120
  export declare const layer: (evaluate: LazyArg<MetricReader | Arr.NonEmptyReadonlyArray<MetricReader>>, options?: {
73
121
  readonly shutdownTimeout?: Duration.Input | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Metrics.d.ts","sourceRoot":"","sources":["../src/Metrics.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9E,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAA;AACxC,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,KAAK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EAAE,KAAK,EAAE,QAAQ,CAIjC,CAAA"}
package/dist/Metrics.js CHANGED
@@ -5,19 +5,33 @@ import { Resource } from "./Resource.js";
5
5
  /**
6
6
  * Creates an OpenTelemetry metric producer from Effect metrics.
7
7
  *
8
- * @since 1.0.0
9
- * @category Constructors
8
+ * **When to use**
9
+ *
10
+ * Use to create a `MetricProducer` when you need to wire Effect metrics into
11
+ * OpenTelemetry manually instead of using the scoped `layer` helper.
12
+ *
13
+ * **Details**
14
+ *
15
+ * Requires the current OpenTelemetry `Resource`, captures the current Effect
16
+ * context, and uses cumulative temporality by default. Pass `"delta"` for
17
+ * interval-based values.
18
+ *
19
+ * @see {@link registerProducer} for attaching a producer to metric readers
20
+ * @see {@link layer} for creating and registering a producer in a scoped layer
21
+ *
22
+ * @category constructors
23
+ * @since 4.0.0
10
24
  */
11
25
  export const makeProducer = temporality => Effect.gen(function* () {
12
26
  const resource = yield* Resource;
13
- const services = yield* Effect.services();
27
+ const services = yield* Effect.context();
14
28
  return new MetricProducerImpl(resource, services, temporality);
15
29
  });
16
30
  /**
17
31
  * Registers a metric producer with one or more metric readers.
18
32
  *
19
- * @since 1.0.0
20
- * @category Constructors
33
+ * @category constructors
34
+ * @since 4.0.0
21
35
  */
22
36
  export const registerProducer = (self, metricReader, options) => Effect.acquireRelease(Effect.sync(() => {
23
37
  const reader = metricReader();
@@ -28,7 +42,8 @@ export const registerProducer = (self, metricReader, options) => Effect.acquireR
28
42
  /**
29
43
  * Creates a Layer that registers a metric producer with metric readers.
30
44
  *
31
- * @example
45
+ * **Example** (Creating a metrics layer with temporality)
46
+ *
32
47
  * ```ts
33
48
  * import { Metrics } from "@effect/opentelemetry"
34
49
  * import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics"
@@ -52,8 +67,8 @@ export const registerProducer = (self, metricReader, options) => Effect.acquireR
52
67
  * )
53
68
  * ```
54
69
  *
55
- * @since 1.0.0
56
- * @category Layers
70
+ * @category layers
71
+ * @since 4.0.0
57
72
  */
58
73
  export const layer = (evaluate, options) => Layer.effectDiscard(Effect.flatMap(makeProducer(options?.temporality), producer => registerProducer(producer, evaluate, options)));
59
74
  //# sourceMappingURL=Metrics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Metrics.js","names":["Effect","Layer","MetricProducerImpl","Resource","makeProducer","temporality","gen","resource","services","registerProducer","self","metricReader","options","acquireRelease","sync","reader","readers","Array","isArray","forEach","setMetricProducer","promise","Promise","all","map","shutdown","pipe","ignore","interruptible","timeoutOption","shutdownTimeout","layer","evaluate","effectDiscard","flatMap","producer"],"sources":["../src/Metrics.ts"],"sourcesContent":[null],"mappings":"AAMA,OAAO,KAAKA,MAAM,MAAM,eAAe;AAEvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAErC,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,QAAQ,QAAQ,eAAe;AAiBxC;;;;;;AAMA,OAAO,MAAMC,YAAY,GAAIC,WAAmC,IAC9DL,MAAM,CAACM,GAAG,CAAC,aAAS;EAClB,MAAMC,QAAQ,GAAG,OAAOJ,QAAQ;EAChC,MAAMK,QAAQ,GAAG,OAAOR,MAAM,CAACQ,QAAQ,EAAS;EAChD,OAAO,IAAIN,kBAAkB,CAACK,QAAQ,EAAEC,QAAQ,EAAEH,WAAW,CAAC;AAChE,CAAC,CAAC;AAEJ;;;;;;AAMA,OAAO,MAAMI,gBAAgB,GAAGA,CAC9BC,IAAoB,EACpBC,YAA6E,EAC7EC,OAEC,KAEDZ,MAAM,CAACa,cAAc,CACnBb,MAAM,CAACc,IAAI,CAAC,MAAK;EACf,MAAMC,MAAM,GAAGJ,YAAY,EAAE;EAC7B,MAAMK,OAAO,GAAwBC,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GAAGA,MAAM,GAAG,CAACA,MAAM,CAAQ;EACrFC,OAAO,CAACG,OAAO,CAAEJ,MAAM,IAAKA,MAAM,CAACK,iBAAiB,CAACV,IAAI,CAAC,CAAC;EAC3D,OAAOM,OAAO;AAChB,CAAC,CAAC,EACDA,OAAO,IACNhB,MAAM,CAACqB,OAAO,CAAC,MACbC,OAAO,CAACC,GAAG,CACTP,OAAO,CAACQ,GAAG,CAAET,MAAM,IAAKA,MAAM,CAACU,QAAQ,EAAE,CAAC,CAC3C,CACF,CAACC,IAAI,CACJ1B,MAAM,CAAC2B,MAAM,EACb3B,MAAM,CAAC4B,aAAa,EACpB5B,MAAM,CAAC6B,aAAa,CAACjB,OAAO,EAAEkB,eAAe,IAAI,IAAI,CAAC,CACvD,CACJ;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,OAAO,MAAMC,KAAK,GAAGA,CACnBC,QAAyE,EACzEpB,OAGC,KAEDX,KAAK,CAACgC,aAAa,CAACjC,MAAM,CAACkC,OAAO,CAChC9B,YAAY,CAACQ,OAAO,EAAEP,WAAW,CAAC,EACjC8B,QAAQ,IAAK1B,gBAAgB,CAAC0B,QAAQ,EAAEH,QAAQ,EAAEpB,OAAO,CAAC,CAC5D,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Metrics.js","names":["Effect","Layer","MetricProducerImpl","Resource","makeProducer","temporality","gen","resource","services","context","registerProducer","self","metricReader","options","acquireRelease","sync","reader","readers","Array","isArray","forEach","setMetricProducer","promise","Promise","all","map","shutdown","pipe","ignore","interruptible","timeoutOption","shutdownTimeout","layer","evaluate","effectDiscard","flatMap","producer"],"sources":["../src/Metrics.ts"],"sourcesContent":[null],"mappings":"AAsCA,OAAO,KAAKA,MAAM,MAAM,eAAe;AAEvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAErC,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,QAAQ,QAAQ,eAAe;AAkBxC;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,MAAMC,YAAY,GAAIC,WAAmC,IAC9DL,MAAM,CAACM,GAAG,CAAC,aAAS;EAClB,MAAMC,QAAQ,GAAG,OAAOJ,QAAQ;EAChC,MAAMK,QAAQ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