@blokjs/runner 0.6.21 → 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
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sentry Error Tracking Integration for Blok
|
|
3
|
-
*
|
|
4
|
-
* Provides error tracking and performance monitoring via Sentry.
|
|
5
|
-
* Captures workflow execution errors, node failures, and trigger issues
|
|
6
|
-
* with full context (workflow name, node, request ID, etc.).
|
|
7
|
-
*
|
|
8
|
-
* Uses a lightweight adapter pattern so Sentry SDK is loaded lazily
|
|
9
|
-
* and the framework doesn't hard-depend on @sentry/node.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import { SentryIntegration } from "@blokjs/runner";
|
|
14
|
-
*
|
|
15
|
-
* const sentry = new SentryIntegration({
|
|
16
|
-
* dsn: process.env.SENTRY_DSN!,
|
|
17
|
-
* environment: process.env.NODE_ENV || "development",
|
|
18
|
-
* release: "blok@1.0.0",
|
|
19
|
-
* tracesSampleRate: 0.1,
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* await sentry.init();
|
|
23
|
-
*
|
|
24
|
-
* // In error handler
|
|
25
|
-
* sentry.captureWorkflowError(error, {
|
|
26
|
-
* workflowName: "get-user",
|
|
27
|
-
* workflowPath: "/users/:id",
|
|
28
|
-
* requestId: ctx.id,
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export class SentryIntegration {
|
|
33
|
-
config;
|
|
34
|
-
client = null;
|
|
35
|
-
initialized = false;
|
|
36
|
-
eventCount = 0;
|
|
37
|
-
errorCount = 0;
|
|
38
|
-
constructor(config) {
|
|
39
|
-
this.config = {
|
|
40
|
-
environment: process.env.NODE_ENV || "development",
|
|
41
|
-
sampleRate: 1.0,
|
|
42
|
-
tracesSampleRate: 0.1,
|
|
43
|
-
debug: false,
|
|
44
|
-
...config,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Initialize Sentry SDK (lazy-loads @sentry/node)
|
|
49
|
-
*/
|
|
50
|
-
async init() {
|
|
51
|
-
if (this.initialized)
|
|
52
|
-
return true;
|
|
53
|
-
try {
|
|
54
|
-
// Dynamic import to avoid hard dependency — @sentry/node is optional
|
|
55
|
-
// @ts-expect-error: @sentry/node types not installed; loaded lazily at runtime
|
|
56
|
-
const Sentry = await import("@sentry/node");
|
|
57
|
-
Sentry.init({
|
|
58
|
-
dsn: this.config.dsn,
|
|
59
|
-
environment: this.config.environment,
|
|
60
|
-
release: this.config.release,
|
|
61
|
-
serverName: this.config.serverName,
|
|
62
|
-
sampleRate: this.config.sampleRate,
|
|
63
|
-
tracesSampleRate: this.config.tracesSampleRate,
|
|
64
|
-
debug: this.config.debug,
|
|
65
|
-
});
|
|
66
|
-
// Set global tags
|
|
67
|
-
if (this.config.tags) {
|
|
68
|
-
for (const [key, value] of Object.entries(this.config.tags)) {
|
|
69
|
-
Sentry.setTag(key, value);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
Sentry.setTag("framework", "blok");
|
|
73
|
-
// Create adapter
|
|
74
|
-
this.client = {
|
|
75
|
-
captureException: (error, context) => {
|
|
76
|
-
return Sentry.captureException(error, {
|
|
77
|
-
extra: context,
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
captureMessage: (message, level) => {
|
|
81
|
-
return Sentry.captureMessage(message, level);
|
|
82
|
-
},
|
|
83
|
-
setTag: (key, value) => Sentry.setTag(key, value),
|
|
84
|
-
setUser: (user) => Sentry.setUser(user),
|
|
85
|
-
startTransaction: (context) => {
|
|
86
|
-
return Sentry.startSpan(context, (span) => span);
|
|
87
|
-
},
|
|
88
|
-
flush: (timeout) => Sentry.flush(timeout),
|
|
89
|
-
};
|
|
90
|
-
this.initialized = true;
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
// @sentry/node not installed - that's OK, fail silently
|
|
95
|
-
this.initialized = false;
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Set a custom Sentry client (useful for testing)
|
|
101
|
-
*/
|
|
102
|
-
setClient(client) {
|
|
103
|
-
this.client = client;
|
|
104
|
-
this.initialized = true;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Capture a workflow execution error
|
|
108
|
-
*/
|
|
109
|
-
captureWorkflowError(error, context) {
|
|
110
|
-
if (!this.client)
|
|
111
|
-
return null;
|
|
112
|
-
this.errorCount++;
|
|
113
|
-
this.eventCount++;
|
|
114
|
-
const eventId = this.client.captureException(error, {
|
|
115
|
-
workflow_name: context.workflowName,
|
|
116
|
-
workflow_path: context.workflowPath,
|
|
117
|
-
workflow_version: context.workflowVersion,
|
|
118
|
-
request_id: context.requestId,
|
|
119
|
-
node_name: context.nodeName,
|
|
120
|
-
node_type: context.nodeType,
|
|
121
|
-
trigger_type: context.triggerType,
|
|
122
|
-
duration_ms: context.durationMs,
|
|
123
|
-
});
|
|
124
|
-
return eventId;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Capture a node execution error
|
|
128
|
-
*/
|
|
129
|
-
captureNodeError(error, nodeName, nodeType, context) {
|
|
130
|
-
if (!this.client)
|
|
131
|
-
return null;
|
|
132
|
-
this.errorCount++;
|
|
133
|
-
this.eventCount++;
|
|
134
|
-
return this.client.captureException(error, {
|
|
135
|
-
node_name: nodeName,
|
|
136
|
-
node_type: nodeType,
|
|
137
|
-
workflow_name: context?.workflowName,
|
|
138
|
-
request_id: context?.requestId,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Capture a trigger error
|
|
143
|
-
*/
|
|
144
|
-
captureTriggerError(error, triggerType, context) {
|
|
145
|
-
if (!this.client)
|
|
146
|
-
return null;
|
|
147
|
-
this.errorCount++;
|
|
148
|
-
this.eventCount++;
|
|
149
|
-
return this.client.captureException(error, {
|
|
150
|
-
trigger_type: triggerType,
|
|
151
|
-
...context,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Capture a warning message
|
|
156
|
-
*/
|
|
157
|
-
captureWarning(message, context) {
|
|
158
|
-
if (!this.client)
|
|
159
|
-
return null;
|
|
160
|
-
this.eventCount++;
|
|
161
|
-
return this.client.captureMessage(context ? `${message} | ${JSON.stringify(context)}` : message, "warning");
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Set current user context
|
|
165
|
-
*/
|
|
166
|
-
setUser(user) {
|
|
167
|
-
this.client?.setUser(user);
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Add a tag to all future events
|
|
171
|
-
*/
|
|
172
|
-
setTag(key, value) {
|
|
173
|
-
this.client?.setTag(key, value);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Flush pending events to Sentry
|
|
177
|
-
*/
|
|
178
|
-
async flush(timeoutMs = 2000) {
|
|
179
|
-
if (!this.client)
|
|
180
|
-
return true;
|
|
181
|
-
return this.client.flush(timeoutMs);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Check if Sentry is initialized
|
|
185
|
-
*/
|
|
186
|
-
isInitialized() {
|
|
187
|
-
return this.initialized;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Get stats about captured events
|
|
191
|
-
*/
|
|
192
|
-
getStats() {
|
|
193
|
-
return {
|
|
194
|
-
initialized: this.initialized,
|
|
195
|
-
eventCount: this.eventCount,
|
|
196
|
-
errorCount: this.errorCount,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
//# sourceMappingURL=SentryIntegration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SentryIntegration.js","sourceRoot":"","sources":["../../src/integrations/SentryIntegration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAwDH,MAAM,OAAO,iBAAiB;IACrB,MAAM,CAAe;IACrB,MAAM,GAAwB,IAAI,CAAC;IACnC,WAAW,GAAG,KAAK,CAAC;IACpB,UAAU,GAAG,CAAC,CAAC;IACf,UAAU,GAAG,CAAC,CAAC;IAEvB,YAAY,MAAoB;QAC/B,IAAI,CAAC,MAAM,GAAG;YACb,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa;YAClD,UAAU,EAAE,GAAG;YACf,gBAAgB,EAAE,GAAG;YACrB,KAAK,EAAE,KAAK;YACZ,GAAG,MAAM;SACT,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACT,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QAElC,IAAI,CAAC;YACJ,qEAAqE;YACrE,+EAA+E;YAC/E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;YAE5C,MAAM,CAAC,IAAI,CAAC;gBACX,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG;gBACpB,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;gBACpC,OAAO,EAAE,IAAI,CAAC,MAAM,CA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,SAAS,GAAG,IAAI;QAC3B,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,aAAa;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,QAAQ;QACP,OAAO;YACN,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Integrations for Blok Framework
|
|
3
|
-
*
|
|
4
|
-
* Provides integrations with third-party services:
|
|
5
|
-
* - Sentry: Error tracking and performance monitoring
|
|
6
|
-
* - APM: DataDog, New Relic, and generic OTLP backends
|
|
7
|
-
* - CloudWatch: AWS CloudWatch metrics, logs, and traces (via ADOT → X-Ray)
|
|
8
|
-
* - Azure Monitor: Azure Application Insights traces, metrics, and events
|
|
9
|
-
*
|
|
10
|
-
* All integrations use lazy-loading to avoid hard dependencies.
|
|
11
|
-
*/
|
|
12
|
-
export { SentryIntegration } from "./SentryIntegration";
|
|
13
|
-
export type { SentryConfig, WorkflowErrorContext, SentryClient, SentryTransaction, SentrySpan, } from "./SentryIntegration";
|
|
14
|
-
export { APMIntegration } from "./APMIntegration";
|
|
15
|
-
export type { APMVendor, APMConfig, APMBootstrapResult, } from "./APMIntegration";
|
|
16
|
-
export { CloudWatchIntegration } from "./CloudWatchIntegration";
|
|
17
|
-
export type { CloudWatchConfig, CloudWatchUnit, CloudWatchLogEntry, CloudWatchStats, } from "./CloudWatchIntegration";
|
|
18
|
-
export { AzureMonitorIntegration } from "./AzureMonitorIntegration";
|
|
19
|
-
export type { AzureMonitorConfig, AzureMonitorStats, } from "./AzureMonitorIntegration";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Integrations for Blok Framework
|
|
3
|
-
*
|
|
4
|
-
* Provides integrations with third-party services:
|
|
5
|
-
* - Sentry: Error tracking and performance monitoring
|
|
6
|
-
* - APM: DataDog, New Relic, and generic OTLP backends
|
|
7
|
-
* - CloudWatch: AWS CloudWatch metrics, logs, and traces (via ADOT → X-Ray)
|
|
8
|
-
* - Azure Monitor: Azure Application Insights traces, metrics, and events
|
|
9
|
-
*
|
|
10
|
-
* All integrations use lazy-loading to avoid hard dependencies.
|
|
11
|
-
*/
|
|
12
|
-
export { SentryIntegration } from "./SentryIntegration";
|
|
13
|
-
export { APMIntegration } from "./APMIntegration";
|
|
14
|
-
export { CloudWatchIntegration } from "./CloudWatchIntegration";
|
|
15
|
-
export { AzureMonitorIntegration } from "./AzureMonitorIntegration";
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AASxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAQhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RuntimeAutoScaler - Automatic Container Pool Scaling for Blok Runtimes
|
|
3
|
-
*
|
|
4
|
-
* Monitors runtime execution load and automatically adjusts Docker container
|
|
5
|
-
* pool sizes based on configurable scaling policies. Tracks metrics like RPS,
|
|
6
|
-
* p95 latency, and CPU utilization to make informed scaling decisions.
|
|
7
|
-
*
|
|
8
|
-
* Follows patterns from DockerRuntimeAdapter (pool management, health checks)
|
|
9
|
-
* and TriggerMetricsCollector (metrics tracking, percentile calculations).
|
|
10
|
-
*/
|
|
11
|
-
import type { RuntimeKind } from "../adapters/RuntimeAdapter";
|
|
12
|
-
import type { RuntimeMetricsDashboard } from "./RuntimeMetricsDashboard";
|
|
13
|
-
export interface ScalingPolicy {
|
|
14
|
-
runtime: RuntimeKind;
|
|
15
|
-
minInstances: number;
|
|
16
|
-
maxInstances: number;
|
|
17
|
-
targetCpuUtilization: number;
|
|
18
|
-
targetLatencyMs: number;
|
|
19
|
-
targetRps: number;
|
|
20
|
-
scaleUpCooldownMs: number;
|
|
21
|
-
scaleDownCooldownMs: number;
|
|
22
|
-
scaleUpStep: number;
|
|
23
|
-
scaleDownStep: number;
|
|
24
|
-
}
|
|
25
|
-
export interface ScalingMetrics {
|
|
26
|
-
currentRps: number;
|
|
27
|
-
currentLatencyP95: number;
|
|
28
|
-
currentCpuUtilization: number;
|
|
29
|
-
instanceUtilization: number;
|
|
30
|
-
}
|
|
31
|
-
export interface ScalingDecision {
|
|
32
|
-
runtime: RuntimeKind;
|
|
33
|
-
action: "scale_up" | "scale_down" | "no_change";
|
|
34
|
-
currentInstances: number;
|
|
35
|
-
desiredInstances: number;
|
|
36
|
-
reason: string;
|
|
37
|
-
timestamp: number;
|
|
38
|
-
metrics: ScalingMetrics;
|
|
39
|
-
}
|
|
40
|
-
export interface ScalingHistory {
|
|
41
|
-
decisions: ScalingDecision[];
|
|
42
|
-
scaleUpCount: number;
|
|
43
|
-
scaleDownCount: number;
|
|
44
|
-
lastScaleUp: number;
|
|
45
|
-
lastScaleDown: number;
|
|
46
|
-
}
|
|
47
|
-
export interface AutoScalerConfig {
|
|
48
|
-
evaluationIntervalMs: number;
|
|
49
|
-
enabled: boolean;
|
|
50
|
-
dryRun: boolean;
|
|
51
|
-
}
|
|
52
|
-
export type ScalingListener = (decision: ScalingDecision) => void;
|
|
53
|
-
/**
|
|
54
|
-
* RuntimeAutoScaler monitors runtime execution load and automatically
|
|
55
|
-
* adjusts Docker container pool sizes based on scaling policies.
|
|
56
|
-
*
|
|
57
|
-
* It periodically evaluates metrics from the RuntimeMetricsDashboard and
|
|
58
|
-
* produces ScalingDecisions that indicate whether to scale up, scale down,
|
|
59
|
-
* or maintain the current number of instances.
|
|
60
|
-
*/
|
|
61
|
-
export declare class RuntimeAutoScaler {
|
|
62
|
-
private policies;
|
|
63
|
-
private history;
|
|
64
|
-
private listeners;
|
|
65
|
-
private interval;
|
|
66
|
-
private dashboard;
|
|
67
|
-
private config;
|
|
68
|
-
constructor(dashboard: RuntimeMetricsDashboard, config?: Partial<AutoScalerConfig>);
|
|
69
|
-
/**
|
|
70
|
-
* Set a scaling policy for a runtime.
|
|
71
|
-
* Merges provided values with defaults.
|
|
72
|
-
*/
|
|
73
|
-
setPolicy(policy: ScalingPolicy): void;
|
|
74
|
-
/**
|
|
75
|
-
* Get the scaling policy for a runtime.
|
|
76
|
-
*/
|
|
77
|
-
getPolicy(runtime: RuntimeKind): ScalingPolicy | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Remove the scaling policy for a runtime.
|
|
80
|
-
*/
|
|
81
|
-
removePolicy(runtime: RuntimeKind): void;
|
|
82
|
-
/**
|
|
83
|
-
* Begin periodic evaluation of all runtime scaling policies.
|
|
84
|
-
*/
|
|
85
|
-
start(): void;
|
|
86
|
-
/**
|
|
87
|
-
* Stop periodic evaluation.
|
|
88
|
-
*/
|
|
89
|
-
stop(): void;
|
|
90
|
-
/**
|
|
91
|
-
* Evaluate a single runtime against its scaling policy.
|
|
92
|
-
*
|
|
93
|
-
* The evaluation logic:
|
|
94
|
-
* 1. Get current metrics from RuntimeMetricsDashboard
|
|
95
|
-
* 2. Get the scaling policy for this runtime
|
|
96
|
-
* 3. Check cooldown periods (don't scale too frequently)
|
|
97
|
-
* 4. Determine desired instances based on RPS, latency, and CPU thresholds
|
|
98
|
-
* 5. Clamp desired between minInstances and maxInstances
|
|
99
|
-
* 6. Create ScalingDecision with descriptive reason
|
|
100
|
-
* 7. Record in history and notify listeners
|
|
101
|
-
*/
|
|
102
|
-
evaluate(runtime: RuntimeKind): ScalingDecision;
|
|
103
|
-
/**
|
|
104
|
-
* Evaluate all runtimes that have scaling policies.
|
|
105
|
-
*/
|
|
106
|
-
evaluateAll(): ScalingDecision[];
|
|
107
|
-
/**
|
|
108
|
-
* Get the scaling history for a runtime.
|
|
109
|
-
*/
|
|
110
|
-
getHistory(runtime: RuntimeKind): ScalingHistory | undefined;
|
|
111
|
-
/**
|
|
112
|
-
* Get scaling history for all runtimes.
|
|
113
|
-
*/
|
|
114
|
-
getAllHistory(): Map<RuntimeKind, ScalingHistory>;
|
|
115
|
-
/**
|
|
116
|
-
* Subscribe to scaling decisions. Returns an unsubscribe function.
|
|
117
|
-
*/
|
|
118
|
-
onScalingDecision(listener: ScalingListener): () => void;
|
|
119
|
-
/**
|
|
120
|
-
* Suggest a scaling policy based on current runtime metrics.
|
|
121
|
-
* Uses observed metrics to derive sensible defaults.
|
|
122
|
-
*/
|
|
123
|
-
getRecommendedPolicy(runtime: RuntimeKind): ScalingPolicy;
|
|
124
|
-
/**
|
|
125
|
-
* Clear all history, policies, and state.
|
|
126
|
-
*/
|
|
127
|
-
reset(): void;
|
|
128
|
-
/**
|
|
129
|
-
* Collect current scaling metrics from the RuntimeMetricsDashboard.
|
|
130
|
-
*/
|
|
131
|
-
private collectMetrics;
|
|
132
|
-
/**
|
|
133
|
-
* Create a no-change decision with the given reason.
|
|
134
|
-
*/
|
|
135
|
-
private createNoChangeDecision;
|
|
136
|
-
/**
|
|
137
|
-
* Get or create history entry for a runtime.
|
|
138
|
-
*/
|
|
139
|
-
private getOrCreateHistory;
|
|
140
|
-
/**
|
|
141
|
-
* Record a scaling decision in the history.
|
|
142
|
-
*/
|
|
143
|
-
private recordDecision;
|
|
144
|
-
/**
|
|
145
|
-
* Notify all registered listeners of a scaling decision.
|
|
146
|
-
*/
|
|
147
|
-
private notifyListeners;
|
|
148
|
-
}
|