Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -28,10 +28,14 @@ export function resetWebMetricsForTests(): void {
|
||||
|
||||
function buildWebMetrics(): WebMetricsBundle {
|
||||
const revision = process.env.APP_REVISION?.trim() ?? "";
|
||||
const runtimeSurface = resolveMetricsRuntimeSurface(process.env);
|
||||
const registry = createMetricsRegistry({
|
||||
serviceName: "web",
|
||||
collectDefaultProcessMetrics: true,
|
||||
...(revision ? { defaultLabels: { revision } } : {}),
|
||||
defaultLabels: {
|
||||
runtime_surface: runtimeSurface,
|
||||
...(revision ? { revision } : {}),
|
||||
},
|
||||
});
|
||||
const metrics = createDefaultMetrics(registry);
|
||||
// Wire BullMQ enqueue events into queue_jobs_enqueued_total. See
|
||||
@@ -41,3 +45,14 @@ function buildWebMetrics(): WebMetricsBundle {
|
||||
});
|
||||
return { registry, metrics };
|
||||
}
|
||||
|
||||
function resolveMetricsRuntimeSurface(env: Readonly<{ NODE_ENV?: string; VITEST?: string; WEB_RUNTIME_SURFACE?: string }>): "core" | "admin" | "portal" {
|
||||
const surface = env.WEB_RUNTIME_SURFACE;
|
||||
if (surface === "core" || surface === "admin" || surface === "portal") {
|
||||
return surface;
|
||||
}
|
||||
if (surface === undefined && (env.NODE_ENV === "test" || env.VITEST === "true")) {
|
||||
return "core";
|
||||
}
|
||||
throw new Error("WEB_RUNTIME_SURFACE must be explicitly set to core, admin, or portal before web metrics initialization");
|
||||
}
|
||||
Reference in new issue
Block a user