@powerhousedao/switchboard 6.0.0-staging.4 → 6.0.1-staging.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/CHANGELOG.md +149 -14
- package/dist/src/index.js +31 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/metrics.d.ts +7 -0
- package/dist/src/metrics.d.ts.map +1 -0
- package/dist/src/metrics.js +34 -0
- package/dist/src/metrics.js.map +1 -0
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +81 -130
- package/dist/src/server.js.map +1 -1
- package/dist/src/types.d.ts +8 -18
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils.d.ts +2 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +1 -31
- package/dist/src/utils.js.map +1 -1
- package/dist/test/metrics.test.d.ts +2 -0
- package/dist/test/metrics.test.d.ts.map +1 -0
- package/dist/test/metrics.test.js +121 -0
- package/dist/test/metrics.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +15 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +15 -8
- package/test/metrics.test.ts +202 -0
- package/tsconfig.json +5 -6
- package/vitest.config.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,39 +1,174 @@
|
|
|
1
|
-
## 6.0.
|
|
1
|
+
## 6.0.1-staging.0 (2026-03-23)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **examples:** add Discord webhook processor example ([fc09a4d66](https://github.com/powerhouse-inc/powerhouse/commit/fc09a4d66))
|
|
6
|
+
- **test-subscription:** adding a cli test-client for testing reactor api subscriptions ([563a8ac7d](https://github.com/powerhouse-inc/powerhouse/commit/563a8ac7d))
|
|
7
|
+
- **switchboard:** add OTel metrics export via OTEL_EXPORTER_OTLP_ENDPOINT ([52f34aa1f](https://github.com/powerhouse-inc/powerhouse/commit/52f34aa1f))
|
|
8
|
+
- reactor-hypercore example ([d5557973a](https://github.com/powerhouse-inc/powerhouse/commit/d5557973a))
|
|
9
|
+
- **renown,reactor-browser:** renown integration improvements ([a65731a73](https://github.com/powerhouse-inc/powerhouse/commit/a65731a73))
|
|
10
|
+
- **ci:** add gitops action for registry image updates ([ba91d00dd](https://github.com/powerhouse-inc/powerhouse/commit/ba91d00dd))
|
|
11
|
+
- **ci:** add registry Docker image to publish workflow ([17544abad](https://github.com/powerhouse-inc/powerhouse/commit/17544abad))
|
|
12
|
+
- opentelementry-instrumentation-reactor package ([67d5c31e5](https://github.com/powerhouse-inc/powerhouse/commit/67d5c31e5))
|
|
13
|
+
- **renown,reactor-browser,connect:** cleanup renown integration ([fe6112c2c](https://github.com/powerhouse-inc/powerhouse/commit/fe6112c2c))
|
|
14
|
+
- **connect,reactor-browser:** add dynamic package loading from HTTP registry ([f92816782](https://github.com/powerhouse-inc/powerhouse/commit/f92816782))
|
|
15
|
+
- **document-model,reactor-api,reactor-browser:** implemented remote document controller ([6299c21da](https://github.com/powerhouse-inc/powerhouse/commit/6299c21da))
|
|
16
|
+
- **switchboard,reactor-api,registry:** add runtime dynamic pacage loading from HTTP registry ([37f91250e](https://github.com/powerhouse-inc/powerhouse/commit/37f91250e))
|
|
17
|
+
- add new bundling for connect ([#2390](https://github.com/powerhouse-inc/powerhouse/pull/2390))
|
|
18
|
+
|
|
19
|
+
### 🩹 Fixes
|
|
20
|
+
|
|
21
|
+
- **reactor:** temporary fix for deleting documents and cleaning up all edges too -- very costly ([8a15a0604](https://github.com/powerhouse-inc/powerhouse/commit/8a15a0604))
|
|
22
|
+
- update workflow to use refname for tag in case it is not annotated, and provide a clear error message when there is no tag ([269758716](https://github.com/powerhouse-inc/powerhouse/commit/269758716))
|
|
23
|
+
- **builder-tools,reactor-browser:** bundling fixes ([59dfd75b6](https://github.com/powerhouse-inc/powerhouse/commit/59dfd75b6))
|
|
24
|
+
- updated pnpm-lock ([c2843dc5b](https://github.com/powerhouse-inc/powerhouse/commit/c2843dc5b))
|
|
25
|
+
- **connect:** declare dependencies ([6aa6910d3](https://github.com/powerhouse-inc/powerhouse/commit/6aa6910d3))
|
|
26
|
+
- **design-system:** removed zod dependency ([fdc7c2ef7](https://github.com/powerhouse-inc/powerhouse/commit/fdc7c2ef7))
|
|
27
|
+
- **switchboard:** avoid double /v1/metrics suffix in OTLP exporter URL ([c184093c3](https://github.com/powerhouse-inc/powerhouse/commit/c184093c3))
|
|
28
|
+
- **switchboard:** enforce OTel provider registration ordering via StartServerOptions ([c797fd242](https://github.com/powerhouse-inc/powerhouse/commit/c797fd242))
|
|
29
|
+
- **codegen:** added missing deps to boilerplate ([721dcb581](https://github.com/powerhouse-inc/powerhouse/commit/721dcb581))
|
|
30
|
+
- **switchboard:** derive exportTimeoutMillis from exportIntervalMillis ([775a77f3b](https://github.com/powerhouse-inc/powerhouse/commit/775a77f3b))
|
|
31
|
+
- **switchboard:** set exportTimeoutMillis to stay under shutdown deadline ([341d88d9e](https://github.com/powerhouse-inc/powerhouse/commit/341d88d9e))
|
|
32
|
+
- **switchboard:** address further OTel metrics review feedback ([dee185ba8](https://github.com/powerhouse-inc/powerhouse/commit/dee185ba8))
|
|
33
|
+
- **switchboard:** address OTel metrics review feedback ([c5ac016fc](https://github.com/powerhouse-inc/powerhouse/commit/c5ac016fc))
|
|
34
|
+
- **common:** added missing runtime dependencies ([b0f647f75](https://github.com/powerhouse-inc/powerhouse/commit/b0f647f75))
|
|
35
|
+
- adding build-bundle to simulate-ci-workflow ([ca93d1a2b](https://github.com/powerhouse-inc/powerhouse/commit/ca93d1a2b))
|
|
36
|
+
- **renown:** moved e2e script test to reactor-browser ([3c9b41045](https://github.com/powerhouse-inc/powerhouse/commit/3c9b41045))
|
|
37
|
+
- **registry:** resolve catalog references in Dockerfile with sed ([765e8fbdd](https://github.com/powerhouse-inc/powerhouse/commit/765e8fbdd))
|
|
38
|
+
- **registry:** copy pnpm-workspace.yaml for Docker build catalog resolution ([7407700b1](https://github.com/powerhouse-inc/powerhouse/commit/7407700b1))
|
|
39
|
+
- **reactor-browser:** removed subexports ([4cda7f44c](https://github.com/powerhouse-inc/powerhouse/commit/4cda7f44c))
|
|
40
|
+
- eslint config ([fb20b3726](https://github.com/powerhouse-inc/powerhouse/commit/fb20b3726))
|
|
41
|
+
- **vetra:** remove custom subgraphs from vetra ([3a1e3b9b0](https://github.com/powerhouse-inc/powerhouse/commit/3a1e3b9b0))
|
|
42
|
+
- resolve empty name causing silent ADD_FILE failure in drives ([b44ed0c1c](https://github.com/powerhouse-inc/powerhouse/commit/b44ed0c1c))
|
|
43
|
+
- **reactor-mcp:** adopt new reactor client interface for MCP server ([1b8e6fb19](https://github.com/powerhouse-inc/powerhouse/commit/1b8e6fb19))
|
|
44
|
+
|
|
45
|
+
### ❤️ Thank You
|
|
46
|
+
|
|
47
|
+
- acaldas @acaldas
|
|
48
|
+
- Benjamin Jordan
|
|
49
|
+
- Claude Opus 4.6
|
|
50
|
+
- Frank
|
|
51
|
+
- Guillermo Puente @gpuente
|
|
52
|
+
- Ryan Wolhuter @ryanwolhuter
|
|
53
|
+
- Samuel Hawksby-Robinson @Samyoul
|
|
54
|
+
|
|
55
|
+
## 6.0.0-staging.0 (2026-03-18)
|
|
2
56
|
|
|
3
57
|
### 🚀 Features
|
|
4
58
|
|
|
5
|
-
- **
|
|
6
|
-
- **
|
|
59
|
+
- **test-subscription:** adding a cli test-client for testing reactor api subscriptions ([563a8ac7d](https://github.com/powerhouse-inc/powerhouse/commit/563a8ac7d))
|
|
60
|
+
- **switchboard:** add OTel metrics export via OTEL_EXPORTER_OTLP_ENDPOINT ([52f34aa1f](https://github.com/powerhouse-inc/powerhouse/commit/52f34aa1f))
|
|
61
|
+
- reactor-hypercore example ([d5557973a](https://github.com/powerhouse-inc/powerhouse/commit/d5557973a))
|
|
62
|
+
- **renown,reactor-browser:** renown integration improvements ([a65731a73](https://github.com/powerhouse-inc/powerhouse/commit/a65731a73))
|
|
63
|
+
- **ci:** add gitops action for registry image updates ([ba91d00dd](https://github.com/powerhouse-inc/powerhouse/commit/ba91d00dd))
|
|
64
|
+
- **ci:** add registry Docker image to publish workflow ([17544abad](https://github.com/powerhouse-inc/powerhouse/commit/17544abad))
|
|
65
|
+
- opentelementry-instrumentation-reactor package ([67d5c31e5](https://github.com/powerhouse-inc/powerhouse/commit/67d5c31e5))
|
|
66
|
+
- **renown,reactor-browser,connect:** cleanup renown integration ([fe6112c2c](https://github.com/powerhouse-inc/powerhouse/commit/fe6112c2c))
|
|
67
|
+
- **connect,reactor-browser:** add dynamic package loading from HTTP registry ([f92816782](https://github.com/powerhouse-inc/powerhouse/commit/f92816782))
|
|
68
|
+
- **document-model,reactor-api,reactor-browser:** implemented remote document controller ([6299c21da](https://github.com/powerhouse-inc/powerhouse/commit/6299c21da))
|
|
69
|
+
- **switchboard,reactor-api,registry:** add runtime dynamic pacage loading from HTTP registry ([37f91250e](https://github.com/powerhouse-inc/powerhouse/commit/37f91250e))
|
|
70
|
+
- add new bundling for connect ([#2390](https://github.com/powerhouse-inc/powerhouse/pull/2390))
|
|
71
|
+
|
|
72
|
+
### 🩹 Fixes
|
|
73
|
+
|
|
74
|
+
- updated pnpm-lock ([c2843dc5b](https://github.com/powerhouse-inc/powerhouse/commit/c2843dc5b))
|
|
75
|
+
- **connect:** declare dependencies ([6aa6910d3](https://github.com/powerhouse-inc/powerhouse/commit/6aa6910d3))
|
|
76
|
+
- **design-system:** removed zod dependency ([fdc7c2ef7](https://github.com/powerhouse-inc/powerhouse/commit/fdc7c2ef7))
|
|
77
|
+
- **switchboard:** avoid double /v1/metrics suffix in OTLP exporter URL ([c184093c3](https://github.com/powerhouse-inc/powerhouse/commit/c184093c3))
|
|
78
|
+
- **switchboard:** enforce OTel provider registration ordering via StartServerOptions ([c797fd242](https://github.com/powerhouse-inc/powerhouse/commit/c797fd242))
|
|
79
|
+
- **codegen:** added missing deps to boilerplate ([721dcb581](https://github.com/powerhouse-inc/powerhouse/commit/721dcb581))
|
|
80
|
+
- **switchboard:** derive exportTimeoutMillis from exportIntervalMillis ([775a77f3b](https://github.com/powerhouse-inc/powerhouse/commit/775a77f3b))
|
|
81
|
+
- **switchboard:** set exportTimeoutMillis to stay under shutdown deadline ([341d88d9e](https://github.com/powerhouse-inc/powerhouse/commit/341d88d9e))
|
|
82
|
+
- **switchboard:** address further OTel metrics review feedback ([dee185ba8](https://github.com/powerhouse-inc/powerhouse/commit/dee185ba8))
|
|
83
|
+
- **switchboard:** address OTel metrics review feedback ([c5ac016fc](https://github.com/powerhouse-inc/powerhouse/commit/c5ac016fc))
|
|
84
|
+
- **common:** added missing runtime dependencies ([b0f647f75](https://github.com/powerhouse-inc/powerhouse/commit/b0f647f75))
|
|
85
|
+
- adding build-bundle to simulate-ci-workflow ([ca93d1a2b](https://github.com/powerhouse-inc/powerhouse/commit/ca93d1a2b))
|
|
86
|
+
- **renown:** moved e2e script test to reactor-browser ([3c9b41045](https://github.com/powerhouse-inc/powerhouse/commit/3c9b41045))
|
|
87
|
+
- **registry:** resolve catalog references in Dockerfile with sed ([765e8fbdd](https://github.com/powerhouse-inc/powerhouse/commit/765e8fbdd))
|
|
88
|
+
- **registry:** copy pnpm-workspace.yaml for Docker build catalog resolution ([7407700b1](https://github.com/powerhouse-inc/powerhouse/commit/7407700b1))
|
|
89
|
+
- **reactor-browser:** removed subexports ([4cda7f44c](https://github.com/powerhouse-inc/powerhouse/commit/4cda7f44c))
|
|
90
|
+
- eslint config ([fb20b3726](https://github.com/powerhouse-inc/powerhouse/commit/fb20b3726))
|
|
91
|
+
- **vetra:** remove custom subgraphs from vetra ([3a1e3b9b0](https://github.com/powerhouse-inc/powerhouse/commit/3a1e3b9b0))
|
|
92
|
+
- resolve empty name causing silent ADD_FILE failure in drives ([b44ed0c1c](https://github.com/powerhouse-inc/powerhouse/commit/b44ed0c1c))
|
|
93
|
+
- **reactor-mcp:** adopt new reactor client interface for MCP server ([1b8e6fb19](https://github.com/powerhouse-inc/powerhouse/commit/1b8e6fb19))
|
|
7
94
|
|
|
8
95
|
### ❤️ Thank You
|
|
9
96
|
|
|
97
|
+
- acaldas
|
|
98
|
+
- Benjamin Jordan
|
|
10
99
|
- Frank
|
|
100
|
+
- Guillermo Puente
|
|
101
|
+
- Ryan Wolhuter
|
|
102
|
+
- Samuel Hawksby-Robinson
|
|
103
|
+
|
|
104
|
+
## 6.0.1-staging.1 (2026-03-03)
|
|
105
|
+
|
|
106
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
107
|
+
|
|
108
|
+
## 6.0.0-dev.67 (2026-03-03)
|
|
109
|
+
|
|
110
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
11
111
|
|
|
12
|
-
## 6.0.0-
|
|
112
|
+
## 6.0.0-dev.66 (2026-03-03)
|
|
13
113
|
|
|
14
114
|
### 🚀 Features
|
|
15
115
|
|
|
16
|
-
-
|
|
17
|
-
- use update-ts-references tool which also removes unused ones ([#2374](https://github.com/powerhouse-inc/powerhouse/pull/2374))
|
|
116
|
+
- move reactor logic from connect to reactor browser ([#2385](https://github.com/powerhouse-inc/powerhouse/pull/2385))
|
|
18
117
|
|
|
19
118
|
### ❤️ Thank You
|
|
20
119
|
|
|
21
120
|
- Ryan Wolhuter @ryanwolhuter
|
|
22
121
|
|
|
23
|
-
## 6.0.0-
|
|
122
|
+
## 6.0.0-dev.65 (2026-03-03)
|
|
123
|
+
|
|
124
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
125
|
+
|
|
126
|
+
## 6.0.0-dev.64 (2026-03-03)
|
|
127
|
+
|
|
128
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
129
|
+
|
|
130
|
+
## 6.0.0-dev.62 (2026-03-03)
|
|
24
131
|
|
|
25
132
|
### 🚀 Features
|
|
26
133
|
|
|
27
|
-
-
|
|
134
|
+
- **ci:** push academy to Harbor academy project and update k8s for academy namespace ([efbf8f58d](https://github.com/powerhouse-inc/powerhouse/commit/efbf8f58d))
|
|
135
|
+
|
|
136
|
+
### 🩹 Fixes
|
|
137
|
+
|
|
138
|
+
- cherry-picked fixes ([a73630a6a](https://github.com/powerhouse-inc/powerhouse/commit/a73630a6a))
|
|
139
|
+
- moving analytics processors to shared and fixing them, fixing other linting errors toos ([0c8f7fe98](https://github.com/powerhouse-inc/powerhouse/commit/0c8f7fe98))
|
|
28
140
|
|
|
29
141
|
### ❤️ Thank You
|
|
30
142
|
|
|
143
|
+
- Benjamin Jordan
|
|
144
|
+
- Frank
|
|
145
|
+
|
|
146
|
+
## 6.0.0-dev.61 (2026-02-27)
|
|
147
|
+
|
|
148
|
+
### 🚀 Features
|
|
149
|
+
|
|
150
|
+
- **ci:** update k8s-hosting academy image tag after docker publish ([0b98b73a9](https://github.com/powerhouse-inc/powerhouse/commit/0b98b73a9))
|
|
151
|
+
- add bundle step for ph cli ([#2375](https://github.com/powerhouse-inc/powerhouse/pull/2375))
|
|
152
|
+
|
|
153
|
+
### ❤️ Thank You
|
|
154
|
+
|
|
155
|
+
- Frank
|
|
31
156
|
- Ryan Wolhuter @ryanwolhuter
|
|
32
157
|
|
|
33
|
-
## 6.0.0-
|
|
158
|
+
## 6.0.0-dev.60 (2026-02-27)
|
|
34
159
|
|
|
35
160
|
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
36
161
|
|
|
162
|
+
## 6.0.0-dev.59 (2026-02-26)
|
|
163
|
+
|
|
164
|
+
### 🚀 Features
|
|
165
|
+
|
|
166
|
+
- use update-ts-references tool which also removes unused ones ([#2374](https://github.com/powerhouse-inc/powerhouse/pull/2374))
|
|
167
|
+
|
|
168
|
+
### ❤️ Thank You
|
|
169
|
+
|
|
170
|
+
- Ryan Wolhuter @ryanwolhuter
|
|
171
|
+
|
|
37
172
|
## 6.0.0-dev.58 (2026-02-25)
|
|
38
173
|
|
|
39
174
|
### 🚀 Features
|
|
@@ -521,7 +656,7 @@ This was a version bump only for @powerhousedao/switchboard to align it with oth
|
|
|
521
656
|
### 🚀 Features
|
|
522
657
|
|
|
523
658
|
- **design-system:** default styles tweaks and DocumentStateViewer ([c0a66720c](https://github.com/powerhouse-inc/powerhouse/commit/c0a66720c))
|
|
524
|
-
- **ci:** deploy staging tenant from release/staging
|
|
659
|
+
- **ci:** deploy staging tenant from release/staging/\* branches ([8761579e7](https://github.com/powerhouse-inc/powerhouse/commit/8761579e7))
|
|
525
660
|
- **ci:** add Harbor registry to docker image publishing ([f3a2fab69](https://github.com/powerhouse-inc/powerhouse/commit/f3a2fab69))
|
|
526
661
|
|
|
527
662
|
### 🩹 Fixes
|
|
@@ -3146,7 +3281,7 @@ This was a version bump only for @powerhousedao/switchboard to align it with oth
|
|
|
3146
3281
|
|
|
3147
3282
|
- **reactor-api:** init project ([#388](https://github.com/powerhouse-inc/powerhouse/pull/388))
|
|
3148
3283
|
|
|
3149
|
-
### ❤️
|
|
3284
|
+
### ❤️ Thank You
|
|
3150
3285
|
|
|
3151
3286
|
- acaldas
|
|
3152
3287
|
|
|
@@ -3160,7 +3295,7 @@ This was a version bump only for @powerhousedao/switchboard to align it with oth
|
|
|
3160
3295
|
|
|
3161
3296
|
- Updated @powerhousedao/reactor-api to 1.1.0
|
|
3162
3297
|
|
|
3163
|
-
### ❤️
|
|
3298
|
+
### ❤️ Thank You
|
|
3164
3299
|
|
|
3165
3300
|
- acaldas
|
|
3166
3301
|
|
|
@@ -3174,6 +3309,6 @@ This was a version bump only for @powerhousedao/switchboard to align it with oth
|
|
|
3174
3309
|
|
|
3175
3310
|
- Updated @powerhousedao/general-document-indexer to 1.1.0
|
|
3176
3311
|
|
|
3177
|
-
### ❤️
|
|
3312
|
+
### ❤️ Thank You
|
|
3178
3313
|
|
|
3179
|
-
- acaldas
|
|
3314
|
+
- acaldas
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import * as Sentry from "@sentry/node";
|
|
3
|
+
import { childLogger } from "document-drive";
|
|
2
4
|
import { config } from "./config.js";
|
|
5
|
+
import { createMeterProviderFromEnv } from "./metrics.js";
|
|
6
|
+
import { initProfilerFromEnv } from "./profiler.js";
|
|
3
7
|
import { startSwitchboard } from "./server.js";
|
|
8
|
+
const logger = childLogger(["switchboard"]);
|
|
4
9
|
function ensureNodeVersion(minVersion = "24") {
|
|
5
10
|
const version = process.versions.node;
|
|
6
11
|
if (!version) {
|
|
@@ -13,9 +18,32 @@ function ensureNodeVersion(minVersion = "24") {
|
|
|
13
18
|
}
|
|
14
19
|
// Ensure minimum Node.js version
|
|
15
20
|
ensureNodeVersion("24");
|
|
16
|
-
|
|
21
|
+
const meterProvider = createMeterProviderFromEnv({
|
|
22
|
+
OTEL_EXPORTER_OTLP_ENDPOINT: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
23
|
+
OTEL_METRIC_EXPORT_INTERVAL: process.env.OTEL_METRIC_EXPORT_INTERVAL,
|
|
24
|
+
OTEL_SERVICE_NAME: process.env.OTEL_SERVICE_NAME,
|
|
25
|
+
});
|
|
26
|
+
async function shutdown() {
|
|
17
27
|
console.log("\nShutting down...");
|
|
28
|
+
// Flush final metrics before exit. Races against a 5s deadline so an
|
|
29
|
+
// unresponsive OTLP endpoint cannot exhaust terminationGracePeriodSeconds.
|
|
30
|
+
await Promise.race([
|
|
31
|
+
meterProvider?.shutdown().catch(() => undefined),
|
|
32
|
+
new Promise((resolve) => setTimeout(resolve, 5_000)),
|
|
33
|
+
]);
|
|
18
34
|
process.exit(0);
|
|
19
|
-
}
|
|
20
|
-
|
|
35
|
+
}
|
|
36
|
+
// SIGINT: Ctrl-C in development; SIGTERM: graceful shutdown in Docker/Kubernetes
|
|
37
|
+
process.on("SIGINT", shutdown);
|
|
38
|
+
process.on("SIGTERM", shutdown);
|
|
39
|
+
if (process.env.PYROSCOPE_SERVER_ADDRESS) {
|
|
40
|
+
try {
|
|
41
|
+
await initProfilerFromEnv(process.env);
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
Sentry.captureException(e);
|
|
45
|
+
logger.error("Error starting profiler: @error", e);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
startSwitchboard({ ...config, meterProvider }).catch(console.error);
|
|
21
49
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,SAAS,iBAAiB,CAAC,UAAU,GAAG,IAAI;IAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IACtC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;IACT,CAAC;IAED,IAAI,OAAO,GAAG,UAAU,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CACX,gBAAgB,UAAU,4CAA4C,OAAO,EAAE,CAChF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AACD,iCAAiC;AACjC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAExB,OAAO,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,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AC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAEhC,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC;IACzC,IAAI,CAAC;QACH,MAAM,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;AAED,gBAAgB,CAAC,EAAE,GAAG,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MeterProvider } from "@opentelemetry/sdk-metrics";
|
|
2
|
+
export declare function createMeterProviderFromEnv(env: {
|
|
3
|
+
OTEL_EXPORTER_OTLP_ENDPOINT?: string;
|
|
4
|
+
OTEL_METRIC_EXPORT_INTERVAL?: string;
|
|
5
|
+
OTEL_SERVICE_NAME?: string;
|
|
6
|
+
}): MeterProvider | undefined;
|
|
7
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EAEd,MAAM,4BAA4B,CAAC;AAKpC,wBAAgB,0BAA0B,CAAC,GAAG,EAAE;IAC9C,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,aAAa,GAAG,SAAS,CA8B5B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
|
|
2
|
+
import { Resource } from "@opentelemetry/resources";
|
|
3
|
+
import { MeterProvider, PeriodicExportingMetricReader, } from "@opentelemetry/sdk-metrics";
|
|
4
|
+
import { childLogger } from "document-drive";
|
|
5
|
+
const logger = childLogger(["switchboard", "metrics"]);
|
|
6
|
+
export function createMeterProviderFromEnv(env) {
|
|
7
|
+
const endpoint = env.OTEL_EXPORTER_OTLP_ENDPOINT;
|
|
8
|
+
if (!endpoint)
|
|
9
|
+
return undefined;
|
|
10
|
+
const parsed = parseInt(env.OTEL_METRIC_EXPORT_INTERVAL ?? "", 10);
|
|
11
|
+
const exportIntervalMillis = Number.isFinite(parsed) && parsed > 0 ? parsed : 5_000;
|
|
12
|
+
const base = endpoint.replace(/\/$/, "");
|
|
13
|
+
const exporterUrl = base.endsWith("/v1/metrics")
|
|
14
|
+
? base
|
|
15
|
+
: `${base}/v1/metrics`;
|
|
16
|
+
logger.info(`Initializing OpenTelemetry metrics exporter at: ${endpoint}`);
|
|
17
|
+
const meterProvider = new MeterProvider({
|
|
18
|
+
resource: new Resource({
|
|
19
|
+
"service.name": env.OTEL_SERVICE_NAME ?? "switchboard",
|
|
20
|
+
}),
|
|
21
|
+
readers: [
|
|
22
|
+
new PeriodicExportingMetricReader({
|
|
23
|
+
exporter: new OTLPMetricExporter({
|
|
24
|
+
url: exporterUrl,
|
|
25
|
+
}),
|
|
26
|
+
exportIntervalMillis,
|
|
27
|
+
exportTimeoutMillis: Math.max(exportIntervalMillis - 250, 1),
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
logger.info(`Metrics export enabled (interval: ${exportIntervalMillis}ms)`);
|
|
32
|
+
return meterProvider;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,QAA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C,CAAC;aAC7D,CAAC;SACH;KACF,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,qCAAqC,oBAAoB,KAAK,CAAC,CAAC;IAC5E,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
package/dist/src/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";AA4CA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";AA4CA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA+RzE,eAAO,MAAM,gBAAgB,GAC3B,UAAS,kBAAuB,KAC/B,OAAO,CAAC,kBAAkB,CA+C5B,CAAC;AAEF,cAAc,YAAY,CAAC"}
|