@smthrs/observability 1.0.0-rc.3 → 1.0.0-rc.4

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.
@@ -45,7 +45,7 @@ export declare const defaultServiceName = "flows";
45
45
  * @category resource
46
46
  * @since 0.1.0
47
47
  */
48
- export declare const defaultServiceVersion = "1.0.0-rc.3";
48
+ export declare const defaultServiceVersion = "1.0.0-rc.4";
49
49
  /**
50
50
  * Maximum encoded export request size, in bytes.
51
51
  * @category transport
package/dist/cjs/Otlp.js CHANGED
@@ -62,7 +62,7 @@ var Otlp = __toESM(require("effect/unstable/observability/Otlp"), 1);
62
62
  var Endpoint = __toESM(require("./Endpoint.js"), 1);
63
63
  var Resource = __toESM(require("./Resource.js"), 1);
64
64
  const defaultServiceName = "flows";
65
- const defaultServiceVersion = "1.0.0-rc.3";
65
+ const defaultServiceVersion = "1.0.0-rc.4";
66
66
  const maxBatchSize = 1e3;
67
67
  const maxInFlight = 4;
68
68
  const maxRequestBytes = 1024 * 1024;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Otlp.ts"],
4
- "sourcesContent": ["/**\n * Default OTLP export wiring for flows telemetry.\n *\n * The store packages already open spans through Effect's tracer and update\n * `Metric` counters on their hot paths; what they deliberately do not do is\n * ship an exporter. This module is that exporter: one layer that installs\n * Effect's own OTLP logger, metrics exporter, and tracer\n * (`effect/unstable/observability/Otlp`) against a collector endpoint, with\n * the flows service identity filled in. Nothing beyond `effect` is involved;\n * no OpenTelemetry SDK dependency.\n *\n * Browser support is met by construction rather than by a no-op variant:\n * export happens over Effect's `HttpClient`, and {@link layerFetch} binds the\n * `fetch` implementation the host already has, so no entry point here ever\n * resolves a `node:` built-in. See the\n * {@link https://smithers.sh/docs/reference/api/observability | observability API contract}.\n *\n * @since 0.1.0\n */\n\nimport * as Redaction from \"@smthrs/journal/Redaction\"\nimport * as Cause from \"effect/Cause\"\nimport { Clock } from \"effect/Clock\"\nimport * as ConfigProvider from \"effect/ConfigProvider\"\nimport type * as Duration from \"effect/Duration\"\nimport * as Effect from \"effect/Effect\"\nimport * as Exit from \"effect/Exit\"\nimport * as Layer from \"effect/Layer\"\nimport * as Logger from \"effect/Logger\"\nimport * as Metric from \"effect/Metric\"\nimport * as Option from \"effect/Option\"\nimport * as References from \"effect/References\"\nimport * as Schema from \"effect/Schema\"\nimport * as Semaphore from \"effect/Semaphore\"\nimport * as Tracer from \"effect/Tracer\"\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\"\nimport * as Headers from \"effect/unstable/http/Headers\"\nimport type * as HttpBody from \"effect/unstable/http/HttpBody\"\nimport * as HttpClient from \"effect/unstable/http/HttpClient\"\nimport type * as HttpClientRequest from \"effect/unstable/http/HttpClientRequest\"\nimport * as HttpClientResponse from \"effect/unstable/http/HttpClientResponse\"\nimport * as Otlp from \"effect/unstable/observability/Otlp\"\nimport * as Endpoint from \"./Endpoint.ts\"\nimport * as Resource from \"./Resource.ts\"\n\n/**\n * The `service.name` resource attribute installed when the caller supplies\n * none: the flows distribution itself. Override it per application with\n * {@link Options.serviceName}.\n *\n * @category resource\n * @since 0.1.0\n */\nexport const defaultServiceName = \"flows\"\n\n/**\n * The `service.version` resource attribute installed when the caller supplies\n * none. Mirrors the release version in this package's `package.json`.\n *\n * A published package cannot read its own manifest on every runtime it\n * supports, so the version lives here as a literal.\n * `scripts/set-release-version.mjs` rewrites this declaration with the\n * manifests, and its `--check` mode reports drift, so a release bump cannot\n * leave it behind.\n *\n * @category resource\n * @since 0.1.0\n */\nexport const defaultServiceVersion = \"1.0.0-rc.3\"\n\n// The upstream logger and tracer each buffer at most one 1,000-record batch.\n// Do not queue at the transport: upstream forks every full batch independently.\nconst maxBatchSize = 1000\nconst maxInFlight = 4\n/**\n * Maximum encoded export request size, in bytes.\n * @category transport\n * @since 1.0.0-rc.0\n */\nexport const maxRequestBytes = 1024 * 1024\nconst requestTimeout = \"10 seconds\"\nconst diagnosticIntervalMillis = 60_000\n// The envelope around the resource in every request repeats `service.name` as\n// the instrumentation scope name: at most 1,024 code units, at most six bytes\n// each once JSON-escaped, so under 8 KiB together with the envelope's own keys.\n/**\n * Reserved bytes for request wrappers and the escaped instrumentation scope.\n * @category transport\n * @since 1.0.0-rc.0\n */\nexport const maximumEnvelopeBytes = 8 * 1024\n\n/**\n * Bytes of every export request kept free for the signal batch itself.\n *\n * The transport discards a request over 1 MiB, and the resource rides in every\n * request, so the largest resource `Resource.decode` admits\n * (`Resource.maximumResourceBytes`, 128 KiB) and the envelope that repeats the\n * service name (under 8 KiB) come off the top. The 888 KiB left gives each\n * record of a full 1,000-record logger or tracer batch about 900 bytes, three\n * to four times a bare log record or span, and gives the metrics snapshot room\n * for several thousand series. Every resource the decoder accepts therefore\n * leaves an ordinary batch of any signal exportable; what this reserve does\n * not bound is a single application record or a registry large enough to\n * exceed it on its own.\n *\n * @category transport\n * @since 1.0.0-rc.0\n */\nexport const reservedBatchBytes = maxRequestBytes - Resource.maximumResourceBytes - maximumEnvelopeBytes\n\ntype DiscardReason = \"oversized\" | \"stalled\" | \"saturated\"\n\nconst boundedClient = Layer.effect(\n HttpClient.HttpClient,\n Effect.gen(function*() {\n const client = yield* HttpClient.HttpClient\n const clock = yield* Clock\n // The loggers installed when this transport is acquired. The OTLP logger\n // the same acquisition installs does not exist yet, so a diagnostic pinned\n // to this set cannot enter the exporter it describes, whichever fiber runs\n // the export: the interval and shutdown fibers inherit this set anyway,\n // but a flush requested from application code runs with the application's\n // loggers, which by then include this exporter.\n const ambientLoggers = yield* Effect.withFiber((fiber) => Effect.succeed(fiber.getRef(Logger.CurrentLoggers)))\n const permits = Semaphore.makeUnsafe(maxInFlight)\n // The counter lives with the transport it describes.\n const droppedExports = Metric.counter(\"flows_observability_otlp_dropped\")\n let nextDiagnosticAt = -Infinity\n // A local discard is terminal, so the upstream retry loop must not retain\n // or retry its payload, and the counter records batches, not records. The\n // warning is the diagnostic the counter cannot be: the counter is exported\n // through this same transport and shares every outage with it. One\n // warning per minute keeps a sustained outage from flooding the ambient\n // loggers; the running total in its annotations carries the volume.\n // Replace ambient annotations and log spans to bound the diagnostic itself.\n const discard = (reason: DiscardReason, request: HttpClientRequest.HttpClientRequest, bytes: number) =>\n Metric.update(droppedExports, 1).pipe(\n Effect.andThen(Effect.suspend(() => {\n const now = clock.currentTimeMillisUnsafe()\n if (now < nextDiagnosticAt) return Effect.void\n nextDiagnosticAt = now + diagnosticIntervalMillis\n return Metric.value(droppedExports).pipe(\n Effect.flatMap((dropped) =>\n Effect.logWarning(\"An OTLP export batch was discarded\").pipe(\n Effect.provideService(References.CurrentLogSpans, []),\n Effect.provideService(References.CurrentLogAnnotations, {\n code: \"otlp_export_discarded\",\n reason,\n bytes,\n limit: maxRequestBytes,\n dropped: dropped.count\n })\n )\n ),\n Effect.provideService(Logger.CurrentLoggers, ambientLoggers)\n )\n })),\n Effect.as(HttpClientResponse.fromWeb(request, new Response(null, { status: 204 })))\n )\n return HttpClient.transform(client, (requestEffect, request) =>\n Effect.suspend(() => {\n // layerJson always supplies a Uint8Array body with a byte length.\n const bytes = (request.body as HttpBody.Uint8Array).contentLength\n if (bytes > maxRequestBytes) return discard(\"oversized\", request, bytes)\n // Fetch must expose redirects before any credential or signal body\n // leaves the configured endpoint, even when the caller enables follow.\n const confinedRequest = Effect.flatMap(Effect.serviceOption(FetchHttpClient.RequestInit), (init) =>\n requestEffect.pipe(\n Effect.provideService(FetchHttpClient.RequestInit, {\n ...Option.getOrUndefined(init),\n redirect: \"manual\"\n })\n ))\n return confinedRequest.pipe(\n Effect.timeoutOrElse({\n duration: requestTimeout,\n orElse: () =>\n discard(\"stalled\", request, bytes)\n }),\n permits.withPermitsIfAvailable(1),\n Effect.flatMap(Option.match({\n onNone: () =>\n discard(\"saturated\", request, bytes),\n onSome: Effect.succeed\n }))\n )\n }))\n })\n)\n\nconst loopbackIpv4 = /^127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/\n\n/** Whether a decoded endpoint's host never leaves this machine. */\nconst isLoopback = (endpoint: string): boolean => {\n const hostname = new URL(endpoint).hostname\n return hostname === \"localhost\" || hostname === \"[::1]\" || loopbackIpv4.test(hostname)\n}\n\n/**\n * Refuses a credential header bound for a plaintext collector off this\n * machine. Anyone on the network path could read the token from every export\n * request, and the exporter would never report it. Loopback `http://` stays\n * allowed for a local collector or sidecar; non-credential headers such as a\n * tenant id stay allowed on any endpoint.\n */\n/**\n * Vendor credential headers whose names `Redaction.isSensitiveKey` does not\n * recognize. Honeycomb sends its ingest key as `x-honeycomb-team`.\n */\nconst vendorCredentialHeaders: ReadonlySet<string> = new Set([\"x-honeycomb-team\"])\n\nconst isCredentialHeader = (name: string): boolean =>\n Redaction.isSensitiveKey(name) || vendorCredentialHeaders.has(name.toLowerCase())\n\nconst refusePlaintextCredentials = (\n baseUrl: string,\n headers: Headers.Input | undefined\n): Effect.Effect<void, Endpoint.InvalidExporterEndpoint> => {\n if (!baseUrl.toLowerCase().startsWith(\"http:\") || isLoopback(baseUrl)) return Effect.void\n const credential = Object.keys(Headers.fromInput(headers)).some(isCredentialHeader)\n return credential\n ? Effect.fail(\n new Endpoint.InvalidExporterEndpoint({\n code: \"invalid_exporter_endpoint\",\n path: \"baseUrl\",\n message:\n \"OTLP collector baseUrl must use https:// when headers carry credentials, unless it is a loopback address\"\n })\n )\n : Effect.void\n}\n\nconst redactText = (text: string): string => String(Redaction.redact(text))\n\n/**\n * A failed span's error rebuilt with its text redacted. It keeps the original\n * error's `name` and `stack` (redacted) so the collector's exception type and\n * trace stay readable; it is exported to the collector and never thrown.\n */\nclass RedactedSpanError extends Schema.TaggedError<RedactedSpanError>()(\"@smthrs/observability/RedactedSpanError\", {\n message: Schema.String\n}) {}\n\n/**\n * A span failure rendered with credentials removed. The exporter serializes a\n * failed span's cause into its status message and `exception` events, which\n * would otherwise carry any token an error message quoted to the collector.\n */\nconst redactedExit = (exit: Exit.Exit<unknown, unknown>): Exit.Exit<unknown, unknown> => {\n if (exit._tag === \"Success\" || Cause.hasInterruptsOnly(exit.cause)) return exit\n const errors = Cause.prettyErrors(exit.cause, { includeCauseInStack: true }).map((error) => {\n const redacted = new RedactedSpanError({ message: redactText(error.message) })\n Object.defineProperty(redacted, \"name\", { value: redactText(error.name), configurable: true, writable: true })\n // `prettyErrors` always renders a stack.\n redacted.stack = redactText(String(error.stack))\n return redacted\n })\n return Exit.failCause(errors.map(Cause.fail).reduce(Cause.combine, Cause.empty as Cause.Cause<unknown>))\n}\n\n/**\n * Wraps the installed tracer so every exported span's failure and string\n * attributes pass through the journal redaction rules first.\n */\nconst redactedSpans = Layer.effect(Tracer.Tracer)(\n Effect.map(Effect.tracer, (tracer) =>\n Tracer.make({\n ...tracer,\n span(options) {\n const span = tracer.span(options)\n const end = span.end.bind(span)\n const attribute = span.attribute.bind(span)\n span.end = (endTime, exit) => end(endTime, redactedExit(exit))\n span.attribute = (key, value) => attribute(key, typeof value === \"string\" ? redactText(value) : value)\n return span\n }\n }))\n)\n\n/**\n * Configuration for the default OTLP wiring.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface Options {\n /**\n * The collector base URL, for example `http://localhost:4318`. Signals are\n * posted below it at `/v1/logs`, `/v1/metrics`, and `/v1/traces`. It must be\n * an absolute `http://` or `https://` URL without credentials, a query,\n * fragment, backslashes, spaces, or controls. A base path is allowed. Invalid\n * values fail acquisition with {@link Endpoint.InvalidExporterEndpoint}.\n * Use {@link Options.headers} for authentication.\n */\n readonly baseUrl: string\n /** Overrides {@link defaultServiceName} as the `service.name` attribute. */\n readonly serviceName?: string | undefined\n /** Overrides {@link defaultServiceVersion} as the `service.version` attribute. */\n readonly serviceVersion?: string | undefined\n /**\n * Additional resource attributes attached to every exported signal, decoded\n * by `Resource.Attributes`. The whole resource must encode to at most\n * `Resource.maximumResourceBytes`; a larger one fails acquisition with\n * {@link Resource.InvalidResourceConfiguration} rather than making every\n * request oversized.\n */\n readonly attributes?: Record<string, unknown> | undefined\n /**\n * Headers sent with every export request, for example vendor auth. A header\n * whose name names a credential (`authorization`, `x-api-key`, anything\n * `Redaction.isSensitiveKey` recognizes, plus `x-honeycomb-team`) requires\n * an `https://` baseUrl unless the host is loopback; otherwise acquisition\n * fails with\n * {@link Endpoint.InvalidExporterEndpoint}.\n */\n readonly headers?: Headers.Input | undefined\n /** Export cadence for all three signals; each signal's Effect default applies when omitted. */\n readonly exportInterval?: Duration.Input | undefined\n /** Upper bound on the shutdown flush when the layer's scope closes. */\n readonly shutdownTimeout?: Duration.Input | undefined\n}\n\n/**\n * Creates the OTLP logs, metrics, and traces layer with flows resource\n * defaults, JSON-serialized. Exports share a four-request limit with no waiting\n * queue. Requests larger than 1 MiB or stalled for ten seconds are discarded;\n * `flows_observability_otlp_dropped` counts discarded batches, and at most\n * once a minute a `Warn` record with code `otlp_export_discarded` names the\n * reason, the request size, and the running total through the loggers that\n * were installed when the layer was acquired, never through this exporter.\n *\n * **Details**\n *\n * The layer still requires an `HttpClient`, which is how it stays\n * platform-neutral: a Node host may hand it `@effect/platform-node`'s Undici\n * client (re-exported by `@smthrs/platform-node`), a browser or test\n * hands it something else. Use {@link layerFetch} when the host's global\n * `fetch` is good enough. On Node 26 and every browser it is.\n * Fetch redirects are refused. Supply `FetchHttpClient.RequestInit` around\n * the whole exporting effect to retain other fetch options; options scoped\n * only to the supplied client's layer are replaced by the redirect policy.\n * Other HTTP transports must independently refuse automatic redirects.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layer = (\n options: Options\n): Layer.Layer<\n never,\n Resource.InvalidResourceConfiguration | Endpoint.InvalidExporterEndpoint,\n HttpClient.HttpClient\n> =>\n Layer.unwrap(\n Effect.map(\n Effect.all([\n Resource.decode({\n serviceName: options.serviceName ?? defaultServiceName,\n serviceVersion: options.serviceVersion ?? defaultServiceVersion,\n ...(options.attributes === undefined ? {} : { attributes: options.attributes })\n }),\n Endpoint.decode(options.baseUrl, \"baseUrl\").pipe(\n Effect.tap((baseUrl) => refusePlaintextCredentials(baseUrl, options.headers))\n )\n ]),\n ([decoded, baseUrl]) => {\n const resource = Resource.toOpenTelemetryConfiguration(decoded)\n return (\n Otlp.layerJson({\n baseUrl,\n resource: {\n serviceName: resource.serviceName,\n // `serviceVersion` is supplied above before Resource decoding.\n serviceVersion: resource.serviceVersion!,\n ...(resource.attributes === undefined ? {} : { attributes: resource.attributes })\n },\n headers: options.headers,\n maxBatchSize,\n loggerExportInterval: options.exportInterval,\n metricsExportInterval: options.exportInterval,\n tracerExportInterval: options.exportInterval,\n shutdownTimeout: options.shutdownTimeout\n }).pipe(\n Layer.provide(boundedClient),\n // Upstream merges OTEL_RESOURCE_ATTRIBUTES even with explicit\n // options. Keep unvalidated ambient metadata out of every request.\n Layer.provide(ConfigProvider.layer(ConfigProvider.fromUnknown({}))),\n (exporter) => Layer.provideMerge(redactedSpans, exporter)\n )\n )\n }\n )\n )\n\n/**\n * Provides {@link layer} over the host's global `fetch`, the default wiring\n * for a Node host, and browser-safe by construction because it never touches\n * a `node:` built-in.\n *\n * **Example**\n *\n * ```ts\n * import * as Otlp from \"@smthrs/observability/Otlp\"\n *\n * const Telemetry = Otlp.layerFetch({ baseUrl: \"http://localhost:4318\" })\n * ```\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layerFetch = (\n options: Options\n): Layer.Layer<never, Resource.InvalidResourceConfiguration | Endpoint.InvalidExporterEndpoint> =>\n layer(options).pipe(Layer.provide(FetchHttpClient.layer))\n\n/**\n * Why an OTLP layer refused to start.\n *\n * @category errors\n * @since 1.0.0\n */\nexport type LayerError = Resource.InvalidResourceConfiguration | Endpoint.InvalidExporterEndpoint\n\n/**\n * Parses `OTEL_EXPORTER_OTLP_HEADERS`: comma-separated `key=value` pairs whose\n * values are percent-decoded, as the OpenTelemetry exporter specification\n * defines. A pair without `=` or with an empty key is skipped.\n *\n * @category environment\n * @since 1.0.0\n */\nexport const parseHeaders = (value: string | undefined): Record<string, string> => {\n const headers: Record<string, string> = {}\n for (const pair of (value ?? \"\").split(\",\")) {\n const separator = pair.indexOf(\"=\")\n const key = pair.slice(0, separator).trim()\n if (separator < 0 || key === \"\") continue\n const raw = pair.slice(separator + 1).trim()\n let decoded = raw\n try {\n decoded = decodeURIComponent(raw)\n } catch { /* A malformed escape is kept verbatim. */ }\n headers[key] = decoded\n }\n return headers\n}\n\n/**\n * {@link layerFetch} when the environment names a collector, otherwise\n * {@link layerNoop}.\n *\n * `OTEL_EXPORTER_OTLP_ENDPOINT` is the collector base URL and\n * `OTEL_EXPORTER_OTLP_HEADERS` the headers sent with every export. An unset or\n * empty endpoint installs no exporter at all.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerEnvironment = (\n environment: Readonly<Record<string, string | undefined>>,\n options: Omit<Options, \"baseUrl\" | \"headers\"> = {}\n): Layer.Layer<never, LayerError> => {\n const endpoint = environment[\"OTEL_EXPORTER_OTLP_ENDPOINT\"]?.trim()\n if (endpoint === undefined || endpoint === \"\") return layerNoop\n return layerFetch({ ...options, baseUrl: endpoint, headers: parseHeaders(environment[\"OTEL_EXPORTER_OTLP_HEADERS\"]) })\n}\n\n/**\n * Exports nothing. The explicit stand-in for hosts with no collector, such as\n * a development shell, a test, or a browser deployment that has not opted in, so\n * wiring code can switch layers rather than branch.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layerNoop: Layer.Layer<never> = Layer.empty\n"],
4
+ "sourcesContent": ["/**\n * Default OTLP export wiring for flows telemetry.\n *\n * The store packages already open spans through Effect's tracer and update\n * `Metric` counters on their hot paths; what they deliberately do not do is\n * ship an exporter. This module is that exporter: one layer that installs\n * Effect's own OTLP logger, metrics exporter, and tracer\n * (`effect/unstable/observability/Otlp`) against a collector endpoint, with\n * the flows service identity filled in. Nothing beyond `effect` is involved;\n * no OpenTelemetry SDK dependency.\n *\n * Browser support is met by construction rather than by a no-op variant:\n * export happens over Effect's `HttpClient`, and {@link layerFetch} binds the\n * `fetch` implementation the host already has, so no entry point here ever\n * resolves a `node:` built-in. See the\n * {@link https://smithers.sh/docs/reference/api/observability | observability API contract}.\n *\n * @since 0.1.0\n */\n\nimport * as Redaction from \"@smthrs/journal/Redaction\"\nimport * as Cause from \"effect/Cause\"\nimport { Clock } from \"effect/Clock\"\nimport * as ConfigProvider from \"effect/ConfigProvider\"\nimport type * as Duration from \"effect/Duration\"\nimport * as Effect from \"effect/Effect\"\nimport * as Exit from \"effect/Exit\"\nimport * as Layer from \"effect/Layer\"\nimport * as Logger from \"effect/Logger\"\nimport * as Metric from \"effect/Metric\"\nimport * as Option from \"effect/Option\"\nimport * as References from \"effect/References\"\nimport * as Schema from \"effect/Schema\"\nimport * as Semaphore from \"effect/Semaphore\"\nimport * as Tracer from \"effect/Tracer\"\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\"\nimport * as Headers from \"effect/unstable/http/Headers\"\nimport type * as HttpBody from \"effect/unstable/http/HttpBody\"\nimport * as HttpClient from \"effect/unstable/http/HttpClient\"\nimport type * as HttpClientRequest from \"effect/unstable/http/HttpClientRequest\"\nimport * as HttpClientResponse from \"effect/unstable/http/HttpClientResponse\"\nimport * as Otlp from \"effect/unstable/observability/Otlp\"\nimport * as Endpoint from \"./Endpoint.ts\"\nimport * as Resource from \"./Resource.ts\"\n\n/**\n * The `service.name` resource attribute installed when the caller supplies\n * none: the flows distribution itself. Override it per application with\n * {@link Options.serviceName}.\n *\n * @category resource\n * @since 0.1.0\n */\nexport const defaultServiceName = \"flows\"\n\n/**\n * The `service.version` resource attribute installed when the caller supplies\n * none. Mirrors the release version in this package's `package.json`.\n *\n * A published package cannot read its own manifest on every runtime it\n * supports, so the version lives here as a literal.\n * `scripts/set-release-version.mjs` rewrites this declaration with the\n * manifests, and its `--check` mode reports drift, so a release bump cannot\n * leave it behind.\n *\n * @category resource\n * @since 0.1.0\n */\nexport const defaultServiceVersion = \"1.0.0-rc.4\"\n\n// The upstream logger and tracer each buffer at most one 1,000-record batch.\n// Do not queue at the transport: upstream forks every full batch independently.\nconst maxBatchSize = 1000\nconst maxInFlight = 4\n/**\n * Maximum encoded export request size, in bytes.\n * @category transport\n * @since 1.0.0-rc.0\n */\nexport const maxRequestBytes = 1024 * 1024\nconst requestTimeout = \"10 seconds\"\nconst diagnosticIntervalMillis = 60_000\n// The envelope around the resource in every request repeats `service.name` as\n// the instrumentation scope name: at most 1,024 code units, at most six bytes\n// each once JSON-escaped, so under 8 KiB together with the envelope's own keys.\n/**\n * Reserved bytes for request wrappers and the escaped instrumentation scope.\n * @category transport\n * @since 1.0.0-rc.0\n */\nexport const maximumEnvelopeBytes = 8 * 1024\n\n/**\n * Bytes of every export request kept free for the signal batch itself.\n *\n * The transport discards a request over 1 MiB, and the resource rides in every\n * request, so the largest resource `Resource.decode` admits\n * (`Resource.maximumResourceBytes`, 128 KiB) and the envelope that repeats the\n * service name (under 8 KiB) come off the top. The 888 KiB left gives each\n * record of a full 1,000-record logger or tracer batch about 900 bytes, three\n * to four times a bare log record or span, and gives the metrics snapshot room\n * for several thousand series. Every resource the decoder accepts therefore\n * leaves an ordinary batch of any signal exportable; what this reserve does\n * not bound is a single application record or a registry large enough to\n * exceed it on its own.\n *\n * @category transport\n * @since 1.0.0-rc.0\n */\nexport const reservedBatchBytes = maxRequestBytes - Resource.maximumResourceBytes - maximumEnvelopeBytes\n\ntype DiscardReason = \"oversized\" | \"stalled\" | \"saturated\"\n\nconst boundedClient = Layer.effect(\n HttpClient.HttpClient,\n Effect.gen(function*() {\n const client = yield* HttpClient.HttpClient\n const clock = yield* Clock\n // The loggers installed when this transport is acquired. The OTLP logger\n // the same acquisition installs does not exist yet, so a diagnostic pinned\n // to this set cannot enter the exporter it describes, whichever fiber runs\n // the export: the interval and shutdown fibers inherit this set anyway,\n // but a flush requested from application code runs with the application's\n // loggers, which by then include this exporter.\n const ambientLoggers = yield* Effect.withFiber((fiber) => Effect.succeed(fiber.getRef(Logger.CurrentLoggers)))\n const permits = Semaphore.makeUnsafe(maxInFlight)\n // The counter lives with the transport it describes.\n const droppedExports = Metric.counter(\"flows_observability_otlp_dropped\")\n let nextDiagnosticAt = -Infinity\n // A local discard is terminal, so the upstream retry loop must not retain\n // or retry its payload, and the counter records batches, not records. The\n // warning is the diagnostic the counter cannot be: the counter is exported\n // through this same transport and shares every outage with it. One\n // warning per minute keeps a sustained outage from flooding the ambient\n // loggers; the running total in its annotations carries the volume.\n // Replace ambient annotations and log spans to bound the diagnostic itself.\n const discard = (reason: DiscardReason, request: HttpClientRequest.HttpClientRequest, bytes: number) =>\n Metric.update(droppedExports, 1).pipe(\n Effect.andThen(Effect.suspend(() => {\n const now = clock.currentTimeMillisUnsafe()\n if (now < nextDiagnosticAt) return Effect.void\n nextDiagnosticAt = now + diagnosticIntervalMillis\n return Metric.value(droppedExports).pipe(\n Effect.flatMap((dropped) =>\n Effect.logWarning(\"An OTLP export batch was discarded\").pipe(\n Effect.provideService(References.CurrentLogSpans, []),\n Effect.provideService(References.CurrentLogAnnotations, {\n code: \"otlp_export_discarded\",\n reason,\n bytes,\n limit: maxRequestBytes,\n dropped: dropped.count\n })\n )\n ),\n Effect.provideService(Logger.CurrentLoggers, ambientLoggers)\n )\n })),\n Effect.as(HttpClientResponse.fromWeb(request, new Response(null, { status: 204 })))\n )\n return HttpClient.transform(client, (requestEffect, request) =>\n Effect.suspend(() => {\n // layerJson always supplies a Uint8Array body with a byte length.\n const bytes = (request.body as HttpBody.Uint8Array).contentLength\n if (bytes > maxRequestBytes) return discard(\"oversized\", request, bytes)\n // Fetch must expose redirects before any credential or signal body\n // leaves the configured endpoint, even when the caller enables follow.\n const confinedRequest = Effect.flatMap(Effect.serviceOption(FetchHttpClient.RequestInit), (init) =>\n requestEffect.pipe(\n Effect.provideService(FetchHttpClient.RequestInit, {\n ...Option.getOrUndefined(init),\n redirect: \"manual\"\n })\n ))\n return confinedRequest.pipe(\n Effect.timeoutOrElse({\n duration: requestTimeout,\n orElse: () =>\n discard(\"stalled\", request, bytes)\n }),\n permits.withPermitsIfAvailable(1),\n Effect.flatMap(Option.match({\n onNone: () =>\n discard(\"saturated\", request, bytes),\n onSome: Effect.succeed\n }))\n )\n }))\n })\n)\n\nconst loopbackIpv4 = /^127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/\n\n/** Whether a decoded endpoint's host never leaves this machine. */\nconst isLoopback = (endpoint: string): boolean => {\n const hostname = new URL(endpoint).hostname\n return hostname === \"localhost\" || hostname === \"[::1]\" || loopbackIpv4.test(hostname)\n}\n\n/**\n * Refuses a credential header bound for a plaintext collector off this\n * machine. Anyone on the network path could read the token from every export\n * request, and the exporter would never report it. Loopback `http://` stays\n * allowed for a local collector or sidecar; non-credential headers such as a\n * tenant id stay allowed on any endpoint.\n */\n/**\n * Vendor credential headers whose names `Redaction.isSensitiveKey` does not\n * recognize. Honeycomb sends its ingest key as `x-honeycomb-team`.\n */\nconst vendorCredentialHeaders: ReadonlySet<string> = new Set([\"x-honeycomb-team\"])\n\nconst isCredentialHeader = (name: string): boolean =>\n Redaction.isSensitiveKey(name) || vendorCredentialHeaders.has(name.toLowerCase())\n\nconst refusePlaintextCredentials = (\n baseUrl: string,\n headers: Headers.Input | undefined\n): Effect.Effect<void, Endpoint.InvalidExporterEndpoint> => {\n if (!baseUrl.toLowerCase().startsWith(\"http:\") || isLoopback(baseUrl)) return Effect.void\n const credential = Object.keys(Headers.fromInput(headers)).some(isCredentialHeader)\n return credential\n ? Effect.fail(\n new Endpoint.InvalidExporterEndpoint({\n code: \"invalid_exporter_endpoint\",\n path: \"baseUrl\",\n message:\n \"OTLP collector baseUrl must use https:// when headers carry credentials, unless it is a loopback address\"\n })\n )\n : Effect.void\n}\n\nconst redactText = (text: string): string => String(Redaction.redact(text))\n\n/**\n * A failed span's error rebuilt with its text redacted. It keeps the original\n * error's `name` and `stack` (redacted) so the collector's exception type and\n * trace stay readable; it is exported to the collector and never thrown.\n */\nclass RedactedSpanError extends Schema.TaggedError<RedactedSpanError>()(\"@smthrs/observability/RedactedSpanError\", {\n message: Schema.String\n}) {}\n\n/**\n * A span failure rendered with credentials removed. The exporter serializes a\n * failed span's cause into its status message and `exception` events, which\n * would otherwise carry any token an error message quoted to the collector.\n */\nconst redactedExit = (exit: Exit.Exit<unknown, unknown>): Exit.Exit<unknown, unknown> => {\n if (exit._tag === \"Success\" || Cause.hasInterruptsOnly(exit.cause)) return exit\n const errors = Cause.prettyErrors(exit.cause, { includeCauseInStack: true }).map((error) => {\n const redacted = new RedactedSpanError({ message: redactText(error.message) })\n Object.defineProperty(redacted, \"name\", { value: redactText(error.name), configurable: true, writable: true })\n // `prettyErrors` always renders a stack.\n redacted.stack = redactText(String(error.stack))\n return redacted\n })\n return Exit.failCause(errors.map(Cause.fail).reduce(Cause.combine, Cause.empty as Cause.Cause<unknown>))\n}\n\n/**\n * Wraps the installed tracer so every exported span's failure and string\n * attributes pass through the journal redaction rules first.\n */\nconst redactedSpans = Layer.effect(Tracer.Tracer)(\n Effect.map(Effect.tracer, (tracer) =>\n Tracer.make({\n ...tracer,\n span(options) {\n const span = tracer.span(options)\n const end = span.end.bind(span)\n const attribute = span.attribute.bind(span)\n span.end = (endTime, exit) => end(endTime, redactedExit(exit))\n span.attribute = (key, value) => attribute(key, typeof value === \"string\" ? redactText(value) : value)\n return span\n }\n }))\n)\n\n/**\n * Configuration for the default OTLP wiring.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface Options {\n /**\n * The collector base URL, for example `http://localhost:4318`. Signals are\n * posted below it at `/v1/logs`, `/v1/metrics`, and `/v1/traces`. It must be\n * an absolute `http://` or `https://` URL without credentials, a query,\n * fragment, backslashes, spaces, or controls. A base path is allowed. Invalid\n * values fail acquisition with {@link Endpoint.InvalidExporterEndpoint}.\n * Use {@link Options.headers} for authentication.\n */\n readonly baseUrl: string\n /** Overrides {@link defaultServiceName} as the `service.name` attribute. */\n readonly serviceName?: string | undefined\n /** Overrides {@link defaultServiceVersion} as the `service.version` attribute. */\n readonly serviceVersion?: string | undefined\n /**\n * Additional resource attributes attached to every exported signal, decoded\n * by `Resource.Attributes`. The whole resource must encode to at most\n * `Resource.maximumResourceBytes`; a larger one fails acquisition with\n * {@link Resource.InvalidResourceConfiguration} rather than making every\n * request oversized.\n */\n readonly attributes?: Record<string, unknown> | undefined\n /**\n * Headers sent with every export request, for example vendor auth. A header\n * whose name names a credential (`authorization`, `x-api-key`, anything\n * `Redaction.isSensitiveKey` recognizes, plus `x-honeycomb-team`) requires\n * an `https://` baseUrl unless the host is loopback; otherwise acquisition\n * fails with\n * {@link Endpoint.InvalidExporterEndpoint}.\n */\n readonly headers?: Headers.Input | undefined\n /** Export cadence for all three signals; each signal's Effect default applies when omitted. */\n readonly exportInterval?: Duration.Input | undefined\n /** Upper bound on the shutdown flush when the layer's scope closes. */\n readonly shutdownTimeout?: Duration.Input | undefined\n}\n\n/**\n * Creates the OTLP logs, metrics, and traces layer with flows resource\n * defaults, JSON-serialized. Exports share a four-request limit with no waiting\n * queue. Requests larger than 1 MiB or stalled for ten seconds are discarded;\n * `flows_observability_otlp_dropped` counts discarded batches, and at most\n * once a minute a `Warn` record with code `otlp_export_discarded` names the\n * reason, the request size, and the running total through the loggers that\n * were installed when the layer was acquired, never through this exporter.\n *\n * **Details**\n *\n * The layer still requires an `HttpClient`, which is how it stays\n * platform-neutral: a Node host may hand it `@effect/platform-node`'s Undici\n * client (re-exported by `@smthrs/platform-node`), a browser or test\n * hands it something else. Use {@link layerFetch} when the host's global\n * `fetch` is good enough. On Node 26 and every browser it is.\n * Fetch redirects are refused. Supply `FetchHttpClient.RequestInit` around\n * the whole exporting effect to retain other fetch options; options scoped\n * only to the supplied client's layer are replaced by the redirect policy.\n * Other HTTP transports must independently refuse automatic redirects.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layer = (\n options: Options\n): Layer.Layer<\n never,\n Resource.InvalidResourceConfiguration | Endpoint.InvalidExporterEndpoint,\n HttpClient.HttpClient\n> =>\n Layer.unwrap(\n Effect.map(\n Effect.all([\n Resource.decode({\n serviceName: options.serviceName ?? defaultServiceName,\n serviceVersion: options.serviceVersion ?? defaultServiceVersion,\n ...(options.attributes === undefined ? {} : { attributes: options.attributes })\n }),\n Endpoint.decode(options.baseUrl, \"baseUrl\").pipe(\n Effect.tap((baseUrl) => refusePlaintextCredentials(baseUrl, options.headers))\n )\n ]),\n ([decoded, baseUrl]) => {\n const resource = Resource.toOpenTelemetryConfiguration(decoded)\n return (\n Otlp.layerJson({\n baseUrl,\n resource: {\n serviceName: resource.serviceName,\n // `serviceVersion` is supplied above before Resource decoding.\n serviceVersion: resource.serviceVersion!,\n ...(resource.attributes === undefined ? {} : { attributes: resource.attributes })\n },\n headers: options.headers,\n maxBatchSize,\n loggerExportInterval: options.exportInterval,\n metricsExportInterval: options.exportInterval,\n tracerExportInterval: options.exportInterval,\n shutdownTimeout: options.shutdownTimeout\n }).pipe(\n Layer.provide(boundedClient),\n // Upstream merges OTEL_RESOURCE_ATTRIBUTES even with explicit\n // options. Keep unvalidated ambient metadata out of every request.\n Layer.provide(ConfigProvider.layer(ConfigProvider.fromUnknown({}))),\n (exporter) => Layer.provideMerge(redactedSpans, exporter)\n )\n )\n }\n )\n )\n\n/**\n * Provides {@link layer} over the host's global `fetch`, the default wiring\n * for a Node host, and browser-safe by construction because it never touches\n * a `node:` built-in.\n *\n * **Example**\n *\n * ```ts\n * import * as Otlp from \"@smthrs/observability/Otlp\"\n *\n * const Telemetry = Otlp.layerFetch({ baseUrl: \"http://localhost:4318\" })\n * ```\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layerFetch = (\n options: Options\n): Layer.Layer<never, Resource.InvalidResourceConfiguration | Endpoint.InvalidExporterEndpoint> =>\n layer(options).pipe(Layer.provide(FetchHttpClient.layer))\n\n/**\n * Why an OTLP layer refused to start.\n *\n * @category errors\n * @since 1.0.0\n */\nexport type LayerError = Resource.InvalidResourceConfiguration | Endpoint.InvalidExporterEndpoint\n\n/**\n * Parses `OTEL_EXPORTER_OTLP_HEADERS`: comma-separated `key=value` pairs whose\n * values are percent-decoded, as the OpenTelemetry exporter specification\n * defines. A pair without `=` or with an empty key is skipped.\n *\n * @category environment\n * @since 1.0.0\n */\nexport const parseHeaders = (value: string | undefined): Record<string, string> => {\n const headers: Record<string, string> = {}\n for (const pair of (value ?? \"\").split(\",\")) {\n const separator = pair.indexOf(\"=\")\n const key = pair.slice(0, separator).trim()\n if (separator < 0 || key === \"\") continue\n const raw = pair.slice(separator + 1).trim()\n let decoded = raw\n try {\n decoded = decodeURIComponent(raw)\n } catch { /* A malformed escape is kept verbatim. */ }\n headers[key] = decoded\n }\n return headers\n}\n\n/**\n * {@link layerFetch} when the environment names a collector, otherwise\n * {@link layerNoop}.\n *\n * `OTEL_EXPORTER_OTLP_ENDPOINT` is the collector base URL and\n * `OTEL_EXPORTER_OTLP_HEADERS` the headers sent with every export. An unset or\n * empty endpoint installs no exporter at all.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerEnvironment = (\n environment: Readonly<Record<string, string | undefined>>,\n options: Omit<Options, \"baseUrl\" | \"headers\"> = {}\n): Layer.Layer<never, LayerError> => {\n const endpoint = environment[\"OTEL_EXPORTER_OTLP_ENDPOINT\"]?.trim()\n if (endpoint === undefined || endpoint === \"\") return layerNoop\n return layerFetch({ ...options, baseUrl: endpoint, headers: parseHeaders(environment[\"OTEL_EXPORTER_OTLP_HEADERS\"]) })\n}\n\n/**\n * Exports nothing. The explicit stand-in for hosts with no collector, such as\n * a development shell, a test, or a browser deployment that has not opted in, so\n * wiring code can switch layers rather than branch.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layerNoop: Layer.Layer<never> = Layer.empty\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,gBAA2B;AAC3B,YAAuB;AACvB,mBAAsB;AACtB,qBAAgC;AAEhC,aAAwB;AACxB,WAAsB;AACtB,YAAuB;AACvB,aAAwB;AACxB,aAAwB;AACxB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AM,QAAQ,eAAe,MAAM,eAAe,YAAY,CAAC,CAAC,CAAC,CAAC;AAAA,QAClE,CAAC,aAAa,MAAM,aAAa,eAAe,QAAQ;AAAA,MAC1D;AAAA,IAEJ;AAAA,EACF;AACF;AAkBK,MAAM,aAAa,CACxB,YAEA,MAAM,OAAO,EAAE,KAAK,MAAM,QAAQ,gBAAgB,KAAK,CAAC;AAkBnD,MAAM,eAAe,CAAC,UAAsD;AACjF,QAAM,UAAkC,CAAC;AACzC,aAAW,SAAS,SAAS,IAAI,MAAM,GAAG,GAAG;AAC3C,UAAM,YAAY,KAAK,QAAQ,GAAG;AAClC,UAAM,MAAM,KAAK,MAAM,GAAG,SAAS,EAAE,KAAK;AAC1C,QAAI,YAAY,KAAK,QAAQ,GAAI;AACjC,UAAM,MAAM,KAAK,MAAM,YAAY,CAAC,EAAE,KAAK;AAC3C,QAAI,UAAU;AACd,QAAI;AACF,gBAAU,mBAAmB,GAAG;AAAA,IAClC,QAAQ;AAAA,IAA6C;AACrD,YAAQ,GAAG,IAAI;AAAA,EACjB;AACA,SAAO;AACT;AAaO,MAAM,mBAAmB,CAC9B,aACA,UAAgD,CAAC,MACd;AACnC,QAAM,WAAW,YAAY,6BAA6B,GAAG,KAAK;AAClE,MAAI,aAAa,UAAa,aAAa,GAAI,QAAO;AACtD,SAAO,WAAW,EAAE,GAAG,SAAS,SAAS,UAAU,SAAS,aAAa,YAAY,4BAA4B,CAAC,EAAE,CAAC;AACvH;AAUO,MAAM,YAAgC,MAAM;",
6
6
  "names": []
7
7
  }
@@ -45,7 +45,7 @@ export declare const defaultServiceName = "flows";
45
45
  * @category resource
46
46
  * @since 0.1.0
47
47
  */
48
- export declare const defaultServiceVersion = "1.0.0-rc.3";
48
+ export declare const defaultServiceVersion = "1.0.0-rc.4";
49
49
  /**
50
50
  * Maximum encoded export request size, in bytes.
51
51
  * @category transport
package/dist/esm/Otlp.js CHANGED
@@ -60,7 +60,7 @@ export const defaultServiceName = "flows";
60
60
  * @category resource
61
61
  * @since 0.1.0
62
62
  */
63
- export const defaultServiceVersion = "1.0.0-rc.3";
63
+ export const defaultServiceVersion = "1.0.0-rc.4";
64
64
  // The upstream logger and tracer each buffer at most one 1,000-record batch.
65
65
  // Do not queue at the transport: upstream forks every full batch independently.
66
66
  const maxBatchSize = 1000;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@smthrs/observability",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.3",
4
+ "version": "1.0.0-rc.4",
5
5
  "license": "MIT",
6
6
  "smthrs": {
7
7
  "group": "engine"
@@ -165,7 +165,7 @@
165
165
  "dependencies": {
166
166
  "@opentelemetry/sdk-logs": "0.222.0",
167
167
  "@opentelemetry/sdk-metrics": "2.11.0",
168
- "@smthrs/journal": "1.0.0-rc.3"
168
+ "@smthrs/journal": "1.0.0-rc.4"
169
169
  },
170
170
  "devDependencies": {
171
171
  "@effect/language-service": "0.87.2",
package/src/Otlp.ts CHANGED
@@ -66,7 +66,7 @@ export const defaultServiceName = "flows"
66
66
  * @category resource
67
67
  * @since 0.1.0
68
68
  */
69
- export const defaultServiceVersion = "1.0.0-rc.3"
69
+ export const defaultServiceVersion = "1.0.0-rc.4"
70
70
 
71
71
  // The upstream logger and tracer each buffer at most one 1,000-record batch.
72
72
  // Do not queue at the transport: upstream forks every full batch independently.