@smthrs/observability 0.35.0 → 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.
- package/CHANGELOG.md +56 -0
- package/LICENSE +1 -1
- package/README.md +84 -0
- package/dist/cjs/BrowserOtel.d.ts +37 -0
- package/dist/cjs/BrowserOtel.d.ts.map +1 -0
- package/dist/cjs/BrowserOtel.js +47 -0
- package/dist/cjs/BrowserOtel.js.map +7 -0
- package/dist/cjs/Endpoint.d.ts +70 -0
- package/dist/cjs/Endpoint.d.ts.map +1 -0
- package/dist/cjs/Endpoint.js +85 -0
- package/dist/cjs/Endpoint.js.map +7 -0
- package/dist/cjs/JournalLogger.d.ts +232 -0
- package/dist/cjs/JournalLogger.d.ts.map +1 -0
- package/dist/cjs/JournalLogger.js +388 -0
- package/dist/cjs/JournalLogger.js.map +7 -0
- package/dist/cjs/Logger.d.ts +55 -0
- package/dist/cjs/Logger.d.ts.map +1 -0
- package/dist/cjs/Logger.js +72 -0
- package/dist/cjs/Logger.js.map +7 -0
- package/dist/cjs/Metric.d.ts +67 -0
- package/dist/cjs/Metric.d.ts.map +1 -0
- package/dist/cjs/Metric.js +68 -0
- package/dist/cjs/Metric.js.map +7 -0
- package/dist/cjs/NodeOtel.d.ts +42 -0
- package/dist/cjs/NodeOtel.d.ts.map +1 -0
- package/dist/cjs/NodeOtel.js +78 -0
- package/dist/cjs/NodeOtel.js.map +7 -0
- package/dist/cjs/Otel.d.ts +62 -0
- package/dist/cjs/Otel.d.ts.map +1 -0
- package/dist/cjs/Otel.js +75 -0
- package/dist/cjs/Otel.js.map +7 -0
- package/dist/cjs/Otlp.d.ts +200 -0
- package/dist/cjs/Otlp.d.ts.map +1 -0
- package/dist/cjs/Otlp.js +235 -0
- package/dist/cjs/Otlp.js.map +7 -0
- package/dist/cjs/Resource.d.ts +162 -0
- package/dist/cjs/Resource.d.ts.map +1 -0
- package/dist/cjs/Resource.js +186 -0
- package/dist/cjs/Resource.js.map +7 -0
- package/dist/cjs/index.d.ts +61 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/schemaIssuePath.d.ts +31 -0
- package/dist/cjs/internal/schemaIssuePath.d.ts.map +1 -0
- package/dist/cjs/internal/schemaIssuePath.js +49 -0
- package/dist/cjs/internal/schemaIssuePath.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/BrowserOtel.d.ts +37 -0
- package/dist/esm/BrowserOtel.d.ts.map +1 -0
- package/dist/esm/BrowserOtel.js +24 -0
- package/dist/esm/BrowserOtel.js.map +1 -0
- package/dist/esm/Endpoint.d.ts +70 -0
- package/dist/esm/Endpoint.d.ts.map +1 -0
- package/dist/esm/Endpoint.js +110 -0
- package/dist/esm/Endpoint.js.map +1 -0
- package/dist/esm/JournalLogger.d.ts +232 -0
- package/dist/esm/JournalLogger.d.ts.map +1 -0
- package/dist/esm/JournalLogger.js +482 -0
- package/dist/esm/JournalLogger.js.map +1 -0
- package/dist/esm/Logger.d.ts +55 -0
- package/dist/esm/Logger.d.ts.map +1 -0
- package/dist/esm/Logger.js +60 -0
- package/dist/esm/Logger.js.map +1 -0
- package/dist/esm/Metric.d.ts +67 -0
- package/dist/esm/Metric.d.ts.map +1 -0
- package/dist/esm/Metric.js +80 -0
- package/dist/esm/Metric.js.map +1 -0
- package/dist/esm/NodeOtel.d.ts +42 -0
- package/dist/esm/NodeOtel.d.ts.map +1 -0
- package/dist/esm/NodeOtel.js +56 -0
- package/dist/esm/NodeOtel.js.map +1 -0
- package/dist/esm/Otel.d.ts +62 -0
- package/dist/esm/Otel.d.ts.map +1 -0
- package/dist/esm/Otel.js +51 -0
- package/dist/esm/Otel.js.map +1 -0
- package/dist/esm/Otlp.d.ts +200 -0
- package/dist/esm/Otlp.d.ts.map +1 -0
- package/dist/esm/Otlp.js +350 -0
- package/dist/esm/Otlp.js.map +1 -0
- package/dist/esm/Resource.d.ts +162 -0
- package/dist/esm/Resource.d.ts.map +1 -0
- package/dist/esm/Resource.js +237 -0
- package/dist/esm/Resource.js.map +1 -0
- package/dist/esm/index.d.ts +61 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +61 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/schemaIssuePath.d.ts +31 -0
- package/dist/esm/internal/schemaIssuePath.d.ts.map +1 -0
- package/dist/esm/internal/schemaIssuePath.js +59 -0
- package/dist/esm/internal/schemaIssuePath.js.map +1 -0
- package/docs/README.md +162 -0
- package/docs/api.md +768 -0
- package/docs/concepts/instrumentation-and-export.md +68 -0
- package/docs/concepts/layer-map.md +72 -0
- package/docs/concepts/validated-acquisition.md +105 -0
- package/docs/guides/export-to-a-collector.md +167 -0
- package/docs/guides/forward-logs-to-the-journal.md +226 -0
- package/docs/guides/install-a-logger.md +111 -0
- package/docs/guides/read-runtime-metrics.md +83 -0
- package/docs/guides/testing.md +134 -0
- package/docs/guides/wire-an-opentelemetry-sdk.md +220 -0
- package/docs/installation.md +98 -0
- package/docs/quickstart.md +145 -0
- package/docs/troubleshooting.md +168 -0
- package/package.json +221 -32
- package/src/BrowserOtel.ts +51 -0
- package/src/Endpoint.ts +131 -0
- package/src/JournalLogger.ts +596 -0
- package/src/Logger.ts +106 -0
- package/src/Metric.ts +88 -0
- package/src/NodeOtel.ts +90 -0
- package/src/Otel.ts +117 -0
- package/src/Otlp.ts +477 -0
- package/src/Resource.ts +324 -0
- package/src/index.ts +67 -0
- package/src/internal/schemaIssuePath.ts +65 -0
- package/docker-compose.otel.yml +0 -104
- package/grafana/dashboards/smithers-dashboard.json +0 -453
- package/grafana/provisioning/dashboards/dashboards.yml +0 -12
- package/grafana/provisioning/datasources/datasources.yml +0 -49
- package/loki/loki-config.yaml +0 -35
- package/otel-collector-config.yml +0 -38
- package/prometheus/prometheus.yml +0 -8
- package/src/MetricName.ts +0 -1
- package/src/MetricsServiceLive.js +0 -9
- package/src/README.md +0 -28
- package/src/ResolvedSmithersObservabilityOptions.ts +0 -12
- package/src/SmithersEvent.ts +0 -843
- package/src/SmithersLogFormat.ts +0 -1
- package/src/SmithersMetricDefinition.ts +0 -15
- package/src/SmithersMetricType.ts +0 -1
- package/src/SmithersMetricUnit.ts +0 -1
- package/src/SmithersObservability.js +0 -15
- package/src/SmithersObservabilityOptions.ts +0 -12
- package/src/SmithersObservabilityService.ts +0 -13
- package/src/_coreCorrelation/CorrelationContext.ts +0 -10
- package/src/_coreCorrelation/CorrelationContextLive.js +0 -11
- package/src/_coreCorrelation/CorrelationContextService.js +0 -15
- package/src/_coreCorrelation/CorrelationContextServiceShape.ts +0 -12
- package/src/_coreCorrelation/CorrelationPatch.ts +0 -3
- package/src/_coreCorrelation/README.md +0 -20
- package/src/_coreCorrelation/_correlationStorage.js +0 -4
- package/src/_coreCorrelation/correlationContextFiberRef.js +0 -5
- package/src/_coreCorrelation/correlationContextToLogAnnotations.js +0 -18
- package/src/_coreCorrelation/getCurrentCorrelationContext.js +0 -9
- package/src/_coreCorrelation/getCurrentCorrelationContextEffect.js +0 -11
- package/src/_coreCorrelation/index.js +0 -14
- package/src/_coreCorrelation/mergeCorrelationContext.js +0 -51
- package/src/_coreCorrelation/runWithCorrelationContext.js +0 -14
- package/src/_coreCorrelation/updateCurrentCorrelationContext.js +0 -17
- package/src/_coreCorrelation/withCorrelationContext.js +0 -38
- package/src/_coreCorrelation/withCurrentCorrelationContext.js +0 -11
- package/src/_coreMetrics.js +0 -14
- package/src/_coreMetricsShape.ts +0 -44
- package/src/_corePrometheus.js +0 -91
- package/src/_corePrometheusShape.ts +0 -11
- package/src/_coreTracing.js +0 -132
- package/src/_coreTracingShape.ts +0 -17
- package/src/_otelLogBuilders.js +0 -102
- package/src/_sessionFileResolvers.js +0 -164
- package/src/_smithersSpanAttributeAliases.js +0 -19
- package/src/_smithersTraceSpanStorage.js +0 -3
- package/src/_traceEventNormalizers.js +0 -499
- package/src/_traceRedaction.js +0 -162
- package/src/agentSessionEventToOtelLogRecord.js +0 -55
- package/src/agentTrace.ts +0 -144
- package/src/agentTraceCapabilities.js +0 -151
- package/src/annotateSmithersTrace.js +0 -11
- package/src/canonicalTraceEventToOtelLogRecord.js +0 -55
- package/src/correlation.js +0 -56
- package/src/createSmithersObservabilityLayer.js +0 -59
- package/src/createSmithersOtelLayer.js +0 -23
- package/src/createSmithersRuntimeLayer.js +0 -2
- package/src/detectAgentFamily.js +0 -26
- package/src/detectCaptureMode.js +0 -29
- package/src/emitOtelLogRecord.js +0 -19
- package/src/getCurrentSmithersTraceAnnotations.js +0 -14
- package/src/getCurrentSmithersTraceSpan.js +0 -7
- package/src/index.d.ts +0 -1392
- package/src/index.js +0 -137
- package/src/kindPhase.js +0 -17
- package/src/logging.js +0 -264
- package/src/makeSmithersSpanAttributes.js +0 -20
- package/src/metrics/README.md +0 -22
- package/src/metrics/SmithersMetricDefinition.ts +0 -17
- package/src/metrics/SmithersMetricType.ts +0 -1
- package/src/metrics/SmithersMetricUnit.ts +0 -1
- package/src/metrics/_asyncExternalWaitCounts.js +0 -4
- package/src/metrics/_buckets.js +0 -37
- package/src/metrics/_incrementGauge.js +0 -11
- package/src/metrics/_processStartMs.js +0 -1
- package/src/metrics/activeNodes.js +0 -2
- package/src/metrics/activeRuns.js +0 -2
- package/src/metrics/agentActionsTotal.js +0 -2
- package/src/metrics/agentDurationMs.js +0 -3
- package/src/metrics/agentErrorsTotal.js +0 -2
- package/src/metrics/agentEventsTotal.js +0 -2
- package/src/metrics/agentInvocationsTotal.js +0 -2
- package/src/metrics/agentRetriesTotal.js +0 -2
- package/src/metrics/agentSessionsTotal.js +0 -2
- package/src/metrics/agentTokensTotal.js +0 -2
- package/src/metrics/alertDeliveriesAttempted.js +0 -2
- package/src/metrics/alertDeliveriesSuppressed.js +0 -2
- package/src/metrics/alertsAcknowledgedTotal.js +0 -2
- package/src/metrics/alertsActive.js +0 -2
- package/src/metrics/alertsEscalatedTotal.js +0 -2
- package/src/metrics/alertsFiredTotal.js +0 -2
- package/src/metrics/alertsReopenedTotal.js +0 -2
- package/src/metrics/alertsResolvedTotal.js +0 -2
- package/src/metrics/alertsSilencedTotal.js +0 -2
- package/src/metrics/approvalPending.js +0 -2
- package/src/metrics/approvalWaitDuration.js +0 -5
- package/src/metrics/approvalsDenied.js +0 -2
- package/src/metrics/approvalsGranted.js +0 -2
- package/src/metrics/approvalsRequested.js +0 -2
- package/src/metrics/attemptDuration.js +0 -3
- package/src/metrics/attentionBacklog.js +0 -2
- package/src/metrics/cacheHits.js +0 -2
- package/src/metrics/cacheMisses.js +0 -2
- package/src/metrics/dbQueryDuration.js +0 -3
- package/src/metrics/dbRetries.js +0 -2
- package/src/metrics/dbTransactionDuration.js +0 -3
- package/src/metrics/dbTransactionRetries.js +0 -2
- package/src/metrics/dbTransactionRollbacks.js +0 -2
- package/src/metrics/devtoolsActiveSubscribers.js +0 -2
- package/src/metrics/devtoolsBackpressureDisconnectTotal.js +0 -2
- package/src/metrics/devtoolsDeltaBuildMs.js +0 -3
- package/src/metrics/devtoolsEventBytes.js +0 -3
- package/src/metrics/devtoolsEventTotal.js +0 -2
- package/src/metrics/devtoolsSnapshotBuildMs.js +0 -5
- package/src/metrics/devtoolsSubscribeTotal.js +0 -2
- package/src/metrics/errorsTotal.js +0 -2
- package/src/metrics/eventsEmittedTotal.js +0 -2
- package/src/metrics/externalWaitAsyncPending.js +0 -2
- package/src/metrics/gatewayApprovalDecisionsTotal.js +0 -2
- package/src/metrics/gatewayAuthEventsTotal.js +0 -2
- package/src/metrics/gatewayConnectionsActive.js +0 -2
- package/src/metrics/gatewayConnectionsClosedTotal.js +0 -2
- package/src/metrics/gatewayConnectionsTotal.js +0 -2
- package/src/metrics/gatewayCronTriggersTotal.js +0 -2
- package/src/metrics/gatewayErrorsTotal.js +0 -2
- package/src/metrics/gatewayHeartbeatTicksTotal.js +0 -2
- package/src/metrics/gatewayMessagesReceivedTotal.js +0 -2
- package/src/metrics/gatewayMessagesSentTotal.js +0 -2
- package/src/metrics/gatewayRpcCallsTotal.js +0 -2
- package/src/metrics/gatewayRpcDuration.js +0 -3
- package/src/metrics/gatewayRunEventBackpressureDisconnectTotal.js +0 -4
- package/src/metrics/gatewayRunsCompletedTotal.js +0 -2
- package/src/metrics/gatewayRunsStartedTotal.js +0 -2
- package/src/metrics/gatewaySignalsTotal.js +0 -2
- package/src/metrics/gatewayWebhooksReceivedTotal.js +0 -2
- package/src/metrics/gatewayWebhooksRejectedTotal.js +0 -2
- package/src/metrics/gatewayWebhooksVerifiedTotal.js +0 -2
- package/src/metrics/heartbeatDataSizeBytes.js +0 -5
- package/src/metrics/heartbeatIntervalMs.js +0 -3
- package/src/metrics/hotReloadDuration.js +0 -3
- package/src/metrics/hotReloadFailures.js +0 -2
- package/src/metrics/hotReloads.js +0 -2
- package/src/metrics/httpRequestDuration.js +0 -3
- package/src/metrics/httpRequests.js +0 -2
- package/src/metrics/index.d.ts +0 -1222
- package/src/metrics/index.js +0 -168
- package/src/metrics/memoryFactReads.js +0 -3
- package/src/metrics/memoryFactWrites.js +0 -3
- package/src/metrics/memoryMessageSaves.js +0 -3
- package/src/metrics/memoryRecallDuration.js +0 -11
- package/src/metrics/memoryRecallQueries.js +0 -3
- package/src/metrics/metricsServiceAdapter.js +0 -181
- package/src/metrics/nodeDuration.js +0 -3
- package/src/metrics/nodeRetriesTotal.js +0 -2
- package/src/metrics/nodesFailed.js +0 -2
- package/src/metrics/nodesFinished.js +0 -2
- package/src/metrics/nodesStarted.js +0 -2
- package/src/metrics/openApiToolCallErrorsTotal.js +0 -3
- package/src/metrics/openApiToolCallsTotal.js +0 -3
- package/src/metrics/openApiToolDuration.js +0 -9
- package/src/metrics/processHeapUsedBytes.js +0 -2
- package/src/metrics/processMemoryRssBytes.js +0 -2
- package/src/metrics/processUptimeSeconds.js +0 -2
- package/src/metrics/promptSizeBytes.js +0 -3
- package/src/metrics/replaysStarted.js +0 -3
- package/src/metrics/responseSizeBytes.js +0 -3
- package/src/metrics/rewindDurationMs.js +0 -3
- package/src/metrics/rewindFramesDeleted.js +0 -3
- package/src/metrics/rewindRollbackTotal.js +0 -2
- package/src/metrics/rewindSandboxesReverted.js +0 -3
- package/src/metrics/rewindTotal.js +0 -2
- package/src/metrics/runDuration.js +0 -3
- package/src/metrics/runForksCreated.js +0 -3
- package/src/metrics/runsAncestryDepth.js +0 -3
- package/src/metrics/runsCancelledTotal.js +0 -2
- package/src/metrics/runsCarriedStateBytes.js +0 -5
- package/src/metrics/runsContinuedTotal.js +0 -2
- package/src/metrics/runsFailedTotal.js +0 -2
- package/src/metrics/runsFinishedTotal.js +0 -2
- package/src/metrics/runsResumedTotal.js +0 -2
- package/src/metrics/runsTotal.js +0 -2
- package/src/metrics/sandboxActive.js +0 -2
- package/src/metrics/sandboxBundleSizeBytes.js +0 -5
- package/src/metrics/sandboxCompletedTotal.js +0 -2
- package/src/metrics/sandboxCreatedTotal.js +0 -2
- package/src/metrics/sandboxDurationMs.js +0 -3
- package/src/metrics/sandboxPatchCount.js +0 -3
- package/src/metrics/sandboxTransportDurationMs.js +0 -5
- package/src/metrics/schedulerConcurrencyUtilization.js +0 -2
- package/src/metrics/schedulerQueueDepth.js +0 -2
- package/src/metrics/schedulerWaitDuration.js +0 -5
- package/src/metrics/scorerDuration.js +0 -9
- package/src/metrics/scorerEventsFailed.js +0 -2
- package/src/metrics/scorerEventsFinished.js +0 -2
- package/src/metrics/scorerEventsStarted.js +0 -2
- package/src/metrics/scorersFailed.js +0 -3
- package/src/metrics/scorersFinished.js +0 -3
- package/src/metrics/scorersStarted.js +0 -3
- package/src/metrics/smithersMetricCatalog.js +0 -893
- package/src/metrics/smithersMetricCatalogByKey.js +0 -2
- package/src/metrics/smithersMetricCatalogByName.js +0 -2
- package/src/metrics/smithersMetricCatalogByPrometheusName.js +0 -4
- package/src/metrics/snapshotDuration.js +0 -9
- package/src/metrics/snapshotsCaptured.js +0 -3
- package/src/metrics/supervisorPollDuration.js +0 -5
- package/src/metrics/supervisorPollsTotal.js +0 -2
- package/src/metrics/supervisorResumeLag.js +0 -5
- package/src/metrics/supervisorResumedTotal.js +0 -2
- package/src/metrics/supervisorSkippedTotal.js +0 -2
- package/src/metrics/supervisorStaleDetected.js +0 -2
- package/src/metrics/taskHeartbeatTimeoutTotal.js +0 -2
- package/src/metrics/taskHeartbeatsTotal.js +0 -2
- package/src/metrics/timerDelayDuration.js +0 -3
- package/src/metrics/timersCancelled.js +0 -2
- package/src/metrics/timersCreated.js +0 -2
- package/src/metrics/timersFired.js +0 -2
- package/src/metrics/timersPending.js +0 -2
- package/src/metrics/toPrometheusMetricName.js +0 -8
- package/src/metrics/tokensCacheReadTotal.js +0 -2
- package/src/metrics/tokensCacheWriteTotal.js +0 -2
- package/src/metrics/tokensContextWindowBucketTotal.js +0 -2
- package/src/metrics/tokensContextWindowPerCall.js +0 -5
- package/src/metrics/tokensInputPerCall.js +0 -3
- package/src/metrics/tokensInputTotal.js +0 -2
- package/src/metrics/tokensOutputPerCall.js +0 -3
- package/src/metrics/tokensOutputTotal.js +0 -2
- package/src/metrics/tokensReasoningTotal.js +0 -2
- package/src/metrics/toolCallErrorsTotal.js +0 -2
- package/src/metrics/toolCallsTotal.js +0 -2
- package/src/metrics/toolDuration.js +0 -3
- package/src/metrics/toolOutputTruncatedTotal.js +0 -2
- package/src/metrics/trackEvent.js +0 -608
- package/src/metrics/updateAsyncExternalWaitPending.js +0 -18
- package/src/metrics/updateProcessMetrics.js +0 -20
- package/src/metrics/vcsDuration.js +0 -3
- package/src/normalizeStructuredEvent.js +0 -15
- package/src/prometheusContentType.js +0 -1
- package/src/renderPrometheusMetrics.js +0 -212
- package/src/resolveAgentTraceCapabilities.js +0 -59
- package/src/resolveSmithersObservabilityOptions.js +0 -109
- package/src/smithersMetrics.js +0 -2
- package/src/smithersSpanNames.js +0 -6
- package/src/unsupportedKindsForCapabilities.js +0 -32
- package/src/withSmithersSpan.js +0 -17
- package/tempo/tempo.yml +0 -17
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @smthrs/observability
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [1.0.0-rc.0] - 2026-09-01
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Effect-native OTLP export, structured logger layers, validated OpenTelemetry
|
|
10
|
+
resource metadata, provider-neutral SDK bridges, and explicit Node and
|
|
11
|
+
browser SDK subpaths.
|
|
12
|
+
- A bounded, asynchronous journal logger with versioned cause payloads,
|
|
13
|
+
durable journal-owned identities, synchronous detached snapshots, and the
|
|
14
|
+
shared credential-redaction rules.
|
|
15
|
+
- Package-owned generated README and API documentation.
|
|
16
|
+
- Producer-wired run throughput, active seat, and quota park metrics.
|
|
17
|
+
- A `droppedLogRecords` counter for every operational log record lost to queue
|
|
18
|
+
overflow, journal delivery failure, or a journal defect.
|
|
19
|
+
- An `Endpoint` module that decodes and normalizes the collector endpoint every
|
|
20
|
+
OTLP builder posts to.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Removed duplicate cache hit, miss, and hit-rate handles; the authoritative
|
|
25
|
+
cache series remain in `@smthrs/step-cache`.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Recreated or concurrent journal logger layers no longer reuse `sourceSeq`
|
|
30
|
+
identities and silently lose records.
|
|
31
|
+
- Queued records no longer observe later caller mutation or discard Effect
|
|
32
|
+
failure, defect, and interruption causes.
|
|
33
|
+
- All resource builders now reject the same malformed identities, Unicode,
|
|
34
|
+
attribute keys, values, and resource sizes with one typed error.
|
|
35
|
+
- Logger capacity, identifier, snapshot, overflow, and shutdown behavior is
|
|
36
|
+
explicit and covered at its exact boundaries.
|
|
37
|
+
- A logged value large enough to spend the snapshot budget no longer turns
|
|
38
|
+
`annotations` into a scalar, and a projection that still fails `TelemetryLog`
|
|
39
|
+
degrades to a decodable total record instead of an undecodable journal row.
|
|
40
|
+
- Journal delivery failures and journal defects are reported as warnings and
|
|
41
|
+
counted instead of vanishing, and a defect no longer ends the forwarding
|
|
42
|
+
worker for the rest of the run. Interruption still ends it.
|
|
43
|
+
- Snapshot truncation runs in one pass instead of about twenty re-encodes and
|
|
44
|
+
never cuts a surrogate pair.
|
|
45
|
+
- An unusable collector endpoint fails layer acquisition instead of producing a
|
|
46
|
+
layer that exports nothing, and repeated trailing separators no longer
|
|
47
|
+
produce a double slash in a signal URL.
|
|
48
|
+
- The logger layers no longer pin the application's `MinimumLogLevel` when the
|
|
49
|
+
caller named no level.
|
|
50
|
+
|
|
51
|
+
### Documentation
|
|
52
|
+
|
|
53
|
+
- Corrected the reason `NodeOtel` cannot be re-exported from the root barrel:
|
|
54
|
+
it resolves Node-only host modules, including a bare `async_hooks` specifier,
|
|
55
|
+
rather than a `node:` built-in.
|
|
56
|
+
- Removed the internal review markers from every published JSDoc block.
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 William Cory and the Smithers Flows contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @smthrs/observability
|
|
2
|
+
|
|
3
|
+
Release candidate scope, host requirements and compatibility review are defined in the [library support policy](https://github.com/smithersai/smithers/blob/main/RELEASE_SUPPORT.md).
|
|
4
|
+
|
|
5
|
+
This package declares `effect` as an exact
|
|
6
|
+
`4.0.0-rc.115` peer dependency. Keep the application on that version so
|
|
7
|
+
all Smithers packages share one Effect runtime.
|
|
8
|
+
|
|
9
|
+
**Documentation:** https://observability.smithers.sh
|
|
10
|
+
|
|
11
|
+
# `@smthrs/observability`
|
|
12
|
+
|
|
13
|
+
Send an Effect program's logs, metrics, and traces to an OpenTelemetry collector with one layer.
|
|
14
|
+
|
|
15
|
+
`Otlp` composes only what `effect` itself ships, so it allocates no OpenTelemetry SDK, never resolves a `node:` built-in, and runs unchanged in Node, Bun, and a browser. Around it the package ships the pieces a host installs beside an exporter: Effect logger layers, a validated `Resource` describing the service, a `JournalLogger` that mirrors a run's log records into a durable journal, the runtime `Metric` handles that cross package boundaries, and `Otel`, which bridges OpenTelemetry providers an application already built.
|
|
16
|
+
|
|
17
|
+
`NodeOtel` and `BrowserOtel` are deliberately not re-exported from the root. Each binds a host-specific OpenTelemetry SDK: `NodeOtel` reaches `@effect/opentelemetry/NodeSdk` and `@opentelemetry/sdk-trace-node`, which pulls the bare `async_hooks` specifier through `@opentelemetry/context-async-hooks`. Re-exporting it would put a module a browser bundler cannot resolve in the root entry point. Import them by subpath instead: `@smthrs/observability/NodeOtel`.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
Not on npm yet; see [Installation](https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/flow/docs/installation.md#use-the-libraries).
|
|
22
|
+
|
|
23
|
+
Node.js 26.4.0 or later. Effect services are identified by module identity, so install the same `effect` release this package is built against.
|
|
24
|
+
|
|
25
|
+
The default install supports the root, `Otlp`, `Otel`, and `Resource`, with
|
|
26
|
+
required `@effect/opentelemetry@4.0.0-rc.115` and `@opentelemetry/api@1.9.1`
|
|
27
|
+
peers. It includes no HTTP exporters or trace SDK. Select the optional peers
|
|
28
|
+
for the host subpath you import:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
# @smthrs/observability/NodeOtel
|
|
32
|
+
pnpm add @opentelemetry/exporter-logs-otlp-http@0.222.0 @opentelemetry/exporter-metrics-otlp-http@0.222.0 @opentelemetry/exporter-trace-otlp-http@0.222.0 @opentelemetry/sdk-trace-base@2.11.0 @opentelemetry/sdk-trace-node@2.11.0
|
|
33
|
+
# @smthrs/observability/BrowserOtel
|
|
34
|
+
pnpm add @opentelemetry/sdk-trace-base@2.11.0 @opentelemetry/sdk-trace-web@2.11.0
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Use
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import * as Otlp from "@smthrs/observability/Otlp"
|
|
41
|
+
|
|
42
|
+
const Telemetry = Otlp.layerFetch({
|
|
43
|
+
baseUrl: "http://localhost:4318",
|
|
44
|
+
serviceName: "my-service"
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Provide the layer, give it a scope, and every span, log record, and metric series the program already produces posts to the collector. Deleting the provide removes telemetry and changes nothing else.
|
|
49
|
+
|
|
50
|
+
Resource identity fields and attribute keys are limited to 1,024 UTF-16 code
|
|
51
|
+
units, strings to 65,536 code units, and attributes to 256 entries.
|
|
52
|
+
Resources are refused during layer acquisition with `InvalidResourceConfiguration`
|
|
53
|
+
if arrays exceed 256 elements or the whole OTLP JSON resource exceeds 128 KiB.
|
|
54
|
+
The byte budget counts keys, values, wrappers, JSON escaping, and UTF-8, including
|
|
55
|
+
service identity and SDK-added `telemetry.sdk.name` and `telemetry.sdk.language`.
|
|
56
|
+
These SDK fields are reserved even for the default Effect exporter. Resource
|
|
57
|
+
metadata is explicit; both default OTLP and Node SDK layers isolate ambient
|
|
58
|
+
resource configuration so it cannot enlarge a resource after validation.
|
|
59
|
+
The 1 MiB transport reserves 8 KiB for the request envelope
|
|
60
|
+
and 888 KiB (`Otlp.reservedBatchBytes`) for signal batches: about 909 bytes per
|
|
61
|
+
record in the upstream 1,000-record log or span batch. Large application records
|
|
62
|
+
can still exceed the transport cap.
|
|
63
|
+
|
|
64
|
+
Discarded batches increment `flows_observability_otlp_dropped` and emit a
|
|
65
|
+
`Warn` diagnostic with code `otlp_export_discarded` at most once per minute per
|
|
66
|
+
transport through the loggers installed before exporter acquisition. Install
|
|
67
|
+
an ambient logger that writes outside OTLP to observe loss independently; an
|
|
68
|
+
empty logger set or a minimum level above `Warn` suppresses that diagnostic.
|
|
69
|
+
The warning never enters this exporter and includes only the discard reason,
|
|
70
|
+
request bytes, byte limit, and running drop count.
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
Full documentation is at [observability.smithers.sh](https://observability.smithers.sh):
|
|
75
|
+
|
|
76
|
+
- [Quickstart](https://observability.smithers.sh/quickstart/): export a trace, a log record, and a metric series to a collector you can watch.
|
|
77
|
+
- [Installation](https://observability.smithers.sh/installation/): requirements, import forms, and the rule that keeps the root entry point bundling for a browser.
|
|
78
|
+
- [The layer map](https://observability.smithers.sh/concepts/layer-map/): which builder to reach for, and what each one costs.
|
|
79
|
+
- [API reference](https://observability.smithers.sh/reference/api/): every public export, with validation, backpressure, shutdown, retry, and platform contracts.
|
|
80
|
+
- [Troubleshooting](https://observability.smithers.sh/troubleshooting/): the typed refusals this package reports, and the silent cases that are not refusals at all.
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser OpenTelemetry setup with explicitly injected providers/readers.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import type { LogRecordProcessor } from "@opentelemetry/sdk-logs";
|
|
7
|
+
import type { MetricReader } from "@opentelemetry/sdk-metrics";
|
|
8
|
+
import type { SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
9
|
+
import * as Layer from "effect/Layer";
|
|
10
|
+
import * as Resource from "./Resource.ts";
|
|
11
|
+
import type { Configuration as ResourceConfiguration } from "./Resource.ts";
|
|
12
|
+
/**
|
|
13
|
+
* Browser OTEL layer options. Processors and readers are created by the
|
|
14
|
+
* caller's factories, which keeps this module free of Node imports and browser
|
|
15
|
+
* exporter policy. Every factory is owned: it runs once during layer
|
|
16
|
+
* acquisition, after resource validation, and the layer scope shuts down
|
|
17
|
+
* everything it returned. An empty array installs nothing for that signal.
|
|
18
|
+
*
|
|
19
|
+
* @category models
|
|
20
|
+
* @since 0.1.0
|
|
21
|
+
*/
|
|
22
|
+
export interface Options {
|
|
23
|
+
readonly resource: ResourceConfiguration;
|
|
24
|
+
readonly spanProcessor?: (() => SpanProcessor | ReadonlyArray<SpanProcessor>) | undefined;
|
|
25
|
+
readonly logRecordProcessor?: (() => LogRecordProcessor | ReadonlyArray<LogRecordProcessor>) | undefined;
|
|
26
|
+
readonly metricReader?: (() => MetricReader | ReadonlyArray<MetricReader>) | undefined;
|
|
27
|
+
readonly loggerMergeWithExisting?: boolean | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Builds a scoped browser OpenTelemetry layer. The web SDK owns every
|
|
31
|
+
* processor and reader the factories return and shuts them down on release.
|
|
32
|
+
*
|
|
33
|
+
* @category layers
|
|
34
|
+
* @since 0.1.0
|
|
35
|
+
*/
|
|
36
|
+
export declare const layerOtel: (options: Options) => Layer.Layer<never, Resource.InvalidResourceConfiguration>;
|
|
37
|
+
//# sourceMappingURL=BrowserOtel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserOtel.d.ts","sourceRoot":"","sources":["../../src/BrowserOtel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAElE,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAE3E;;;;;;;;;GASG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAA;IACxC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC,GAAG,SAAS,CAAA;IACzF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC,GAAG,SAAS,CAAA;IACxG,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC,GAAG,SAAS,CAAA;IACtF,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACvD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,SAAS,OAAO,KAAG,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,4BAA4B,CAUlG,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var BrowserOtel_exports = {};
|
|
30
|
+
__export(BrowserOtel_exports, {
|
|
31
|
+
layerOtel: () => layerOtel
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(BrowserOtel_exports);
|
|
34
|
+
var WebSdk = __toESM(require("@effect/opentelemetry/WebSdk"), 1);
|
|
35
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
36
|
+
var Layer = __toESM(require("effect/Layer"), 1);
|
|
37
|
+
var Resource = __toESM(require("./Resource.js"), 1);
|
|
38
|
+
const layerOtel = (options) => Layer.unwrap(
|
|
39
|
+
Effect.map(Resource.decode(options.resource), (decoded) => WebSdk.layer(() => ({
|
|
40
|
+
resource: Resource.toOpenTelemetryConfiguration(decoded),
|
|
41
|
+
spanProcessor: options.spanProcessor?.(),
|
|
42
|
+
logRecordProcessor: options.logRecordProcessor?.(),
|
|
43
|
+
metricReader: options.metricReader?.(),
|
|
44
|
+
loggerMergeWithExisting: options.loggerMergeWithExisting
|
|
45
|
+
})))
|
|
46
|
+
);
|
|
47
|
+
//# sourceMappingURL=BrowserOtel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BrowserOtel.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Browser OpenTelemetry setup with explicitly injected providers/readers.\n *\n * @since 0.1.0\n */\n\nimport * as WebSdk from \"@effect/opentelemetry/WebSdk\"\nimport type { LogRecordProcessor } from \"@opentelemetry/sdk-logs\"\nimport type { MetricReader } from \"@opentelemetry/sdk-metrics\"\nimport type { SpanProcessor } from \"@opentelemetry/sdk-trace-base\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as Resource from \"./Resource.ts\"\nimport type { Configuration as ResourceConfiguration } from \"./Resource.ts\"\n\n/**\n * Browser OTEL layer options. Processors and readers are created by the\n * caller's factories, which keeps this module free of Node imports and browser\n * exporter policy. Every factory is owned: it runs once during layer\n * acquisition, after resource validation, and the layer scope shuts down\n * everything it returned. An empty array installs nothing for that signal.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface Options {\n readonly resource: ResourceConfiguration\n readonly spanProcessor?: (() => SpanProcessor | ReadonlyArray<SpanProcessor>) | undefined\n readonly logRecordProcessor?: (() => LogRecordProcessor | ReadonlyArray<LogRecordProcessor>) | undefined\n readonly metricReader?: (() => MetricReader | ReadonlyArray<MetricReader>) | undefined\n readonly loggerMergeWithExisting?: boolean | undefined\n}\n\n/**\n * Builds a scoped browser OpenTelemetry layer. The web SDK owns every\n * processor and reader the factories return and shuts them down on release.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layerOtel = (options: Options): Layer.Layer<never, Resource.InvalidResourceConfiguration> =>\n Layer.unwrap(\n Effect.map(Resource.decode(options.resource), (decoded) =>\n WebSdk.layer(() => ({\n resource: Resource.toOpenTelemetryConfiguration(decoded),\n spanProcessor: options.spanProcessor?.(),\n logRecordProcessor: options.logRecordProcessor?.(),\n metricReader: options.metricReader?.(),\n loggerMergeWithExisting: options.loggerMergeWithExisting\n })))\n )\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,aAAwB;AAIxB,aAAwB;AACxB,YAAuB;AACvB,eAA0B;AA4BnB,MAAM,YAAY,CAAC,YACxB,MAAM;AAAA,EACJ,OAAO,IAAI,SAAS,OAAO,QAAQ,QAAQ,GAAG,CAAC,YAC7C,OAAO,MAAM,OAAO;AAAA,IAClB,UAAU,SAAS,6BAA6B,OAAO;AAAA,IACvD,eAAe,QAAQ,gBAAgB;AAAA,IACvC,oBAAoB,QAAQ,qBAAqB;AAAA,IACjD,cAAc,QAAQ,eAAe;AAAA,IACrC,yBAAyB,QAAQ;AAAA,EACnC,EAAE,CAAC;AACP;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validated collector endpoints for the OTLP exporters.
|
|
3
|
+
*
|
|
4
|
+
* The endpoint is the field an operator most often gets wrong, and a wrong one
|
|
5
|
+
* is invisible: Effect's exporter absorbs export failure by design, so a layer
|
|
6
|
+
* built against `""` or `"localhost:4318"` looks identical to a working one and
|
|
7
|
+
* simply never delivers. Every builder therefore decodes its endpoint during
|
|
8
|
+
* layer acquisition, the same posture `Resource` already takes.
|
|
9
|
+
*
|
|
10
|
+
* @since 1.0.0-rc.0
|
|
11
|
+
*/
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
/**
|
|
15
|
+
* Largest collector endpoint accepted by a builder.
|
|
16
|
+
*
|
|
17
|
+
* @category constants
|
|
18
|
+
* @since 1.0.0-rc.0
|
|
19
|
+
*/
|
|
20
|
+
export declare const maximumEndpointLength = 2048;
|
|
21
|
+
/**
|
|
22
|
+
* Runtime schema for an absolute `http:` or `https:` collector endpoint that
|
|
23
|
+
* carries no credentials, query, fragment, backslashes, spaces, or controls.
|
|
24
|
+
* A base path is allowed; authentication belongs in exporter headers.
|
|
25
|
+
*
|
|
26
|
+
* @category schemas
|
|
27
|
+
* @since 1.0.0-rc.0
|
|
28
|
+
*/
|
|
29
|
+
export declare const Endpoint: Schema.String;
|
|
30
|
+
declare const InvalidExporterEndpoint_base: Schema.Class<InvalidExporterEndpoint, Schema.TaggedStruct<"@smthrs/observability/InvalidExporterEndpoint", {
|
|
31
|
+
readonly code: Schema.Literal<"invalid_exporter_endpoint">;
|
|
32
|
+
readonly path: Schema.String;
|
|
33
|
+
readonly message: Schema.String;
|
|
34
|
+
}>, import("effect/Cause").YieldableError>;
|
|
35
|
+
/**
|
|
36
|
+
* Stable exporter-endpoint refusal shared by every OTLP builder.
|
|
37
|
+
*
|
|
38
|
+
* @category errors
|
|
39
|
+
* @since 1.0.0-rc.0
|
|
40
|
+
*/
|
|
41
|
+
export declare class InvalidExporterEndpoint extends InvalidExporterEndpoint_base {
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Removes the repeated trailing separators that would otherwise produce a
|
|
45
|
+
* double slash in a signal URL.
|
|
46
|
+
*
|
|
47
|
+
* @category conversions
|
|
48
|
+
* @since 1.0.0-rc.0
|
|
49
|
+
*/
|
|
50
|
+
export declare const normalize: (endpoint: string) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Decodes one collector endpoint into its normalized form without retaining
|
|
53
|
+
* the rejected value.
|
|
54
|
+
*
|
|
55
|
+
* `path` names the option the endpoint arrived on, so the refusal points at the
|
|
56
|
+
* caller's own field rather than at a shared internal name.
|
|
57
|
+
*
|
|
58
|
+
* @category decoding
|
|
59
|
+
* @since 1.0.0-rc.0
|
|
60
|
+
*/
|
|
61
|
+
export declare const decode: (endpoint: unknown, path: string) => Effect.Effect<string, InvalidExporterEndpoint>;
|
|
62
|
+
/**
|
|
63
|
+
* Builds the OTLP/HTTP URL one signal is posted to below a decoded endpoint.
|
|
64
|
+
*
|
|
65
|
+
* @category conversions
|
|
66
|
+
* @since 1.0.0-rc.0
|
|
67
|
+
*/
|
|
68
|
+
export declare const signalUrl: (endpoint: string, signal: "traces" | "metrics" | "logs") => string;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=Endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Endpoint.d.ts","sourceRoot":"","sources":["../../src/Endpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,OAAQ,CAAA;AAuC1C;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,eAGpB,CAAA;;;;;;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,4BAO5C;CAAG;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,UAAU,MAAM,KAAG,MAAsC,CAAA;AAEnF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,GACjB,UAAU,OAAO,EACjB,MAAM,MAAM,KACX,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAW7C,CAAA;AAEH;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,UAAU,MAAM,EAAE,QAAQ,QAAQ,GAAG,SAAS,GAAG,MAAM,KAAG,MAC7C,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Endpoint_exports = {};
|
|
30
|
+
__export(Endpoint_exports, {
|
|
31
|
+
Endpoint: () => Endpoint,
|
|
32
|
+
InvalidExporterEndpoint: () => InvalidExporterEndpoint,
|
|
33
|
+
decode: () => decode,
|
|
34
|
+
maximumEndpointLength: () => maximumEndpointLength,
|
|
35
|
+
normalize: () => normalize,
|
|
36
|
+
signalUrl: () => signalUrl
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(Endpoint_exports);
|
|
39
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
40
|
+
var Schema = __toESM(require("effect/Schema"), 1);
|
|
41
|
+
const maximumEndpointLength = 2048;
|
|
42
|
+
const largestRepairedCodeUnit = 32;
|
|
43
|
+
const repairedByUrlParser = (value) => {
|
|
44
|
+
for (let index = 0; index < value.length; index++) {
|
|
45
|
+
if (value.charCodeAt(index) <= largestRepairedCodeUnit) return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
};
|
|
49
|
+
const isAbsoluteHttpUrl = (value) => {
|
|
50
|
+
if (repairedByUrlParser(value)) return false;
|
|
51
|
+
if (!/^https?:\/\/[^/]/i.test(value) || /[?#\\]/.test(value)) return false;
|
|
52
|
+
let url;
|
|
53
|
+
try {
|
|
54
|
+
url = new URL(value);
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return url.username === "" && url.password === "";
|
|
59
|
+
};
|
|
60
|
+
const Endpoint = Schema.String.check(
|
|
61
|
+
Schema.isMaxLength(maximumEndpointLength),
|
|
62
|
+
Schema.makeFilter((value) => isAbsoluteHttpUrl(value), { title: "absoluteCollectorEndpoint" })
|
|
63
|
+
);
|
|
64
|
+
class InvalidExporterEndpoint extends Schema.TaggedError()(
|
|
65
|
+
"@smthrs/observability/InvalidExporterEndpoint",
|
|
66
|
+
{
|
|
67
|
+
code: Schema.Literal("invalid_exporter_endpoint"),
|
|
68
|
+
path: Schema.String,
|
|
69
|
+
message: Schema.String
|
|
70
|
+
}
|
|
71
|
+
) {
|
|
72
|
+
}
|
|
73
|
+
const normalize = (endpoint) => endpoint.replace(/\/+$/, "");
|
|
74
|
+
const decode = (endpoint, path) => Schema.decodeUnknownEffect(Endpoint)(endpoint).pipe(
|
|
75
|
+
Effect.map(normalize),
|
|
76
|
+
Effect.mapError(
|
|
77
|
+
() => new InvalidExporterEndpoint({
|
|
78
|
+
code: "invalid_exporter_endpoint",
|
|
79
|
+
path,
|
|
80
|
+
message: `OTLP collector ${path} must be an absolute http:// or https:// base URL without credentials, query, fragment, backslashes, spaces, or control characters`
|
|
81
|
+
})
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
const signalUrl = (endpoint, signal) => `${normalize(endpoint)}/v1/${signal}`;
|
|
85
|
+
//# sourceMappingURL=Endpoint.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Endpoint.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Validated collector endpoints for the OTLP exporters.\n *\n * The endpoint is the field an operator most often gets wrong, and a wrong one\n * is invisible: Effect's exporter absorbs export failure by design, so a layer\n * built against `\"\"` or `\"localhost:4318\"` looks identical to a working one and\n * simply never delivers. Every builder therefore decodes its endpoint during\n * layer acquisition, the same posture `Resource` already takes.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as Schema from \"effect/Schema\"\n\n/**\n * Largest collector endpoint accepted by a builder.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const maximumEndpointLength = 2_048\n\n/** The largest code unit the WHATWG URL parser repairs away: the space. */\nconst largestRepairedCodeUnit = 0x20\n\n/**\n * Reports whether the URL parser would repair the value rather than parse it\n * as written. It strips leading and trailing C0 controls and spaces and\n * removes tab, newline, and carriage return from anywhere in its input, and\n * every one of those sits at or below {@link largestRepairedCodeUnit}.\n */\nconst repairedByUrlParser = (value: string): boolean => {\n for (let index = 0; index < value.length; index++) {\n if (value.charCodeAt(index) <= largestRepairedCodeUnit) return true\n }\n return false\n}\n\nconst isAbsoluteHttpUrl = (value: string): boolean => {\n // `new URL` alone is not a validator here. It strips padding and inline\n // control characters before parsing, so it reports a copy-pasted\n // `\"http://collector:4318\\n\"` as well formed while the untrimmed original is\n // what a builder would hand its exporter: either an unusable URL or a\n // request to a host nobody typed. No legal collector endpoint carries one of\n // these, so refusing them costs nothing and closes the silent case.\n if (repairedByUrlParser(value)) return false\n // Exporters append /v1/<signal> to this base. A query or fragment would\n // swallow that suffix instead of changing the request path. Also refuse\n // missing authority separators and backslashes that WHATWG silently repairs.\n if (!/^https?:\\/\\/[^/]/i.test(value) || /[?#\\\\]/.test(value)) return false\n let url: URL\n try {\n url = new URL(value)\n } catch {\n return false\n }\n return url.username === \"\" && url.password === \"\"\n}\n\n/**\n * Runtime schema for an absolute `http:` or `https:` collector endpoint that\n * carries no credentials, query, fragment, backslashes, spaces, or controls.\n * A base path is allowed; authentication belongs in exporter headers.\n *\n * @category schemas\n * @since 1.0.0-rc.0\n */\nexport const Endpoint = Schema.String.check(\n Schema.isMaxLength(maximumEndpointLength),\n Schema.makeFilter((value: string) => isAbsoluteHttpUrl(value), { title: \"absoluteCollectorEndpoint\" })\n)\n\n/**\n * Stable exporter-endpoint refusal shared by every OTLP builder.\n *\n * @category errors\n * @since 1.0.0-rc.0\n */\nexport class InvalidExporterEndpoint extends Schema.TaggedError<InvalidExporterEndpoint>()(\n \"@smthrs/observability/InvalidExporterEndpoint\",\n {\n code: Schema.Literal(\"invalid_exporter_endpoint\"),\n path: Schema.String,\n message: Schema.String\n }\n) {}\n\n/**\n * Removes the repeated trailing separators that would otherwise produce a\n * double slash in a signal URL.\n *\n * @category conversions\n * @since 1.0.0-rc.0\n */\nexport const normalize = (endpoint: string): string => endpoint.replace(/\\/+$/, \"\")\n\n/**\n * Decodes one collector endpoint into its normalized form without retaining\n * the rejected value.\n *\n * `path` names the option the endpoint arrived on, so the refusal points at the\n * caller's own field rather than at a shared internal name.\n *\n * @category decoding\n * @since 1.0.0-rc.0\n */\nexport const decode = (\n endpoint: unknown,\n path: string\n): Effect.Effect<string, InvalidExporterEndpoint> =>\n Schema.decodeUnknownEffect(Endpoint)(endpoint).pipe(\n Effect.map(normalize),\n Effect.mapError(() =>\n new InvalidExporterEndpoint({\n code: \"invalid_exporter_endpoint\",\n path,\n message:\n `OTLP collector ${path} must be an absolute http:// or https:// base URL without credentials, query, fragment, backslashes, spaces, or control characters`\n })\n )\n )\n\n/**\n * Builds the OTLP/HTTP URL one signal is posted to below a decoded endpoint.\n *\n * @category conversions\n * @since 1.0.0-rc.0\n */\nexport const signalUrl = (endpoint: string, signal: \"traces\" | \"metrics\" | \"logs\"): string =>\n `${normalize(endpoint)}/v1/${signal}`\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,aAAwB;AACxB,aAAwB;AAQjB,MAAM,wBAAwB;AAGrC,MAAM,0BAA0B;AAQhC,MAAM,sBAAsB,CAAC,UAA2B;AACtD,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;AACjD,QAAI,MAAM,WAAW,KAAK,KAAK,wBAAyB,QAAO;AAAA,EACjE;AACA,SAAO;AACT;AAEA,MAAM,oBAAoB,CAAC,UAA2B;AAOpD,MAAI,oBAAoB,KAAK,EAAG,QAAO;AAIvC,MAAI,CAAC,oBAAoB,KAAK,KAAK,KAAK,SAAS,KAAK,KAAK,EAAG,QAAO;AACrE,MAAI;AACJ,MAAI;AACF,UAAM,IAAI,IAAI,KAAK;AAAA,EACrB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,SAAO,IAAI,aAAa,MAAM,IAAI,aAAa;AACjD;AAUO,MAAM,WAAW,OAAO,OAAO;AAAA,EACpC,OAAO,YAAY,qBAAqB;AAAA,EACxC,OAAO,WAAW,CAAC,UAAkB,kBAAkB,KAAK,GAAG,EAAE,OAAO,4BAA4B,CAAC;AACvG;AAQO,MAAM,gCAAgC,OAAO,YAAqC;AAAA,EACvF;AAAA,EACA;AAAA,IACE,MAAM,OAAO,QAAQ,2BAA2B;AAAA,IAChD,MAAM,OAAO;AAAA,IACb,SAAS,OAAO;AAAA,EAClB;AACF,EAAE;AAAC;AASI,MAAM,YAAY,CAAC,aAA6B,SAAS,QAAQ,QAAQ,EAAE;AAY3E,MAAM,SAAS,CACpB,UACA,SAEA,OAAO,oBAAoB,QAAQ,EAAE,QAAQ,EAAE;AAAA,EAC7C,OAAO,IAAI,SAAS;AAAA,EACpB,OAAO;AAAA,IAAS,MACd,IAAI,wBAAwB;AAAA,MAC1B,MAAM;AAAA,MACN;AAAA,MACA,SACE,kBAAkB,IAAI;AAAA,IAC1B,CAAC;AAAA,EACH;AACF;AAQK,MAAM,YAAY,CAAC,UAAkB,WAC1C,GAAG,UAAU,QAAQ,CAAC,OAAO,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Non-blocking forwarding of bounded operational logs to the durable journal.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Journal from "@smthrs/journal/Journal";
|
|
7
|
+
import * as JournalEvent from "@smthrs/journal/JournalEvent";
|
|
8
|
+
import * as Cause from "effect/Cause";
|
|
9
|
+
import * as Layer from "effect/Layer";
|
|
10
|
+
import type * as LogLevel from "effect/LogLevel";
|
|
11
|
+
import * as Schema from "effect/Schema";
|
|
12
|
+
/**
|
|
13
|
+
* Largest queue accepted by the forwarding logger.
|
|
14
|
+
*
|
|
15
|
+
* @category constants
|
|
16
|
+
* @since 1.0.0-rc.0
|
|
17
|
+
*/
|
|
18
|
+
export declare const maximumCapacity = 65536;
|
|
19
|
+
/**
|
|
20
|
+
* Largest detached log payload admitted to the asynchronous queue.
|
|
21
|
+
*
|
|
22
|
+
* @category constants
|
|
23
|
+
* @since 1.0.0-rc.0
|
|
24
|
+
*/
|
|
25
|
+
export declare const maximumSnapshotBytes: number;
|
|
26
|
+
/**
|
|
27
|
+
* Largest number of container members copied into one detached log payload.
|
|
28
|
+
*
|
|
29
|
+
* @category constants
|
|
30
|
+
* @since 1.0.0-rc.0
|
|
31
|
+
*/
|
|
32
|
+
export declare const maximumSnapshotMembers = 4096;
|
|
33
|
+
/**
|
|
34
|
+
* Deepest container path copied into one detached log payload.
|
|
35
|
+
*
|
|
36
|
+
* @category constants
|
|
37
|
+
* @since 1.0.0-rc.0
|
|
38
|
+
*/
|
|
39
|
+
export declare const maximumSnapshotDepth = 64;
|
|
40
|
+
/**
|
|
41
|
+
* What a hostile or unreadable logged value becomes.
|
|
42
|
+
*
|
|
43
|
+
* @category constants
|
|
44
|
+
* @since 1.0.0-rc.0
|
|
45
|
+
*/
|
|
46
|
+
export declare const unrenderableMarker = "[Unrenderable]";
|
|
47
|
+
/**
|
|
48
|
+
* What a value beyond a logger resource ceiling becomes.
|
|
49
|
+
*
|
|
50
|
+
* @category constants
|
|
51
|
+
* @since 1.0.0-rc.0
|
|
52
|
+
*/
|
|
53
|
+
export declare const truncatedMarker = "[Truncated]";
|
|
54
|
+
/**
|
|
55
|
+
* Options for the journal forwarding logger.
|
|
56
|
+
*
|
|
57
|
+
* @category models
|
|
58
|
+
* @since 1.0.0-rc.0
|
|
59
|
+
*/
|
|
60
|
+
export interface Options {
|
|
61
|
+
/** The run every forwarded record is attributed to. */
|
|
62
|
+
readonly runId: JournalEvent.RunId;
|
|
63
|
+
/** Queue depth, 1 through {@link maximumCapacity}. Defaults to 256. */
|
|
64
|
+
readonly capacity?: number | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Pins `References.MinimumLogLevel` for the whole application. Omitted, the
|
|
67
|
+
* layer leaves that reference alone and Effect's own `Info` default applies.
|
|
68
|
+
*/
|
|
69
|
+
readonly minimumLogLevel?: LogLevel.LogLevel | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Keeps the ambient loggers alongside the forwarder. Defaults to `false`,
|
|
72
|
+
* which replaces the ambient logger set.
|
|
73
|
+
*/
|
|
74
|
+
readonly mergeWithExisting?: boolean | undefined;
|
|
75
|
+
}
|
|
76
|
+
declare const InvalidJournalLoggerOptions_base: Schema.Class<InvalidJournalLoggerOptions, Schema.TaggedStruct<"@smthrs/observability/InvalidJournalLoggerOptions", {
|
|
77
|
+
readonly code: Schema.Literal<"invalid_journal_logger_options">;
|
|
78
|
+
readonly path: Schema.String;
|
|
79
|
+
readonly message: Schema.String;
|
|
80
|
+
}>, Cause.YieldableError>;
|
|
81
|
+
/**
|
|
82
|
+
* A stable logger configuration refusal.
|
|
83
|
+
*
|
|
84
|
+
* @category errors
|
|
85
|
+
* @since 1.0.0-rc.0
|
|
86
|
+
*/
|
|
87
|
+
export declare class InvalidJournalLoggerOptions extends InvalidJournalLoggerOptions_base {
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* One typed failure retained from an Effect cause.
|
|
91
|
+
*
|
|
92
|
+
* @category schemas
|
|
93
|
+
* @since 1.0.0-rc.0
|
|
94
|
+
*/
|
|
95
|
+
export declare const TelemetryFail: Schema.Struct<{
|
|
96
|
+
readonly _tag: Schema.Literal<"Fail">;
|
|
97
|
+
readonly error: Schema.Unknown;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* One unexpected defect retained from an Effect cause.
|
|
101
|
+
*
|
|
102
|
+
* @category schemas
|
|
103
|
+
* @since 1.0.0-rc.0
|
|
104
|
+
*/
|
|
105
|
+
export declare const TelemetryDie: Schema.Struct<{
|
|
106
|
+
readonly _tag: Schema.Literal<"Die">;
|
|
107
|
+
readonly defect: Schema.Unknown;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* One interruption retained from an Effect cause.
|
|
111
|
+
*
|
|
112
|
+
* @category schemas
|
|
113
|
+
* @since 1.0.0-rc.0
|
|
114
|
+
*/
|
|
115
|
+
export declare const TelemetryInterrupt: Schema.Struct<{
|
|
116
|
+
readonly _tag: Schema.Literal<"Interrupt">;
|
|
117
|
+
readonly fiberId: Schema.NullOr<Schema.Int>;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* One reason in a persisted telemetry cause.
|
|
121
|
+
*
|
|
122
|
+
* @category schemas
|
|
123
|
+
* @since 1.0.0-rc.0
|
|
124
|
+
*/
|
|
125
|
+
export declare const TelemetryCauseReason: Schema.Union<readonly [Schema.Struct<{
|
|
126
|
+
readonly _tag: Schema.Literal<"Fail">;
|
|
127
|
+
readonly error: Schema.Unknown;
|
|
128
|
+
}>, Schema.Struct<{
|
|
129
|
+
readonly _tag: Schema.Literal<"Die">;
|
|
130
|
+
readonly defect: Schema.Unknown;
|
|
131
|
+
}>, Schema.Struct<{
|
|
132
|
+
readonly _tag: Schema.Literal<"Interrupt">;
|
|
133
|
+
readonly fiberId: Schema.NullOr<Schema.Int>;
|
|
134
|
+
}>]>;
|
|
135
|
+
/**
|
|
136
|
+
* One reason in a persisted telemetry cause.
|
|
137
|
+
*
|
|
138
|
+
* @category models
|
|
139
|
+
* @since 1.0.0-rc.0
|
|
140
|
+
*/
|
|
141
|
+
export type TelemetryCauseReason = typeof TelemetryCauseReason.Type;
|
|
142
|
+
/**
|
|
143
|
+
* A versioned structural Effect cause.
|
|
144
|
+
*
|
|
145
|
+
* Effect 4 stores composed failures as an ordered reason list. The projection
|
|
146
|
+
* preserves that order and each fail, defect, or interrupt discriminator.
|
|
147
|
+
*
|
|
148
|
+
* @category schemas
|
|
149
|
+
* @since 1.0.0-rc.0
|
|
150
|
+
*/
|
|
151
|
+
export declare const TelemetryCause: Schema.Struct<{
|
|
152
|
+
readonly version: Schema.Literal<1>;
|
|
153
|
+
readonly reasons: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
154
|
+
readonly _tag: Schema.Literal<"Fail">;
|
|
155
|
+
readonly error: Schema.Unknown;
|
|
156
|
+
}>, Schema.Struct<{
|
|
157
|
+
readonly _tag: Schema.Literal<"Die">;
|
|
158
|
+
readonly defect: Schema.Unknown;
|
|
159
|
+
}>, Schema.Struct<{
|
|
160
|
+
readonly _tag: Schema.Literal<"Interrupt">;
|
|
161
|
+
readonly fiberId: Schema.NullOr<Schema.Int>;
|
|
162
|
+
}>]>>;
|
|
163
|
+
}>;
|
|
164
|
+
/**
|
|
165
|
+
* A versioned structural Effect cause.
|
|
166
|
+
*
|
|
167
|
+
* @category models
|
|
168
|
+
* @since 1.0.0-rc.0
|
|
169
|
+
*/
|
|
170
|
+
export type TelemetryCause = typeof TelemetryCause.Type;
|
|
171
|
+
/**
|
|
172
|
+
* Runtime schema for the operational log payload written to the journal.
|
|
173
|
+
*
|
|
174
|
+
* @category schemas
|
|
175
|
+
* @since 1.0.0-rc.0
|
|
176
|
+
*/
|
|
177
|
+
export declare const TelemetryLog: Schema.Struct<{
|
|
178
|
+
readonly version: Schema.Literal<1>;
|
|
179
|
+
readonly level: Schema.Literals<readonly ["All", "Fatal", "Error", "Warn", "Info", "Debug", "Trace", "None"]>;
|
|
180
|
+
readonly message: Schema.Unknown;
|
|
181
|
+
readonly annotations: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
182
|
+
readonly cause: Schema.Struct<{
|
|
183
|
+
readonly version: Schema.Literal<1>;
|
|
184
|
+
readonly reasons: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
185
|
+
readonly _tag: Schema.Literal<"Fail">;
|
|
186
|
+
readonly error: Schema.Unknown;
|
|
187
|
+
}>, Schema.Struct<{
|
|
188
|
+
readonly _tag: Schema.Literal<"Die">;
|
|
189
|
+
readonly defect: Schema.Unknown;
|
|
190
|
+
}>, Schema.Struct<{
|
|
191
|
+
readonly _tag: Schema.Literal<"Interrupt">;
|
|
192
|
+
readonly fiberId: Schema.NullOr<Schema.Int>;
|
|
193
|
+
}>]>>;
|
|
194
|
+
}>;
|
|
195
|
+
readonly fiberId: Schema.Int;
|
|
196
|
+
readonly traceId: Schema.optionalKey<Schema.String>;
|
|
197
|
+
readonly spanId: Schema.optionalKey<Schema.String>;
|
|
198
|
+
readonly timestamp: Schema.String;
|
|
199
|
+
}>;
|
|
200
|
+
/**
|
|
201
|
+
* Versioned operational log payload written to the journal.
|
|
202
|
+
*
|
|
203
|
+
* @category models
|
|
204
|
+
* @since 1.0.0-rc.0
|
|
205
|
+
*/
|
|
206
|
+
export type TelemetryLog = typeof TelemetryLog.Type;
|
|
207
|
+
/**
|
|
208
|
+
* Installs a bounded, drop-on-overflow logger forwarder for one explicit run.
|
|
209
|
+
*
|
|
210
|
+
* Configuration is decoded before a worker starts. The callback reads the
|
|
211
|
+
* queue's remaining room first, snapshots and redacts a bounded DTO
|
|
212
|
+
* synchronously only when a slot is free, then performs only non-blocking
|
|
213
|
+
* queue admission. A record a saturated queue cannot take is counted and
|
|
214
|
+
* discarded without being snapshotted. Queue overflow, journal `Dropped` receipts, delivery failures,
|
|
215
|
+
* and journal defects each advance `Metric.droppedLogRecords`. The two failure
|
|
216
|
+
* paths also warn through the ambient loggers with a fixed code and run id,
|
|
217
|
+
* and the worker keeps draining. `Accepted` and `Duplicate` do not advance the
|
|
218
|
+
* counter. Admission receipts cannot identify later drop-oldest evictions of
|
|
219
|
+
* these records or report asynchronous persistence failures or shutdown losses.
|
|
220
|
+
* Closing the scope interrupts the worker and may drop records still queued
|
|
221
|
+
* behind an in-flight write without advancing the counter.
|
|
222
|
+
*
|
|
223
|
+
* The layer replaces the ambient logger set unless `mergeWithExisting` is
|
|
224
|
+
* `true`, and provides `MinimumLogLevel` only when `minimumLogLevel` is given,
|
|
225
|
+
* so an application that set that reference elsewhere keeps it.
|
|
226
|
+
*
|
|
227
|
+
* @category layers
|
|
228
|
+
* @since 1.0.0-rc.0
|
|
229
|
+
*/
|
|
230
|
+
export declare const layerJournalForwarding: (options: Options) => Layer.Layer<never, InvalidJournalLoggerOptions, Journal.Journal>;
|
|
231
|
+
export {};
|
|
232
|
+
//# sourceMappingURL=JournalLogger.d.ts.map
|