@blokjs/runner 0.6.20 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Blok.d.ts +2 -0
- package/dist/Blok.js +42 -110
- package/dist/Blok.js.map +1 -1
- package/dist/DefaultLogger.d.ts +13 -0
- package/dist/DefaultLogger.js +25 -0
- package/dist/DefaultLogger.js.map +1 -1
- package/dist/RunnerSteps.d.ts +23 -0
- package/dist/RunnerSteps.js +128 -87
- package/dist/RunnerSteps.js.map +1 -1
- package/dist/SubworkflowNode.js +19 -0
- package/dist/SubworkflowNode.js.map +1 -1
- package/dist/TriggerBase.d.ts +12 -0
- package/dist/TriggerBase.js +216 -181
- package/dist/TriggerBase.js.map +1 -1
- package/dist/adapters/grpc/GrpcRuntimeAdapter.d.ts +9 -0
- package/dist/adapters/grpc/GrpcRuntimeAdapter.js +76 -6
- package/dist/adapters/grpc/GrpcRuntimeAdapter.js.map +1 -1
- package/dist/index.d.ts +4 -39
- package/dist/index.js +7 -32
- package/dist/index.js.map +1 -1
- package/dist/monitoring/JanitorMetrics.d.ts +3 -0
- package/dist/monitoring/JanitorMetrics.js +11 -0
- package/dist/monitoring/JanitorMetrics.js.map +1 -1
- package/dist/monitoring/ProcessErrorMetrics.d.ts +32 -0
- package/dist/monitoring/ProcessErrorMetrics.js +43 -0
- package/dist/monitoring/ProcessErrorMetrics.js.map +1 -0
- package/dist/monitoring/PrometheusMetricsBridge.d.ts +7 -0
- package/dist/monitoring/PrometheusMetricsBridge.js +8 -2
- package/dist/monitoring/PrometheusMetricsBridge.js.map +1 -1
- package/dist/monitoring/SubworkflowMetrics.d.ts +25 -0
- package/dist/monitoring/SubworkflowMetrics.js +38 -0
- package/dist/monitoring/SubworkflowMetrics.js.map +1 -0
- package/dist/observability/ErrorSink.d.ts +23 -0
- package/dist/observability/ErrorSink.js +32 -0
- package/dist/observability/ErrorSink.js.map +1 -0
- package/dist/observability/SentryIntegration.d.ts +9 -0
- package/dist/observability/SentryIntegration.js +31 -0
- package/dist/observability/SentryIntegration.js.map +1 -0
- package/dist/scheduling/DebounceCoordinator.d.ts +7 -53
- package/dist/scheduling/DebounceCoordinator.js +8 -207
- package/dist/scheduling/DebounceCoordinator.js.map +1 -1
- package/dist/tracing/InMemoryRunStore.d.ts +5 -1
- package/dist/tracing/InMemoryRunStore.js +14 -0
- package/dist/tracing/InMemoryRunStore.js.map +1 -1
- package/dist/tracing/Janitor.js +3 -0
- package/dist/tracing/Janitor.js.map +1 -1
- package/dist/tracing/PostgresRunStore.d.ts +4 -1
- package/dist/tracing/PostgresRunStore.js +73 -3
- package/dist/tracing/PostgresRunStore.js.map +1 -1
- package/dist/tracing/RunStore.d.ts +17 -1
- package/dist/tracing/RunTracker.d.ts +13 -34
- package/dist/tracing/RunTracker.js +62 -32
- package/dist/tracing/RunTracker.js.map +1 -1
- package/dist/tracing/SqliteRunStore.d.ts +4 -1
- package/dist/tracing/SqliteRunStore.js +60 -0
- package/dist/tracing/SqliteRunStore.js.map +1 -1
- package/dist/tracing/TraceRouter.d.ts +13 -0
- package/dist/tracing/TraceRouter.js +43 -11
- package/dist/tracing/TraceRouter.js.map +1 -1
- package/dist/tracing/TracingLogger.js +22 -0
- package/dist/tracing/TracingLogger.js.map +1 -1
- package/dist/tracing/createStore.js +51 -22
- package/dist/tracing/createStore.js.map +1 -1
- package/dist/tracing/types.d.ts +22 -0
- package/dist/types/GlobalOptions.d.ts +5 -7
- package/dist/workflow/WorkflowNormalizer.js +63 -0
- package/dist/workflow/WorkflowNormalizer.js.map +1 -1
- package/package.json +7 -4
- package/dist/cache/NodeResultCache.d.ts +0 -286
- package/dist/cache/NodeResultCache.js +0 -506
- package/dist/cache/NodeResultCache.js.map +0 -1
- package/dist/cache/index.d.ts +0 -1
- package/dist/cache/index.js +0 -2
- package/dist/cache/index.js.map +0 -1
- package/dist/concurrency/ConcurrencyBackend.d.ts +0 -61
- package/dist/concurrency/ConcurrencyBackend.js +0 -20
- package/dist/concurrency/ConcurrencyBackend.js.map +0 -1
- package/dist/concurrency/NatsKvConcurrencyBackend.d.ts +0 -64
- package/dist/concurrency/NatsKvConcurrencyBackend.js +0 -310
- package/dist/concurrency/NatsKvConcurrencyBackend.js.map +0 -1
- package/dist/concurrency/RedisConcurrencyBackend.d.ts +0 -64
- package/dist/concurrency/RedisConcurrencyBackend.js +0 -374
- package/dist/concurrency/RedisConcurrencyBackend.js.map +0 -1
- package/dist/concurrency/createConcurrencyBackend.d.ts +0 -24
- package/dist/concurrency/createConcurrencyBackend.js +0 -38
- package/dist/concurrency/createConcurrencyBackend.js.map +0 -1
- package/dist/graphql/GraphQLSchemaGenerator.d.ts +0 -129
- package/dist/graphql/GraphQLSchemaGenerator.js +0 -425
- package/dist/graphql/GraphQLSchemaGenerator.js.map +0 -1
- package/dist/integrations/APMIntegration.d.ts +0 -141
- package/dist/integrations/APMIntegration.js +0 -212
- package/dist/integrations/APMIntegration.js.map +0 -1
- package/dist/integrations/AzureMonitorIntegration.d.ts +0 -118
- package/dist/integrations/AzureMonitorIntegration.js +0 -254
- package/dist/integrations/AzureMonitorIntegration.js.map +0 -1
- package/dist/integrations/CloudWatchIntegration.d.ts +0 -135
- package/dist/integrations/CloudWatchIntegration.js +0 -293
- package/dist/integrations/CloudWatchIntegration.js.map +0 -1
- package/dist/integrations/SentryIntegration.d.ts +0 -153
- package/dist/integrations/SentryIntegration.js +0 -200
- package/dist/integrations/SentryIntegration.js.map +0 -1
- package/dist/integrations/index.d.ts +0 -19
- package/dist/integrations/index.js +0 -16
- package/dist/integrations/index.js.map +0 -1
- package/dist/marketplace/RuntimeAutoScaler.d.ts +0 -148
- package/dist/marketplace/RuntimeAutoScaler.js +0 -366
- package/dist/marketplace/RuntimeAutoScaler.js.map +0 -1
- package/dist/marketplace/RuntimeCatalog.d.ts +0 -180
- package/dist/marketplace/RuntimeCatalog.js +0 -339
- package/dist/marketplace/RuntimeCatalog.js.map +0 -1
- package/dist/marketplace/RuntimeDiscovery.d.ts +0 -86
- package/dist/marketplace/RuntimeDiscovery.js +0 -231
- package/dist/marketplace/RuntimeDiscovery.js.map +0 -1
- package/dist/marketplace/RuntimeHealthMonitor.d.ts +0 -100
- package/dist/marketplace/RuntimeHealthMonitor.js +0 -241
- package/dist/marketplace/RuntimeHealthMonitor.js.map +0 -1
- package/dist/marketplace/RuntimeMetricsDashboard.d.ts +0 -113
- package/dist/marketplace/RuntimeMetricsDashboard.js +0 -293
- package/dist/marketplace/RuntimeMetricsDashboard.js.map +0 -1
- package/dist/openapi/OpenAPIGenerator.d.ts +0 -192
- package/dist/openapi/OpenAPIGenerator.js +0 -378
- package/dist/openapi/OpenAPIGenerator.js.map +0 -1
- package/dist/openapi/index.d.ts +0 -20
- package/dist/openapi/index.js +0 -20
- package/dist/openapi/index.js.map +0 -1
- package/dist/scheduling/DebounceBackend.d.ts +0 -108
- package/dist/scheduling/DebounceBackend.js +0 -23
- package/dist/scheduling/DebounceBackend.js.map +0 -1
- package/dist/scheduling/NatsKvDebounceBackend.d.ts +0 -53
- package/dist/scheduling/NatsKvDebounceBackend.js +0 -334
- package/dist/scheduling/NatsKvDebounceBackend.js.map +0 -1
- package/dist/scheduling/RedisDebounceBackend.d.ts +0 -49
- package/dist/scheduling/RedisDebounceBackend.js +0 -356
- package/dist/scheduling/RedisDebounceBackend.js.map +0 -1
- package/dist/scheduling/createDebounceBackend.d.ts +0 -25
- package/dist/scheduling/createDebounceBackend.js +0 -39
- package/dist/scheduling/createDebounceBackend.js.map +0 -1
- package/dist/security/ABAC.d.ts +0 -224
- package/dist/security/ABAC.js +0 -380
- package/dist/security/ABAC.js.map +0 -1
- package/dist/security/AuditLogger.d.ts +0 -242
- package/dist/security/AuditLogger.js +0 -317
- package/dist/security/AuditLogger.js.map +0 -1
- package/dist/security/AuthMiddleware.d.ts +0 -162
- package/dist/security/AuthMiddleware.js +0 -289
- package/dist/security/AuthMiddleware.js.map +0 -1
- package/dist/security/EncryptionAtRest.d.ts +0 -206
- package/dist/security/EncryptionAtRest.js +0 -236
- package/dist/security/EncryptionAtRest.js.map +0 -1
- package/dist/security/OAuthProvider.d.ts +0 -334
- package/dist/security/OAuthProvider.js +0 -719
- package/dist/security/OAuthProvider.js.map +0 -1
- package/dist/security/PIIDetector.d.ts +0 -233
- package/dist/security/PIIDetector.js +0 -354
- package/dist/security/PIIDetector.js.map +0 -1
- package/dist/security/RBAC.d.ts +0 -143
- package/dist/security/RBAC.js +0 -285
- package/dist/security/RBAC.js.map +0 -1
- package/dist/security/SecretManager.d.ts +0 -652
- package/dist/security/SecretManager.js +0 -1147
- package/dist/security/SecretManager.js.map +0 -1
- package/dist/security/TLSConfig.d.ts +0 -305
- package/dist/security/TLSConfig.js +0 -550
- package/dist/security/TLSConfig.js.map +0 -1
- package/dist/security/index.d.ts +0 -81
- package/dist/security/index.js +0 -82
- package/dist/security/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -27,28 +27,16 @@ import { HealthCheck } from "./monitoring/HealthCheck";
|
|
|
27
27
|
import { bootstrapPrometheus, resetPrometheusBootstrap } from "./monitoring/PrometheusBootstrap";
|
|
28
28
|
import { PrometheusMetricsBridge } from "./monitoring/PrometheusMetricsBridge";
|
|
29
29
|
import { RateLimiter } from "./monitoring/RateLimiter";
|
|
30
|
+
import { bootstrapTracing, resetTracingBootstrap, } from "./monitoring/TracingBootstrap";
|
|
30
31
|
import { TriggerMetricsCollector } from "./monitoring/TriggerMetricsCollector";
|
|
31
|
-
import { RuntimeAutoScaler } from "./marketplace/RuntimeAutoScaler";
|
|
32
32
|
// Marketplace infrastructure
|
|
33
|
-
import { RuntimeCatalog } from "./marketplace/RuntimeCatalog";
|
|
34
|
-
import { RuntimeDiscovery } from "./marketplace/RuntimeDiscovery";
|
|
35
|
-
import { RuntimeHealthMonitor } from "./marketplace/RuntimeHealthMonitor";
|
|
36
|
-
import { RuntimeMetricsDashboard } from "./marketplace/RuntimeMetricsDashboard";
|
|
37
33
|
// Hot Module Replacement (HMR)
|
|
38
34
|
import { FileWatcher } from "./hmr/FileWatcher";
|
|
39
35
|
import { HmrDevConsole } from "./hmr/HmrDevConsole";
|
|
40
36
|
import { HotReloadManager } from "./hmr/HotReloadManager";
|
|
41
|
-
import { ABACEngine, createDefaultABAC } from "./security/ABAC";
|
|
42
|
-
import { AuditLogger, ConsoleAuditSink, FileAuditSink, InMemoryAuditSink } from "./security/AuditLogger";
|
|
43
37
|
// Security
|
|
44
|
-
import { APIKeyAuthProvider, AuthMiddleware, JWTAuthProvider } from "./security/AuthMiddleware";
|
|
45
|
-
import { OAuthOIDCProvider, TokenCache } from "./security/OAuthProvider";
|
|
46
|
-
import { RBAC, createDefaultRBAC } from "./security/RBAC";
|
|
47
|
-
import { AWSSecretsProvider, EnvironmentSecretProvider, GCPSecretProvider, InMemorySecretProvider, SecretManager, VaultSecretProvider, } from "./security/SecretManager";
|
|
48
38
|
// OpenAPI
|
|
49
|
-
import { OpenAPIGenerator } from "./openapi/OpenAPIGenerator";
|
|
50
39
|
// GraphQL
|
|
51
|
-
import { GraphQLSchemaGenerator } from "./graphql/GraphQLSchemaGenerator";
|
|
52
40
|
import { NodeDependencyGraph } from "./visualization/NodeDependencyGraph";
|
|
53
41
|
// Visualization
|
|
54
42
|
import { WorkflowVisualizer } from "./visualization/WorkflowVisualizer";
|
|
@@ -67,9 +55,6 @@ import { WorkflowRegistry } from "./workflow/WorkflowRegistry";
|
|
|
67
55
|
import { ConcurrencyLimitError, isConcurrencyLimitError, } from "./concurrency/ConcurrencyLimitError";
|
|
68
56
|
// Queue-mode TTL expiry (PR 1-5 polish · 410 Gone vs 429)
|
|
69
57
|
import { QueueExpiredError, isQueueExpiredError } from "./concurrency/QueueExpiredError";
|
|
70
|
-
import { NatsKvConcurrencyBackend, readNatsKvConfigFromEnv, } from "./concurrency/NatsKvConcurrencyBackend";
|
|
71
|
-
import { RedisConcurrencyBackend, readRedisConfigFromEnv, } from "./concurrency/RedisConcurrencyBackend";
|
|
72
|
-
import { createConcurrencyBackend } from "./concurrency/createConcurrencyBackend";
|
|
73
58
|
import { CONCURRENCY_DEFAULTS, readConcurrencyConfig, } from "./concurrency/readConcurrencyConfig";
|
|
74
59
|
// Per-step timeout (Tier 2 quick-wins)
|
|
75
60
|
import { StepTimeoutError, isStepTimeoutError } from "./timeouts/StepTimeoutError";
|
|
@@ -87,17 +72,12 @@ import { JanitorMetrics } from "./monitoring/JanitorMetrics";
|
|
|
87
72
|
import { DebounceCoordinator } from "./scheduling/DebounceCoordinator";
|
|
88
73
|
import { DeferredDispatchSignal, isDeferredDispatchSignal, } from "./scheduling/DeferredDispatchSignal";
|
|
89
74
|
import { DeferredRunScheduler, getSchedulerClaimLeaseMs, } from "./scheduling/DeferredRunScheduler";
|
|
90
|
-
import { NatsKvDebounceBackend, readNatsKvDebounceConfigFromEnv, } from "./scheduling/NatsKvDebounceBackend";
|
|
91
|
-
import { RedisDebounceBackend, readRedisDebounceConfigFromEnv, } from "./scheduling/RedisDebounceBackend";
|
|
92
|
-
import { createDebounceBackend } from "./scheduling/createDebounceBackend";
|
|
93
75
|
import { SCHEDULING_DEFAULTS, readSchedulingConfig, } from "./scheduling/readSchedulingConfig";
|
|
94
76
|
// Cost Estimation
|
|
95
77
|
import { CostEstimator } from "./cost/CostEstimator";
|
|
96
78
|
import { DEFAULT_DURATIONS, DEFAULT_MEMORY, PRICING, getRuntimeCategory } from "./cost/pricing";
|
|
97
79
|
// Integrations
|
|
98
|
-
import { SentryIntegration } from "./integrations/SentryIntegration";
|
|
99
80
|
// Cache
|
|
100
|
-
import { InMemoryCache, NodeResultCache } from "./cache/NodeResultCache";
|
|
101
81
|
// Testing Framework
|
|
102
82
|
import { NodeTestHarness } from "./testing/TestHarness";
|
|
103
83
|
import { TestLogger } from "./testing/TestLogger";
|
|
@@ -115,21 +95,15 @@ GrpcRuntimeAdapter, GrpcClientPool, buildCredentials, buildChannelOptions, NodeR
|
|
|
115
95
|
// Function-first API
|
|
116
96
|
defineNode, FunctionNode,
|
|
117
97
|
// Monitoring
|
|
118
|
-
HealthCheck, RateLimiter, CircuitBreaker, CircuitOpenError, TriggerMetricsCollector, PrometheusMetricsBridge, bootstrapPrometheus, resetPrometheusBootstrap,
|
|
98
|
+
HealthCheck, RateLimiter, CircuitBreaker, CircuitOpenError, TriggerMetricsCollector, PrometheusMetricsBridge, bootstrapPrometheus, resetPrometheusBootstrap, bootstrapTracing, resetTracingBootstrap,
|
|
119
99
|
// Marketplace
|
|
120
|
-
RuntimeCatalog, RuntimeDiscovery, RuntimeHealthMonitor, RuntimeMetricsDashboard, RuntimeAutoScaler,
|
|
121
100
|
// HMR
|
|
122
101
|
FileWatcher, HotReloadManager, HmrDevConsole,
|
|
123
102
|
// Security
|
|
124
|
-
AuthMiddleware, JWTAuthProvider, APIKeyAuthProvider, RBAC, createDefaultRBAC, ABACEngine, createDefaultABAC, AuditLogger, ConsoleAuditSink, FileAuditSink, InMemoryAuditSink,
|
|
125
103
|
// OAuth 2.0 / OIDC
|
|
126
|
-
OAuthOIDCProvider, TokenCache,
|
|
127
104
|
// Secret Management
|
|
128
|
-
SecretManager, EnvironmentSecretProvider, InMemorySecretProvider, VaultSecretProvider, AWSSecretsProvider, GCPSecretProvider,
|
|
129
105
|
// OpenAPI
|
|
130
|
-
OpenAPIGenerator,
|
|
131
106
|
// GraphQL
|
|
132
|
-
GraphQLSchemaGenerator,
|
|
133
107
|
// Visualization
|
|
134
108
|
WorkflowVisualizer, NodeDependencyGraph,
|
|
135
109
|
// Performance Profiling
|
|
@@ -139,7 +113,7 @@ RunTracker, Janitor, RoutingDiagnostics, registerTraceRoutes, WorkflowRegistry,
|
|
|
139
113
|
// Concurrency gate (Tier 2 #6)
|
|
140
114
|
ConcurrencyLimitError, isConcurrencyLimitError,
|
|
141
115
|
// Queue-mode TTL expiry (PR 1-5 polish)
|
|
142
|
-
QueueExpiredError, isQueueExpiredError, readConcurrencyConfig, CONCURRENCY_DEFAULTS,
|
|
116
|
+
QueueExpiredError, isQueueExpiredError, readConcurrencyConfig, CONCURRENCY_DEFAULTS,
|
|
143
117
|
// Per-step timeout (Tier 2 quick-wins)
|
|
144
118
|
StepTimeoutError, isStepTimeoutError,
|
|
145
119
|
// Cooperative cancellation (Tier 2 follow-up)
|
|
@@ -153,13 +127,11 @@ ConcurrencyMetrics,
|
|
|
153
127
|
// Janitor sweep OTel metrics (PR 3 D3)
|
|
154
128
|
JanitorMetrics,
|
|
155
129
|
// Scheduling — delay / TTL / debounce (Tier 2 #5 + #7)
|
|
156
|
-
DeferredDispatchSignal, isDeferredDispatchSignal, DeferredRunScheduler, getSchedulerClaimLeaseMs, DebounceCoordinator, readSchedulingConfig, SCHEDULING_DEFAULTS,
|
|
130
|
+
DeferredDispatchSignal, isDeferredDispatchSignal, DeferredRunScheduler, getSchedulerClaimLeaseMs, DebounceCoordinator, readSchedulingConfig, SCHEDULING_DEFAULTS, TracingLogger, traceSanitize, traceRedactSensitive,
|
|
157
131
|
// Cost Estimation
|
|
158
132
|
CostEstimator, PRICING, DEFAULT_DURATIONS, DEFAULT_MEMORY, getRuntimeCategory,
|
|
159
133
|
// Integrations
|
|
160
|
-
SentryIntegration,
|
|
161
134
|
// Cache
|
|
162
|
-
InMemoryCache, NodeResultCache,
|
|
163
135
|
// Testing
|
|
164
136
|
NodeTestHarness, WorkflowTestRunner, TestLogger, NodeMap, BlokService, BlokResponse, RunnerSteps, };
|
|
165
137
|
// Tracing store factory + concrete stores — exposed so the CLI's
|
|
@@ -167,4 +139,7 @@ NodeTestHarness, WorkflowTestRunner, TestLogger, NodeMap, BlokService, BlokRespo
|
|
|
167
139
|
// tracker without proxying to a live trigger. See
|
|
168
140
|
// `packages/cli/src/commands/trace/startStudio.ts` for the call site.
|
|
169
141
|
export { createStore, InMemoryRunStore, SqliteRunStore } from "./tracing";
|
|
142
|
+
// Error sink (MO-ALERTS) — generic process-wide error forwarding + the Sentry adapter.
|
|
143
|
+
export { captureError, getErrorSink, setErrorSink } from "./observability/ErrorSink";
|
|
144
|
+
export { createSentryErrorSink } from "./observability/SentryIntegration";
|
|
170
145
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,GACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,eAAe,EACf,oBAAoB,EACpB,WAAW,IAAI,eAAe,EAC9B,cAAc,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAu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AAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC1E,uFAAuF;AACvF,OAAO,EAAkB,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -18,10 +18,13 @@ export declare class JanitorMetrics {
|
|
|
18
18
|
private static instance;
|
|
19
19
|
private readonly sweepDurationHistogram;
|
|
20
20
|
private readonly purgedCounter;
|
|
21
|
+
private readonly sweepErrorsCounter;
|
|
21
22
|
private constructor();
|
|
22
23
|
static getInstance(): JanitorMetrics;
|
|
23
24
|
/** Test-only — drop the singleton so re-import gets fresh meters. */
|
|
24
25
|
static resetInstance(): void;
|
|
25
26
|
recordSweep(attrs: JanitorAttributes, durationMs: number, rowsPurged: number): void;
|
|
27
|
+
/** OBS-06 T10 — increment on a per-table sweep failure. */
|
|
28
|
+
recordSweepError(attrs: JanitorAttributes): void;
|
|
26
29
|
}
|
|
27
30
|
export {};
|
|
@@ -23,6 +23,13 @@ export class JanitorMetrics {
|
|
|
23
23
|
description: "Total rows purged by the Janitor per table.",
|
|
24
24
|
unit: "1",
|
|
25
25
|
});
|
|
26
|
+
// OBS-06 T10 — per-table sweep failures. A purge that throws is caught +
|
|
27
|
+
// logged but otherwise invisible to metrics; this counter lets operators
|
|
28
|
+
// alert on a store that's failing to sweep (disk full, locked, etc.).
|
|
29
|
+
sweepErrorsCounter = metrics.getMeter("blok").createCounter("blok_janitor_sweep_errors_total", {
|
|
30
|
+
description: "Total Janitor per-table sweep failures.",
|
|
31
|
+
unit: "1",
|
|
32
|
+
});
|
|
26
33
|
constructor() { }
|
|
27
34
|
static getInstance() {
|
|
28
35
|
if (!JanitorMetrics.instance) {
|
|
@@ -44,5 +51,9 @@ export class JanitorMetrics {
|
|
|
44
51
|
// keeps dashboards consistent.
|
|
45
52
|
this.purgedCounter.add(rowsPurged, attrs);
|
|
46
53
|
}
|
|
54
|
+
/** OBS-06 T10 — increment on a per-table sweep failure. */
|
|
55
|
+
recordSweepError(attrs) {
|
|
56
|
+
this.sweepErrorsCounter.add(1, attrs);
|
|
57
|
+
}
|
|
47
58
|
}
|
|
48
59
|
//# sourceMappingURL=JanitorMetrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JanitorMetrics.js","sourceRoot":"","sources":["../../src/monitoring/JanitorMetrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAM7C,MAAM,OAAO,cAAc;IAClB,MAAM,CAAC,QAAQ,GAA0B,IAAI,CAAC;IAErC,sBAAsB,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,gCAAgC,EAAE;QACpH,WAAW,EAAE,mCAAmC;QAChD,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,EAAE,wBAAwB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE;KACjF,CAAC,CAAC;IAEc,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,2BAA2B,EAAE;QACpG,WAAW,EAAE,6CAA6C;QAC1D,IAAI,EAAE,GAAG;KACT,CAAC,CAAC;IAEH,gBAAuB,CAAC;IAExB,MAAM,CAAC,WAAW;QACjB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YAC9B,cAAc,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QAChD,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CAAC;IAChC,CAAC;IAED,qEAAqE;IACrE,MAAM,CAAC,aAAa;QACnB,cAAc,CAAC,QAAQ,GAAG,IAAI,CAAC;IAChC,CAAC;IAED,WAAW,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AExB,MAAM,CAAC,WAAW;QACjB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YAC9B,cAAc,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QAChD,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CAAC;IAChC,CAAC;IAED,qEAAqE;IACrE,MAAM,CAAC,aAAa;QACnB,cAAc,CAAC,QAAQ,GAAG,IAAI,CAAC;IAChC,CAAC;IAED,WAAW,CAAC,KAAwB,EAAE,UAAkB,EAAE,UAAkB;QAC3E,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,UAAU,EAAE,KAA0C,CAAC,CAAC;QAC3F,oEAAoE;QACpE,2DAA2D;QAC3D,+DAA+D;QAC/D,gEAAgE;QAChE,6DAA6D;QAC7D,+BAA+B;QAC/B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,EAAE,KAA0C,CAAC,CAAC;IAChF,CAAC;IAED,2DAA2D;IAC3D,gBAAgB,CAAC,KAAwB;QACxC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,EAAE,KAA0C,CAAC,CAAC;IAC5E,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OBS-06 T8 — OpenTelemetry counter for process-level fatal error events.
|
|
3
|
+
*
|
|
4
|
+
* `TriggerBase.installCrashHandlers` registers process-global
|
|
5
|
+
* `uncaughtException` + `unhandledRejection` handlers that flip in-flight
|
|
6
|
+
* runs to `"crashed"`. This counter surfaces HOW OFTEN those handlers fire
|
|
7
|
+
* so operators can alert on crash/rejection rate independently of the
|
|
8
|
+
* per-run `crashed` status.
|
|
9
|
+
*
|
|
10
|
+
* Labels:
|
|
11
|
+
* - `trigger_type` — the firing context (`"process"` for the global handlers).
|
|
12
|
+
* - `reason_class` — the error's constructor name (e.g. `"TypeError"`),
|
|
13
|
+
* bucketing rejections by class without leaking the (high-cardinality)
|
|
14
|
+
* message.
|
|
15
|
+
*
|
|
16
|
+
* Singleton; lazy-instantiated. No-ops cleanly when OTel isn't configured
|
|
17
|
+
* (the meter API silently swallows recordings without an exporter).
|
|
18
|
+
*/
|
|
19
|
+
interface ProcessErrorAttributes {
|
|
20
|
+
trigger_type: string;
|
|
21
|
+
reason_class: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class ProcessErrorMetrics {
|
|
24
|
+
private static instance;
|
|
25
|
+
private readonly unhandledRejectionCounter;
|
|
26
|
+
private constructor();
|
|
27
|
+
static getInstance(): ProcessErrorMetrics;
|
|
28
|
+
/** Test-only — drop the singleton so re-import gets fresh meters. */
|
|
29
|
+
static resetInstance(): void;
|
|
30
|
+
recordUnhandledRejection(attrs: ProcessErrorAttributes): void;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OBS-06 T8 — OpenTelemetry counter for process-level fatal error events.
|
|
3
|
+
*
|
|
4
|
+
* `TriggerBase.installCrashHandlers` registers process-global
|
|
5
|
+
* `uncaughtException` + `unhandledRejection` handlers that flip in-flight
|
|
6
|
+
* runs to `"crashed"`. This counter surfaces HOW OFTEN those handlers fire
|
|
7
|
+
* so operators can alert on crash/rejection rate independently of the
|
|
8
|
+
* per-run `crashed` status.
|
|
9
|
+
*
|
|
10
|
+
* Labels:
|
|
11
|
+
* - `trigger_type` — the firing context (`"process"` for the global handlers).
|
|
12
|
+
* - `reason_class` — the error's constructor name (e.g. `"TypeError"`),
|
|
13
|
+
* bucketing rejections by class without leaking the (high-cardinality)
|
|
14
|
+
* message.
|
|
15
|
+
*
|
|
16
|
+
* Singleton; lazy-instantiated. No-ops cleanly when OTel isn't configured
|
|
17
|
+
* (the meter API silently swallows recordings without an exporter).
|
|
18
|
+
*/
|
|
19
|
+
import { metrics } from "@opentelemetry/api";
|
|
20
|
+
export class ProcessErrorMetrics {
|
|
21
|
+
static instance = null;
|
|
22
|
+
unhandledRejectionCounter = metrics
|
|
23
|
+
.getMeter("blok")
|
|
24
|
+
.createCounter("blok_unhandled_rejection_total", {
|
|
25
|
+
description: "Total uncaughtException / unhandledRejection events caught by the crash handlers.",
|
|
26
|
+
unit: "1",
|
|
27
|
+
});
|
|
28
|
+
constructor() { }
|
|
29
|
+
static getInstance() {
|
|
30
|
+
if (!ProcessErrorMetrics.instance) {
|
|
31
|
+
ProcessErrorMetrics.instance = new ProcessErrorMetrics();
|
|
32
|
+
}
|
|
33
|
+
return ProcessErrorMetrics.instance;
|
|
34
|
+
}
|
|
35
|
+
/** Test-only — drop the singleton so re-import gets fresh meters. */
|
|
36
|
+
static resetInstance() {
|
|
37
|
+
ProcessErrorMetrics.instance = null;
|
|
38
|
+
}
|
|
39
|
+
recordUnhandledRejection(attrs) {
|
|
40
|
+
this.unhandledRejectionCounter.add(1, attrs);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ProcessErrorMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProcessErrorMetrics.js","sourceRoot":"","sources":["../../src/monitoring/ProcessErrorMetrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAO7C,MAAM,OAAO,mBAAmB;IACvB,MAAM,CAAC,QAAQ,GAA+B,IAAI,CAAC;IAE1C,yBAAyB,GAAG,OAAO;SAClD,QAAQ,CAAC,MAAM,CAAC;SAChB,aAAa,CAAC,gCAAgC,EAAE;QAChD,WAAW,EAAE,mFAAmF;QAChG,IAAI,EAAE,GAAG;KACT,CAAC,CAAC;IAEJ,gBAAuB,CAAC;IAExB,MAAM,CAAC,WAAW;QACjB,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC;YACnC,mBAAmB,CAAC,QAAQ,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAC1D,CAAC;QACD,OAAO,mBAAmB,CAAC,QAAQ,CAAC;IACrC,CAAC;IAED,qEAAqE;IACrE,MAAM,CAAC,aAAa;QACnB,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC;IACrC,CAAC;IAED,wBAAwB,CAAC,KAA6B;QACrD,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,EAAE,KAA0C,CAAC,CAAC;IACnF,CAAC"}
|
|
@@ -15,6 +15,13 @@ export interface ExecutionLabels {
|
|
|
15
15
|
workflow_name: string;
|
|
16
16
|
workflow_version: string;
|
|
17
17
|
env: string;
|
|
18
|
+
/**
|
|
19
|
+
* OBS-05 T2 — resolved terminal run status for error emission
|
|
20
|
+
* (`failed` | `crashed` | `timedOut` | `throttled` | `cancelled`).
|
|
21
|
+
* Optional for back-compat: when absent, `recordError` omits the
|
|
22
|
+
* `status` label and prior behavior is preserved.
|
|
23
|
+
*/
|
|
24
|
+
status?: string;
|
|
18
25
|
}
|
|
19
26
|
export declare class PrometheusMetricsBridge {
|
|
20
27
|
private meter;
|
|
@@ -184,12 +184,18 @@ export class PrometheusMetricsBridge {
|
|
|
184
184
|
* Record an error with a specific category.
|
|
185
185
|
*/
|
|
186
186
|
recordError(category, labels = {}) {
|
|
187
|
-
|
|
187
|
+
const attrs = {
|
|
188
188
|
trigger_type: this.config.triggerType,
|
|
189
189
|
trigger_name: this.config.triggerName,
|
|
190
190
|
error_category: category,
|
|
191
191
|
env: labels.env || process.env.NODE_ENV || "development",
|
|
192
|
-
}
|
|
192
|
+
};
|
|
193
|
+
// OBS-05 T2 — distinguish failed / crashed / timedOut / throttled /
|
|
194
|
+
// cancelled when the caller resolved a terminal status. Omitted for
|
|
195
|
+
// back-compat when absent.
|
|
196
|
+
if (labels.status)
|
|
197
|
+
attrs.status = labels.status;
|
|
198
|
+
this.errorsCounter.add(1, attrs);
|
|
193
199
|
}
|
|
194
200
|
/**
|
|
195
201
|
* Attach a CircuitBreaker for state monitoring.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrometheusMetricsBridge.js","sourceRoot":"","sources":["../../src/monitoring/PrometheusMetricsBridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAkE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"PrometheusMetricsBridge.js","sourceRoot":"","sources":["../../src/monitoring/PrometheusMetricsBridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAkE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAuB7G,MAAM,OAAO,uBAAuB;IAC3B,KAAK,CAAQ;IACb,MAAM,CAAgC;IACtC,SAAS,CAA0B;IACnC,cAAc,GAA0B,IAAI,CAAC;IAC7C,WAAW,GAAuB,IAAI,CAAC;IAE/C,qBAAqB;IACb,iBAAiB,CAAU;IAC3B,iBAAiB,CAAY;IAC7B,aAAa,CAAU;IAE/B,kEAAkE;IAC1D,gBAAgB,GAAsB,EAAE,CAAC;IAEzC,WAAW,GAAG,KAAK,CAAC;IAE5B,YAAY,MAAqC,EAAE,SAAkC;QACpF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEtC,wCAAwC;QACxC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,gCAAgC,EAAE;YACnF,WAAW,EAAE,qCAAqC;YAClD,IAAI,EAAE,GAAG;SACT,CAAC,CAAC;QAEH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,gCAAgC,EAAE;YACrF,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,GAAG;SACT,CAAC,CAAC;QAEH,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,4BAA4B,EAAE;YAC3E,WAAW,EAAE,2CAA2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,MAAM,CAAC,WAAW;YACrC,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa;SACxD,CAAC;QACF,oEAAoE;QACpE,oEAAoE;QACpE,2BAA2B;QAC3B,IAAI,MAAM,CAAC,MAAM;YAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAChD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,EAAkB;QACtC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,EAAe;QAChC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,OAAO;QACN,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC1B,CAAC;CACD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OBS-05 T5 — OTel counter for fire-and-forget (`wait: false`) sub-workflow
|
|
3
|
+
* dispatch failures. Today those failures are caught + `console.error`-ed +
|
|
4
|
+
* routed to `tracker.failRun` but emit no metric, so an ops dashboard can't
|
|
5
|
+
* alert on a spike of silently-failing async children. This counter surfaces
|
|
6
|
+
* them.
|
|
7
|
+
*
|
|
8
|
+
* Wired into `SubworkflowNode`'s two fire-and-forget failure paths:
|
|
9
|
+
* - the in-process `dispatchAsync` catch (`dispatch: "in-process"`)
|
|
10
|
+
* - the `http-self` `wait: false` `.catch` (`dispatch: "http-self"`)
|
|
11
|
+
*
|
|
12
|
+
* Singleton, lazy-instantiated. No-ops cleanly when OTel isn't configured
|
|
13
|
+
* (the meter API silently swallows recordings without an exporter).
|
|
14
|
+
*/
|
|
15
|
+
export declare class SubworkflowMetrics {
|
|
16
|
+
private static instance;
|
|
17
|
+
private readonly asyncFailureCounter;
|
|
18
|
+
static getInstance(): SubworkflowMetrics;
|
|
19
|
+
/** Test-only — drop the singleton so re-import gets fresh meters. */
|
|
20
|
+
static resetInstance(): void;
|
|
21
|
+
recordAsyncFailure(attrs: {
|
|
22
|
+
workflow_name: string;
|
|
23
|
+
dispatch: "in-process" | "http-self";
|
|
24
|
+
}): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OBS-05 T5 — OTel counter for fire-and-forget (`wait: false`) sub-workflow
|
|
3
|
+
* dispatch failures. Today those failures are caught + `console.error`-ed +
|
|
4
|
+
* routed to `tracker.failRun` but emit no metric, so an ops dashboard can't
|
|
5
|
+
* alert on a spike of silently-failing async children. This counter surfaces
|
|
6
|
+
* them.
|
|
7
|
+
*
|
|
8
|
+
* Wired into `SubworkflowNode`'s two fire-and-forget failure paths:
|
|
9
|
+
* - the in-process `dispatchAsync` catch (`dispatch: "in-process"`)
|
|
10
|
+
* - the `http-self` `wait: false` `.catch` (`dispatch: "http-self"`)
|
|
11
|
+
*
|
|
12
|
+
* Singleton, lazy-instantiated. No-ops cleanly when OTel isn't configured
|
|
13
|
+
* (the meter API silently swallows recordings without an exporter).
|
|
14
|
+
*/
|
|
15
|
+
import { metrics } from "@opentelemetry/api";
|
|
16
|
+
export class SubworkflowMetrics {
|
|
17
|
+
static instance = null;
|
|
18
|
+
asyncFailureCounter = metrics
|
|
19
|
+
.getMeter("blok")
|
|
20
|
+
.createCounter("blok_subworkflow_async_failure_total", {
|
|
21
|
+
description: "Fire-and-forget (wait:false) sub-workflow dispatch failures, by parent workflow + dispatch strategy.",
|
|
22
|
+
unit: "1",
|
|
23
|
+
});
|
|
24
|
+
static getInstance() {
|
|
25
|
+
if (!SubworkflowMetrics.instance) {
|
|
26
|
+
SubworkflowMetrics.instance = new SubworkflowMetrics();
|
|
27
|
+
}
|
|
28
|
+
return SubworkflowMetrics.instance;
|
|
29
|
+
}
|
|
30
|
+
/** Test-only — drop the singleton so re-import gets fresh meters. */
|
|
31
|
+
static resetInstance() {
|
|
32
|
+
SubworkflowMetrics.instance = null;
|
|
33
|
+
}
|
|
34
|
+
recordAsyncFailure(attrs) {
|
|
35
|
+
this.asyncFailureCounter.add(1, attrs);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=SubworkflowMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubworkflowMetrics.js","sourceRoot":"","sources":["../../src/monitoring/SubworkflowMetrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAmB,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,OAAO,kBAAkB;IACtB,MAAM,CAAC,QAAQ,GAA8B,IAAI,CAAC;IAEzC,mBAAmB,GAAG,OAAO;SAC5C,QAAQ,CAAC,MAAM,CAAC;SAChB,aAAa,CAAC,sCAAsC,EAAE;QACtD,WAAW,EACV,sGAAsG;QACvG,IAAI,EAAE,GAAG;KACT,CAAC,CAAC;IAEJ,MAAM,CAAC,WAAW;QACjB,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC;YAClC,kBAAkB,CAAC,QAAQ,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACxD,CAAC;QACD,OAAO,kBAAkB,CAAC,QAAQ,CAAC;IACpC,CAAC;IAED,qEAAqE;IACrE,MAAM,CAAC,aAAa;QACnB,kBAAkB,CAAC,QAAQ,GAAG,IAAI,CAAC;IACpC,CAAC;IAED,kBAAkB,CAAC,KAAsE;QACxF,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,KAAmB,CAAC,CAAC;IACtD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic error sink — a process-wide hook for forwarding unhandled errors to an
|
|
3
|
+
* external service (Sentry, Rollbar, a webhook, …). Deliberately NOT Sentry-
|
|
4
|
+
* specific: Sentry is one adapter ({@link SentryIntegration}). Inert until an
|
|
5
|
+
* adapter is installed via {@link setErrorSink} (the trigger does this at boot
|
|
6
|
+
* only when `SENTRY_DSN` is set), so the default behaviour is unchanged.
|
|
7
|
+
*/
|
|
8
|
+
export interface ErrorSink {
|
|
9
|
+
/** Report an error to the sink. MUST NOT throw. */
|
|
10
|
+
captureException(error: unknown, context?: Record<string, unknown>): void;
|
|
11
|
+
/** Best-effort flush of buffered events; resolves true when drained. */
|
|
12
|
+
flush(timeoutMs?: number): Promise<boolean>;
|
|
13
|
+
}
|
|
14
|
+
/** Install (or clear, with `null`) the process-wide error sink. */
|
|
15
|
+
export declare function setErrorSink(sink: ErrorSink | null): void;
|
|
16
|
+
/** The currently-installed sink, or null when none is configured. */
|
|
17
|
+
export declare function getErrorSink(): ErrorSink | null;
|
|
18
|
+
/**
|
|
19
|
+
* Report an error to the configured sink, if any. NEVER throws — error
|
|
20
|
+
* reporting must not be able to crash the application it's observing. A no-op
|
|
21
|
+
* when no sink is installed.
|
|
22
|
+
*/
|
|
23
|
+
export declare function captureError(error: unknown, context?: Record<string, unknown>): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic error sink — a process-wide hook for forwarding unhandled errors to an
|
|
3
|
+
* external service (Sentry, Rollbar, a webhook, …). Deliberately NOT Sentry-
|
|
4
|
+
* specific: Sentry is one adapter ({@link SentryIntegration}). Inert until an
|
|
5
|
+
* adapter is installed via {@link setErrorSink} (the trigger does this at boot
|
|
6
|
+
* only when `SENTRY_DSN` is set), so the default behaviour is unchanged.
|
|
7
|
+
*/
|
|
8
|
+
let _sink = null;
|
|
9
|
+
/** Install (or clear, with `null`) the process-wide error sink. */
|
|
10
|
+
export function setErrorSink(sink) {
|
|
11
|
+
_sink = sink;
|
|
12
|
+
}
|
|
13
|
+
/** The currently-installed sink, or null when none is configured. */
|
|
14
|
+
export function getErrorSink() {
|
|
15
|
+
return _sink;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Report an error to the configured sink, if any. NEVER throws — error
|
|
19
|
+
* reporting must not be able to crash the application it's observing. A no-op
|
|
20
|
+
* when no sink is installed.
|
|
21
|
+
*/
|
|
22
|
+
export function captureError(error, context) {
|
|
23
|
+
if (!_sink)
|
|
24
|
+
return;
|
|
25
|
+
try {
|
|
26
|
+
_sink.captureException(error, context);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Reporting failures are swallowed by design.
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ErrorSink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorSink.js","sourceRoot":"","sources":["../../src/observability/ErrorSink.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,IAAI,KAAK,GAAqB,IAAI,CAAC;AAEnC,mEAAmE;AACnE,MAAM,UAAU,YAAY,CAAC,IAAsB;IAClD,KAAK,GAAG,IAAI,CAAC;AACd,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,YAAY;IAC3B,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc,EAAE,OAAiC;IAC7E,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI,CAAC;QACJ,KAAK,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACR,8CAA8C;IAC/C,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ErrorSink } from "./ErrorSink";
|
|
2
|
+
/**
|
|
3
|
+
* An {@link ErrorSink} backed by Sentry. `@sentry/node` is an OPTIONAL peer dep,
|
|
4
|
+
* loaded via a sync `require` so a runner without it still boots — when it's
|
|
5
|
+
* absent this returns an INERT sink (warns once). The caller gates construction
|
|
6
|
+
* on `SENTRY_DSN`, so an unset DSN means this is never built and behaviour is
|
|
7
|
+
* unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createSentryErrorSink(dsn: string): ErrorSink;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
/**
|
|
3
|
+
* An {@link ErrorSink} backed by Sentry. `@sentry/node` is an OPTIONAL peer dep,
|
|
4
|
+
* loaded via a sync `require` so a runner without it still boots — when it's
|
|
5
|
+
* absent this returns an INERT sink (warns once). The caller gates construction
|
|
6
|
+
* on `SENTRY_DSN`, so an unset DSN means this is never built and behaviour is
|
|
7
|
+
* unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export function createSentryErrorSink(dsn) {
|
|
10
|
+
let sentry = null;
|
|
11
|
+
try {
|
|
12
|
+
const req = createRequire(import.meta.url);
|
|
13
|
+
sentry = req("@sentry/node");
|
|
14
|
+
sentry.init({ dsn, tracesSampleRate: 0, environment: process.env.NODE_ENV });
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
sentry = null;
|
|
18
|
+
console.warn("[blok][error-sink] SENTRY_DSN is set but @sentry/node isn't installed — the Sentry sink is inert. Run `npm i @sentry/node` to enable it.");
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
captureException(error, context) {
|
|
22
|
+
if (!sentry)
|
|
23
|
+
return;
|
|
24
|
+
sentry.captureException(error, context ? { extra: context } : undefined);
|
|
25
|
+
},
|
|
26
|
+
async flush(timeoutMs = 2000) {
|
|
27
|
+
return sentry ? sentry.flush(timeoutMs) : true;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=SentryIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SentryIntegration.js","sourceRoot":"","sources":["../../src/observability/SentryIntegration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAU5C;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAChD,IAAI,MAAM,GAAsB,IAAI,CAAC;IACrC,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,GAAG,GAAG,CAAC,cAAc,CAAe,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9E,CAAC;IAAC,MAAM,CAAC;QACR,MAAM,GAAG,IAAI,CAAC;QACd,OAAO,CAAC,IAAI,CACX,0IAA0I,CAC1I,CAAC;IACH,CAAC;IAED,OAAO;QACN,gBAAgB,CAAC,KAAK,EAAE,OAAO;YAC9B,IAAI,CAAC,MAAM;gBAAE,OAAO;YACpB,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC1E,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI;YAC3B,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChD,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -1,32 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tier 2 #7 — debounce coordinator.
|
|
2
|
+
* Tier 2 #7 — debounce coordinator.
|
|
3
3
|
*
|
|
4
4
|
* Coalesces rapid same-key triggers into a single delayed run. Modes:
|
|
5
5
|
*
|
|
6
6
|
* - `"trailing"` (default): each ping resets a timer; the run fires
|
|
7
|
-
* after `delayMs` of silence. Latest payload wins
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* ping.
|
|
7
|
+
* after `delayMs` of silence. Latest payload wins via the captured
|
|
8
|
+
* closure. `maxDelayMs` bounds tail latency — even with continuous
|
|
9
|
+
* pings, the run fires after `maxDelayMs` from the FIRST ping.
|
|
11
10
|
* - `"leading"`: the first ping fires immediately. Subsequent pings
|
|
12
11
|
* within `delayMs` are dropped. Window resets after `delayMs` of
|
|
13
12
|
* silence.
|
|
14
13
|
*
|
|
15
|
-
* Process-wide singleton.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* register/cancel through the backend with the same outcome surface,
|
|
19
|
-
* keeping a local timer + closure for the OWNING process. The
|
|
20
|
-
* `register()` API is async — callers must `await` it.
|
|
21
|
-
*
|
|
22
|
-
* Latest-payload semantics in cross-process mode: **owner-local**.
|
|
23
|
-
* Pings from a non-owning process bump pingCount + push scheduledAt in
|
|
24
|
-
* the shared doc but do NOT contribute their payload — only the
|
|
25
|
-
* owning process's captured `onFire` closure fires. Cross-process
|
|
26
|
-
* latest-payload-wins is deferred (would require persisting each
|
|
27
|
-
* ping's payload to the shared doc; tracked in BACKLOG).
|
|
14
|
+
* Process-wide singleton. In-memory only — fast, synchronous internally.
|
|
15
|
+
* The `register()` API is async so callers don't need to discriminate,
|
|
16
|
+
* but the coordinator always uses the local in-memory fast path.
|
|
28
17
|
*/
|
|
29
|
-
import type { DebounceBackend } from "./DebounceBackend";
|
|
30
18
|
export type DebounceDispatchFn = () => Promise<void>;
|
|
31
19
|
export type DebounceMode = "leading" | "trailing";
|
|
32
20
|
export interface DebounceRegisterOpts {
|
|
@@ -84,25 +72,9 @@ export interface DebounceRegisterResult {
|
|
|
84
72
|
export declare class DebounceCoordinator {
|
|
85
73
|
private static instance;
|
|
86
74
|
private states;
|
|
87
|
-
private backend;
|
|
88
|
-
/** Process identity for cross-process owner-lease attribution. Stable for the lifetime of the singleton. */
|
|
89
|
-
private readonly processId;
|
|
90
|
-
private ownerLeaseMs;
|
|
91
75
|
static getInstance(): DebounceCoordinator;
|
|
92
76
|
/** Test-only — reset the singleton + clear all state. */
|
|
93
77
|
static resetInstance(): void;
|
|
94
|
-
/**
|
|
95
|
-
* Install a cross-process backend. Set via `HttpTrigger.listen()` /
|
|
96
|
-
* `WorkerTrigger.listen()` when `BLOK_DEBOUNCE_BACKEND` is configured.
|
|
97
|
-
* Pass `null` to revert to the in-memory fast path.
|
|
98
|
-
*/
|
|
99
|
-
setBackend(backend: DebounceBackend | null): void;
|
|
100
|
-
getBackend(): DebounceBackend | null;
|
|
101
|
-
/**
|
|
102
|
-
* Override the owner-lease duration. Used by `HttpTrigger.listen()` /
|
|
103
|
-
* `WorkerTrigger.listen()` to apply `BLOK_DEBOUNCE_OWNER_LEASE_MS`.
|
|
104
|
-
*/
|
|
105
|
-
setOwnerLeaseMs(ms: number): void;
|
|
106
78
|
private bucket;
|
|
107
79
|
register(opts: DebounceRegisterOpts): Promise<DebounceRegisterResult>;
|
|
108
80
|
/**
|
|
@@ -112,24 +84,6 @@ export declare class DebounceCoordinator {
|
|
|
112
84
|
*/
|
|
113
85
|
private registerLocal;
|
|
114
86
|
private fireTrailingLocal;
|
|
115
|
-
/**
|
|
116
|
-
* Cross-process path — delegates ownership to the backend and uses
|
|
117
|
-
* a local timer + closure for the OWNING process.
|
|
118
|
-
*
|
|
119
|
-
* Three outcomes from the backend:
|
|
120
|
-
* - `owner-new`: this process is the new owner. Start a local timer
|
|
121
|
-
* + closure; on fire, atomically finalize via the backend.
|
|
122
|
-
* - `owner-extend`: this process is already the owner. Cancel +
|
|
123
|
-
* restart the local timer at the new scheduledAt; refresh closure.
|
|
124
|
-
* - `coalesce`: another process owns the window. Just return.
|
|
125
|
-
*
|
|
126
|
-
* Leading mode: `owner-new` translates to `fire-immediate` (caller
|
|
127
|
-
* fires synchronously); `owner-extend`/`coalesce` translate to
|
|
128
|
-
* `coalesce`.
|
|
129
|
-
*/
|
|
130
|
-
private registerCrossProcess;
|
|
131
|
-
private installOwnerTimer;
|
|
132
|
-
private fireTrailingCrossProcess;
|
|
133
87
|
/** Cancel an active window without firing. Returns true if cancelled. */
|
|
134
88
|
cancel(workflowName: string, debounceKey: string): Promise<boolean>;
|
|
135
89
|
/** Number of active LOCAL debounce windows. Tests + observability. Excludes cross-process windows owned by other processes. */
|