@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,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* APMIntegration - Unified APM bridge for DataDog, New Relic, and generic OTLP backends
|
|
3
|
-
*
|
|
4
|
-
* Configures OpenTelemetry trace and metric exporters targeting specific APM vendors.
|
|
5
|
-
* Each vendor has pre-configured OTLP endpoints and required headers/env vars.
|
|
6
|
-
*
|
|
7
|
-
* Uses lazy dynamic imports so vendor-specific SDK packages are optional.
|
|
8
|
-
* Falls back to generic OTLP if vendor-specific packages are not installed.
|
|
9
|
-
*
|
|
10
|
-
* Supported vendors:
|
|
11
|
-
* - **DataDog**: Sends traces/metrics via dd-trace or OTLP to DataDog Agent
|
|
12
|
-
* - **New Relic**: Sends traces/metrics via OTLP to New Relic ingest endpoint
|
|
13
|
-
* - **Generic OTLP**: Any OTLP-compatible backend (Jaeger, Grafana Tempo, etc.)
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import { APMIntegration } from "@blokjs/runner";
|
|
18
|
-
*
|
|
19
|
-
* // DataDog
|
|
20
|
-
* const apm = new APMIntegration({
|
|
21
|
-
* vendor: "datadog",
|
|
22
|
-
* serviceName: "blok-http",
|
|
23
|
-
* datadogAgentUrl: "http://localhost:4318",
|
|
24
|
-
* });
|
|
25
|
-
* await apm.init();
|
|
26
|
-
*
|
|
27
|
-
* // New Relic
|
|
28
|
-
* const apm = new APMIntegration({
|
|
29
|
-
* vendor: "newrelic",
|
|
30
|
-
* serviceName: "blok-http",
|
|
31
|
-
* newrelicLicenseKey: process.env.NEW_RELIC_LICENSE_KEY!,
|
|
32
|
-
* });
|
|
33
|
-
* await apm.init();
|
|
34
|
-
*
|
|
35
|
-
* // Generic OTLP
|
|
36
|
-
* const apm = new APMIntegration({
|
|
37
|
-
* vendor: "otlp",
|
|
38
|
-
* serviceName: "blok-http",
|
|
39
|
-
* otlpEndpoint: "http://tempo:4318/v1/traces",
|
|
40
|
-
* });
|
|
41
|
-
* await apm.init();
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export class APMIntegration {
|
|
45
|
-
config;
|
|
46
|
-
initialized = false;
|
|
47
|
-
shutdownFn = null;
|
|
48
|
-
flushFn = null;
|
|
49
|
-
constructor(config) {
|
|
50
|
-
this.config = {
|
|
51
|
-
serviceVersion: "0.0.1",
|
|
52
|
-
environment: process.env.NODE_ENV || "development",
|
|
53
|
-
samplingRatio: 1.0,
|
|
54
|
-
debug: false,
|
|
55
|
-
...config,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Initialize the APM integration.
|
|
60
|
-
* Dynamically loads vendor-specific or generic OTLP packages.
|
|
61
|
-
* Returns false if required packages are not installed.
|
|
62
|
-
*/
|
|
63
|
-
async init() {
|
|
64
|
-
if (this.initialized)
|
|
65
|
-
return true;
|
|
66
|
-
try {
|
|
67
|
-
switch (this.config.vendor) {
|
|
68
|
-
case "datadog":
|
|
69
|
-
return await this.initDataDog();
|
|
70
|
-
case "newrelic":
|
|
71
|
-
return await this.initNewRelic();
|
|
72
|
-
case "otlp":
|
|
73
|
-
return await this.initOTLP();
|
|
74
|
-
default:
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Initialize DataDog APM.
|
|
84
|
-
*
|
|
85
|
-
* Strategy: Use OTLP export to the DataDog Agent, which accepts OTLP
|
|
86
|
-
* on port 4318 (HTTP) or 4317 (gRPC) when configured with
|
|
87
|
-
* DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT.
|
|
88
|
-
*/
|
|
89
|
-
async initDataDog() {
|
|
90
|
-
const endpoint = this.config.datadogAgentUrl || "http://localhost:4318/v1/traces";
|
|
91
|
-
const headers = {};
|
|
92
|
-
// DataDog Agent does not require auth headers for local OTLP,
|
|
93
|
-
// but we pass service metadata via resource attributes.
|
|
94
|
-
return this.bootstrapOTLPTracing(endpoint, headers);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Initialize New Relic APM.
|
|
98
|
-
*
|
|
99
|
-
* Strategy: Send traces via OTLP to New Relic's ingest endpoint.
|
|
100
|
-
* Requires NEW_RELIC_LICENSE_KEY in headers.
|
|
101
|
-
*/
|
|
102
|
-
async initNewRelic() {
|
|
103
|
-
const licenseKey = this.config.newrelicLicenseKey || process.env.NEW_RELIC_LICENSE_KEY || "";
|
|
104
|
-
if (!licenseKey) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
const region = this.config.newrelicRegion ?? "us";
|
|
108
|
-
const endpoint = this.config.newrelicEndpoint ||
|
|
109
|
-
(region === "eu" ? "https://otlp.eu01.nr-data.net:4318/v1/traces" : "https://otlp.nr-data.net:4318/v1/traces");
|
|
110
|
-
const headers = {
|
|
111
|
-
"api-key": licenseKey,
|
|
112
|
-
};
|
|
113
|
-
return this.bootstrapOTLPTracing(endpoint, headers);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Initialize generic OTLP backend.
|
|
117
|
-
*/
|
|
118
|
-
async initOTLP() {
|
|
119
|
-
const endpoint = this.config.otlpEndpoint ||
|
|
120
|
-
process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||
|
|
121
|
-
process.env.OTEL_EXPORTER_OTLP_ENDPOINT ||
|
|
122
|
-
"http://localhost:4318/v1/traces";
|
|
123
|
-
return this.bootstrapOTLPTracing(endpoint, this.config.otlpHeaders || {});
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Shared OTLP bootstrap using TracingBootstrap.
|
|
127
|
-
*/
|
|
128
|
-
async bootstrapOTLPTracing(endpoint, headers) {
|
|
129
|
-
try {
|
|
130
|
-
// Use our TracingBootstrap module
|
|
131
|
-
const { bootstrapTracing } = await import("../monitoring/TracingBootstrap");
|
|
132
|
-
const result = await bootstrapTracing({
|
|
133
|
-
serviceName: this.config.serviceName,
|
|
134
|
-
serviceVersion: this.config.serviceVersion,
|
|
135
|
-
exporter: "otlp",
|
|
136
|
-
endpoint,
|
|
137
|
-
headers,
|
|
138
|
-
samplingRatio: this.config.samplingRatio,
|
|
139
|
-
});
|
|
140
|
-
if (!result)
|
|
141
|
-
return false;
|
|
142
|
-
this.shutdownFn = result.shutdown;
|
|
143
|
-
this.flushFn = result.forceFlush;
|
|
144
|
-
this.initialized = true;
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
catch {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Check if the APM integration is initialized.
|
|
153
|
-
*/
|
|
154
|
-
isInitialized() {
|
|
155
|
-
return this.initialized;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Get the configured vendor.
|
|
159
|
-
*/
|
|
160
|
-
getVendor() {
|
|
161
|
-
return this.config.vendor;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Shut down the APM integration, flushing pending data.
|
|
165
|
-
*/
|
|
166
|
-
async shutdown() {
|
|
167
|
-
if (this.shutdownFn) {
|
|
168
|
-
await this.shutdownFn();
|
|
169
|
-
}
|
|
170
|
-
this.initialized = false;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Force flush pending traces/metrics.
|
|
174
|
-
*/
|
|
175
|
-
async forceFlush() {
|
|
176
|
-
if (this.flushFn) {
|
|
177
|
-
await this.flushFn();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Get the OTLP endpoint configuration for the current vendor.
|
|
182
|
-
* Useful for debugging and diagnostics.
|
|
183
|
-
*/
|
|
184
|
-
getEndpointInfo() {
|
|
185
|
-
let endpoint;
|
|
186
|
-
switch (this.config.vendor) {
|
|
187
|
-
case "datadog":
|
|
188
|
-
endpoint = this.config.datadogAgentUrl || "http://localhost:4318/v1/traces";
|
|
189
|
-
break;
|
|
190
|
-
case "newrelic": {
|
|
191
|
-
const region = this.config.newrelicRegion ?? "us";
|
|
192
|
-
endpoint =
|
|
193
|
-
this.config.newrelicEndpoint ||
|
|
194
|
-
(region === "eu"
|
|
195
|
-
? "https://otlp.eu01.nr-data.net:4318/v1/traces"
|
|
196
|
-
: "https://otlp.nr-data.net:4318/v1/traces");
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
case "otlp":
|
|
200
|
-
endpoint = this.config.otlpEndpoint || "http://localhost:4318/v1/traces";
|
|
201
|
-
break;
|
|
202
|
-
default:
|
|
203
|
-
endpoint = "unknown";
|
|
204
|
-
}
|
|
205
|
-
return {
|
|
206
|
-
vendor: this.config.vendor,
|
|
207
|
-
endpoint,
|
|
208
|
-
initialized: this.initialized,
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
//# sourceMappingURL=APMIntegration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"APMIntegration.js","sourceRoot":"","sources":["../../src/integrations/APMIntegration.ts"],"names":[],"mappings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ACf,CAAC,CAAC,8CAA8C;4BAChD,CAAC,CAAC,yCAAyC,CAAC,CAAC;gBAC/C,MAAM;YACP,CAAC;YACD,KAAK,MAAM;gBACV,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,iCAAiC,CAAC;gBACzE,MAAM;YACP;gBACC,QAAQ,GAAG,SAAS,CAAC;QACvB,CAAC;QAED,OAAO;YACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,QAAQ;YACR,WAAW,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Azure Monitor Integration for Blok
|
|
3
|
-
*
|
|
4
|
-
* Exports traces, metrics, and logs to Azure Application Insights via the
|
|
5
|
-
* Azure Monitor OpenTelemetry Exporter or the Application Insights SDK.
|
|
6
|
-
*
|
|
7
|
-
* Supports two modes:
|
|
8
|
-
* 1. **OTLP mode** (recommended) – Uses the generic OTLP exporter pointing at
|
|
9
|
-
* the Azure Monitor OTLP endpoint. Requires an Application Insights
|
|
10
|
-
* connection string.
|
|
11
|
-
* 2. **Azure Exporter mode** – Uses `@azure/monitor-opentelemetry-exporter`
|
|
12
|
-
* for native Azure integration with automatic sampling and live metrics.
|
|
13
|
-
*
|
|
14
|
-
* All Azure SDK dependencies are loaded lazily so the framework doesn't
|
|
15
|
-
* hard-depend on any Azure packages. If the packages are not installed
|
|
16
|
-
* `init()` returns false and the integration is a no-op.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import { AzureMonitorIntegration } from "@blokjs/runner";
|
|
21
|
-
*
|
|
22
|
-
* const azure = new AzureMonitorIntegration({
|
|
23
|
-
* connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING!,
|
|
24
|
-
* serviceName: "blok-http",
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* await azure.init();
|
|
28
|
-
*
|
|
29
|
-
* // Track a custom event
|
|
30
|
-
* azure.trackEvent("WorkflowCompleted", { workflowName: "get-user", durationMs: "42" });
|
|
31
|
-
*
|
|
32
|
-
* // Track an exception
|
|
33
|
-
* azure.trackException(error, { workflowName: "get-user", nodeName: "fetch-db" });
|
|
34
|
-
*
|
|
35
|
-
* // Track a metric
|
|
36
|
-
* azure.trackMetric("WorkflowDuration", 42);
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export interface AzureMonitorConfig {
|
|
40
|
-
/**
|
|
41
|
-
* Application Insights connection string.
|
|
42
|
-
* Falls back to APPLICATIONINSIGHTS_CONNECTION_STRING env var.
|
|
43
|
-
*/
|
|
44
|
-
connectionString?: string;
|
|
45
|
-
/** Blok service name */
|
|
46
|
-
serviceName: string;
|
|
47
|
-
/** Service version */
|
|
48
|
-
serviceVersion?: string;
|
|
49
|
-
/** Environment label */
|
|
50
|
-
environment?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Export mode:
|
|
53
|
-
* - "azure" – use @azure/monitor-opentelemetry-exporter (native)
|
|
54
|
-
* - "otlp" – use generic OTLP exporter with Azure ingestion endpoint
|
|
55
|
-
* Default: "azure"
|
|
56
|
-
*/
|
|
57
|
-
exportMode?: "azure" | "otlp";
|
|
58
|
-
/** Trace sampling ratio (0.0 – 1.0, default: 1.0) */
|
|
59
|
-
samplingRatio?: number;
|
|
60
|
-
/** Enable live metrics stream (default: false) */
|
|
61
|
-
enableLiveMetrics?: boolean;
|
|
62
|
-
/** Enable debug logging */
|
|
63
|
-
debug?: boolean;
|
|
64
|
-
}
|
|
65
|
-
export interface AzureMonitorStats {
|
|
66
|
-
initialized: boolean;
|
|
67
|
-
eventsTracked: number;
|
|
68
|
-
exceptionsTracked: number;
|
|
69
|
-
metricsTracked: number;
|
|
70
|
-
}
|
|
71
|
-
export declare class AzureMonitorIntegration {
|
|
72
|
-
private config;
|
|
73
|
-
private initialized;
|
|
74
|
-
private exporter;
|
|
75
|
-
private tracingShutdown;
|
|
76
|
-
private telemetryClient;
|
|
77
|
-
private eventsTracked;
|
|
78
|
-
private exceptionsTracked;
|
|
79
|
-
private metricsTracked;
|
|
80
|
-
constructor(config: AzureMonitorConfig);
|
|
81
|
-
/**
|
|
82
|
-
* Initialize Azure Monitor.
|
|
83
|
-
* Returns false if required packages or connection string are missing.
|
|
84
|
-
*/
|
|
85
|
-
init(): Promise<boolean>;
|
|
86
|
-
private initAzureExporter;
|
|
87
|
-
private initOTLP;
|
|
88
|
-
private initTelemetryClient;
|
|
89
|
-
/**
|
|
90
|
-
* Track a custom event (e.g. "WorkflowCompleted").
|
|
91
|
-
*/
|
|
92
|
-
trackEvent(name: string, properties?: Record<string, string>): void;
|
|
93
|
-
/**
|
|
94
|
-
* Track an exception.
|
|
95
|
-
*/
|
|
96
|
-
trackException(error: Error, properties?: Record<string, string>): void;
|
|
97
|
-
/**
|
|
98
|
-
* Track a numeric metric.
|
|
99
|
-
*/
|
|
100
|
-
trackMetric(name: string, value: number, properties?: Record<string, string>): void;
|
|
101
|
-
/**
|
|
102
|
-
* Record a workflow execution as both a custom event and metric.
|
|
103
|
-
*/
|
|
104
|
-
recordWorkflowExecution(workflowName: string, durationMs: number, success: boolean): void;
|
|
105
|
-
isInitialized(): boolean;
|
|
106
|
-
getStats(): AzureMonitorStats;
|
|
107
|
-
shutdown(): Promise<void>;
|
|
108
|
-
flush(): Promise<void>;
|
|
109
|
-
/**
|
|
110
|
-
* Extract the ingestion endpoint from an Application Insights connection string.
|
|
111
|
-
* Format: InstrumentationKey=...;IngestionEndpoint=https://...;...
|
|
112
|
-
*/
|
|
113
|
-
private extractEndpoint;
|
|
114
|
-
/**
|
|
115
|
-
* Extract the instrumentation key from an Application Insights connection string.
|
|
116
|
-
*/
|
|
117
|
-
private extractInstrumentationKey;
|
|
118
|
-
}
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Azure Monitor Integration for Blok
|
|
3
|
-
*
|
|
4
|
-
* Exports traces, metrics, and logs to Azure Application Insights via the
|
|
5
|
-
* Azure Monitor OpenTelemetry Exporter or the Application Insights SDK.
|
|
6
|
-
*
|
|
7
|
-
* Supports two modes:
|
|
8
|
-
* 1. **OTLP mode** (recommended) – Uses the generic OTLP exporter pointing at
|
|
9
|
-
* the Azure Monitor OTLP endpoint. Requires an Application Insights
|
|
10
|
-
* connection string.
|
|
11
|
-
* 2. **Azure Exporter mode** – Uses `@azure/monitor-opentelemetry-exporter`
|
|
12
|
-
* for native Azure integration with automatic sampling and live metrics.
|
|
13
|
-
*
|
|
14
|
-
* All Azure SDK dependencies are loaded lazily so the framework doesn't
|
|
15
|
-
* hard-depend on any Azure packages. If the packages are not installed
|
|
16
|
-
* `init()` returns false and the integration is a no-op.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import { AzureMonitorIntegration } from "@blokjs/runner";
|
|
21
|
-
*
|
|
22
|
-
* const azure = new AzureMonitorIntegration({
|
|
23
|
-
* connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING!,
|
|
24
|
-
* serviceName: "blok-http",
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* await azure.init();
|
|
28
|
-
*
|
|
29
|
-
* // Track a custom event
|
|
30
|
-
* azure.trackEvent("WorkflowCompleted", { workflowName: "get-user", durationMs: "42" });
|
|
31
|
-
*
|
|
32
|
-
* // Track an exception
|
|
33
|
-
* azure.trackException(error, { workflowName: "get-user", nodeName: "fetch-db" });
|
|
34
|
-
*
|
|
35
|
-
* // Track a metric
|
|
36
|
-
* azure.trackMetric("WorkflowDuration", 42);
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export class AzureMonitorIntegration {
|
|
40
|
-
config;
|
|
41
|
-
initialized = false;
|
|
42
|
-
exporter = null;
|
|
43
|
-
tracingShutdown = null;
|
|
44
|
-
// Telemetry client for custom events / metrics (Application Insights SDK)
|
|
45
|
-
telemetryClient = null;
|
|
46
|
-
// stats
|
|
47
|
-
eventsTracked = 0;
|
|
48
|
-
exceptionsTracked = 0;
|
|
49
|
-
metricsTracked = 0;
|
|
50
|
-
constructor(config) {
|
|
51
|
-
this.config = {
|
|
52
|
-
connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING,
|
|
53
|
-
serviceVersion: "0.0.1",
|
|
54
|
-
environment: process.env.NODE_ENV || "development",
|
|
55
|
-
exportMode: "azure",
|
|
56
|
-
samplingRatio: 1.0,
|
|
57
|
-
enableLiveMetrics: false,
|
|
58
|
-
debug: false,
|
|
59
|
-
...config,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Initialize Azure Monitor.
|
|
64
|
-
* Returns false if required packages or connection string are missing.
|
|
65
|
-
*/
|
|
66
|
-
async init() {
|
|
67
|
-
if (this.initialized)
|
|
68
|
-
return true;
|
|
69
|
-
const connStr = this.config.connectionString;
|
|
70
|
-
if (!connStr)
|
|
71
|
-
return false;
|
|
72
|
-
try {
|
|
73
|
-
if (this.config.exportMode === "azure") {
|
|
74
|
-
return await this.initAzureExporter(connStr);
|
|
75
|
-
}
|
|
76
|
-
return await this.initOTLP(connStr);
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/* ------------------------------------------------------------------ */
|
|
83
|
-
/* Azure Monitor exporter mode */
|
|
84
|
-
/* ------------------------------------------------------------------ */
|
|
85
|
-
async initAzureExporter(connectionString) {
|
|
86
|
-
try {
|
|
87
|
-
// @ts-expect-error: optional peer dependency
|
|
88
|
-
const azureMod = await import("@azure/monitor-opentelemetry-exporter");
|
|
89
|
-
// The Azure trace exporter works via OpenTelemetry's TracerProvider.
|
|
90
|
-
// We bootstrap tracing with it by piping through our standard bootstrap
|
|
91
|
-
// path — the Azure exporter is OTLP-compatible.
|
|
92
|
-
const exporter = new azureMod.AzureMonitorTraceExporter({
|
|
93
|
-
connectionString,
|
|
94
|
-
});
|
|
95
|
-
this.exporter = exporter;
|
|
96
|
-
// Also try to set up a lightweight telemetry client for custom events
|
|
97
|
-
await this.initTelemetryClient(connectionString);
|
|
98
|
-
this.initialized = true;
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
// Fall back to OTLP mode
|
|
103
|
-
return this.initOTLP(connectionString);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/* ------------------------------------------------------------------ */
|
|
107
|
-
/* OTLP mode (uses TracingBootstrap pointing at Azure endpoint) */
|
|
108
|
-
/* ------------------------------------------------------------------ */
|
|
109
|
-
async initOTLP(connectionString) {
|
|
110
|
-
try {
|
|
111
|
-
// Extract ingestion endpoint from connection string
|
|
112
|
-
const endpoint = this.extractEndpoint(connectionString);
|
|
113
|
-
const instrumentationKey = this.extractInstrumentationKey(connectionString);
|
|
114
|
-
if (!endpoint || !instrumentationKey)
|
|
115
|
-
return false;
|
|
116
|
-
const { bootstrapTracing } = await import("../monitoring/TracingBootstrap");
|
|
117
|
-
const result = await bootstrapTracing({
|
|
118
|
-
serviceName: this.config.serviceName,
|
|
119
|
-
serviceVersion: this.config.serviceVersion,
|
|
120
|
-
exporter: "otlp",
|
|
121
|
-
endpoint: `${endpoint}/v2/track`,
|
|
122
|
-
headers: {
|
|
123
|
-
"x-ms-instrumentationkey": instrumentationKey,
|
|
124
|
-
},
|
|
125
|
-
samplingRatio: this.config.samplingRatio,
|
|
126
|
-
});
|
|
127
|
-
if (!result)
|
|
128
|
-
return false;
|
|
129
|
-
this.tracingShutdown = result.shutdown;
|
|
130
|
-
await this.initTelemetryClient(connectionString);
|
|
131
|
-
this.initialized = true;
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/* ------------------------------------------------------------------ */
|
|
139
|
-
/* Lightweight telemetry client (custom events, metrics) */
|
|
140
|
-
/* ------------------------------------------------------------------ */
|
|
141
|
-
async initTelemetryClient(connectionString) {
|
|
142
|
-
try {
|
|
143
|
-
// @ts-expect-error: optional peer dependency
|
|
144
|
-
const appInsights = await import("applicationinsights");
|
|
145
|
-
appInsights.setup(connectionString).setAutoCollectRequests(false).start();
|
|
146
|
-
const client = appInsights.defaultClient;
|
|
147
|
-
if (!client)
|
|
148
|
-
return;
|
|
149
|
-
this.telemetryClient = {
|
|
150
|
-
trackEvent: (event) => client.trackEvent(event),
|
|
151
|
-
trackException: (exc) => client.trackException(exc),
|
|
152
|
-
trackMetric: (metric) => client.trackMetric(metric),
|
|
153
|
-
flush: () => new Promise((resolve) => {
|
|
154
|
-
client.flush({ callback: () => resolve() });
|
|
155
|
-
}),
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
// applicationinsights package not installed — custom events won't work
|
|
160
|
-
// but tracing via OTLP will still function
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
/* ------------------------------------------------------------------ */
|
|
164
|
-
/* Custom telemetry helpers */
|
|
165
|
-
/* ------------------------------------------------------------------ */
|
|
166
|
-
/**
|
|
167
|
-
* Track a custom event (e.g. "WorkflowCompleted").
|
|
168
|
-
*/
|
|
169
|
-
trackEvent(name, properties) {
|
|
170
|
-
if (!this.telemetryClient)
|
|
171
|
-
return;
|
|
172
|
-
this.telemetryClient.trackEvent({ name, properties });
|
|
173
|
-
this.eventsTracked++;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Track an exception.
|
|
177
|
-
*/
|
|
178
|
-
trackException(error, properties) {
|
|
179
|
-
if (!this.telemetryClient)
|
|
180
|
-
return;
|
|
181
|
-
this.telemetryClient.trackException({ exception: error, properties });
|
|
182
|
-
this.exceptionsTracked++;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Track a numeric metric.
|
|
186
|
-
*/
|
|
187
|
-
trackMetric(name, value, properties) {
|
|
188
|
-
if (!this.telemetryClient)
|
|
189
|
-
return;
|
|
190
|
-
this.telemetryClient.trackMetric({ name, value, properties });
|
|
191
|
-
this.metricsTracked++;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Record a workflow execution as both a custom event and metric.
|
|
195
|
-
*/
|
|
196
|
-
recordWorkflowExecution(workflowName, durationMs, success) {
|
|
197
|
-
this.trackEvent(success ? "WorkflowCompleted" : "WorkflowFailed", {
|
|
198
|
-
workflowName,
|
|
199
|
-
durationMs: String(durationMs),
|
|
200
|
-
environment: this.config.environment || "development",
|
|
201
|
-
});
|
|
202
|
-
this.trackMetric("WorkflowDuration", durationMs, { workflowName });
|
|
203
|
-
if (!success) {
|
|
204
|
-
this.trackMetric("WorkflowErrors", 1, { workflowName });
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
/* ------------------------------------------------------------------ */
|
|
208
|
-
/* Lifecycle */
|
|
209
|
-
/* ------------------------------------------------------------------ */
|
|
210
|
-
isInitialized() {
|
|
211
|
-
return this.initialized;
|
|
212
|
-
}
|
|
213
|
-
getStats() {
|
|
214
|
-
return {
|
|
215
|
-
initialized: this.initialized,
|
|
216
|
-
eventsTracked: this.eventsTracked,
|
|
217
|
-
exceptionsTracked: this.exceptionsTracked,
|
|
218
|
-
metricsTracked: this.metricsTracked,
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
async shutdown() {
|
|
222
|
-
if (this.tracingShutdown) {
|
|
223
|
-
await this.tracingShutdown();
|
|
224
|
-
}
|
|
225
|
-
if (this.exporter?.shutdown) {
|
|
226
|
-
await this.exporter.shutdown();
|
|
227
|
-
}
|
|
228
|
-
this.initialized = false;
|
|
229
|
-
}
|
|
230
|
-
async flush() {
|
|
231
|
-
if (this.telemetryClient) {
|
|
232
|
-
await this.telemetryClient.flush();
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
/* ------------------------------------------------------------------ */
|
|
236
|
-
/* Connection string parsing */
|
|
237
|
-
/* ------------------------------------------------------------------ */
|
|
238
|
-
/**
|
|
239
|
-
* Extract the ingestion endpoint from an Application Insights connection string.
|
|
240
|
-
* Format: InstrumentationKey=...;IngestionEndpoint=https://...;...
|
|
241
|
-
*/
|
|
242
|
-
extractEndpoint(connectionString) {
|
|
243
|
-
const match = connectionString.match(/IngestionEndpoint=([^;]+)/i);
|
|
244
|
-
return match?.[1]?.replace(/\/$/, "") ?? null;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Extract the instrumentation key from an Application Insights connection string.
|
|
248
|
-
*/
|
|
249
|
-
extractInstrumentationKey(connectionString) {
|
|
250
|
-
const match = connectionString.match(/InstrumentationKey=([^;]+)/i);
|
|
251
|
-
return match?.[1] ?? null;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
//# sourceMappingURL=AzureMonitorIntegration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureMonitorIntegration.js","sourceRoot":"","sources":["../../src/integrations/AzureMonitorIntegration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AA8CH,MAAM,OAAO,uBAAuB;IAC3B,MAAM,CAAyE;IAC/E,WAAW,GAAG,KAAK,CAAC;IACpB,QAAQ,GAA6B,IAAI,CAAC;IAC1C,eAAe,GAAiC,IAAI,CAAC;IAE7D,0EAA0E;IAClE,eAAe,GAKZ,IAAI,CAAC;IAEhB,QAAQ;IACA,aAAa,GAAG,CAAC,CAAC;IAClB,iBAAiB,GAAG,CAAC,CAAC;IACtB,cAAc,GAAG,CAAC,CAAC;IAE3B,YAAY,MAA0B;QACrC,IAAI,CAAC,MAAM,GAAG;YACb,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,qCAAqC;YACnE,cAAc,EAAE,OAAO;YACvB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa;YAClD,UAAU,EAAE,OAAO;YACnB,aAAa,EAAE,GAA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