@burdenoff/be-sdk 2026.725.2 → 2026.803.1

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.
@@ -1,4 +1,4 @@
1
- import { getMetricsRegistry } from './chunk-REF7PANB.js';
1
+ import { getMetricsRegistry } from './chunk-Q6UAOZFZ.js';
2
2
  import { __name } from './chunk-XE4OXN2W.js';
3
3
 
4
4
  // src/metrics/workspace-quota-metrics.ts
@@ -49,5 +49,5 @@ function resetWorkspaceQuotaRegistry() {
49
49
  __name(resetWorkspaceQuotaRegistry, "resetWorkspaceQuotaRegistry");
50
50
 
51
51
  export { getWorkspaceQuotaRegistry, resetWorkspaceQuotaRegistry };
52
- //# sourceMappingURL=chunk-32KT5RF2.js.map
53
- //# sourceMappingURL=chunk-32KT5RF2.js.map
52
+ //# sourceMappingURL=chunk-4OPOVK54.js.map
53
+ //# sourceMappingURL=chunk-4OPOVK54.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/metrics/workspace-quota-metrics.ts"],"names":["WorkspaceQuotaRegistry","collectors","gauges","Map","register","collector","push","collectAll","Promise","allSettled","map","has","metricName","set","getMetricsRegistry","createGauge","help","gauge","get","values","collect","workspaceId","value","workspace_id","quota_name","quotaName","getCollectors","_registry","getWorkspaceQuotaRegistry","resetWorkspaceQuotaRegistry"],"mappings":";;;;AAkCA,IAAMA,sBAAAA,GAAN,MAAMA,uBAAAA,CAAAA;EAlCN;;;AAmCmBC,EAAAA,UAAAA,GAAwC,EAAA;AACxCC,EAAAA,MAAAA,uBAAaC,GAAAA,EAAAA;AAE9BC,EAAAA,QAAAA,CAASC,SAAAA,EAA0C;AACjD,IAAA,IAAA,CAAKJ,UAAAA,CAAWK,KAAKD,SAAAA,CAAAA;AACvB,EAAA;;;;;;AAOA,EAAA,MAAME,UAAAA,GAA4B;AAChC,IAAA,MAAMC,QAAQC,UAAAA,CACZ,IAAA,CAAKR,UAAAA,CAAWS,GAAAA,CAAI,OAAO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ourcesContent":["import { getMetricsRegistry } from '../instrumentation/metrics-collector.js';\nimport type { Gauge } from '../instrumentation/metrics-collector.js';\n\n/**\n * A single workspace-scoped quota metric.\n *\n * Services implement this and register it with WorkspaceQuotaRegistry at startup.\n * The metrics endpoint calls collectAll() on every scrape so values are always fresh.\n *\n * Pattern:\n * 1. Service registers collectors at startup (after instrumentation is initialized)\n * 2. /api/metrics handler calls collectAll() before serializing Prometheus output\n * 3. activity-svc scrapes /api/metrics and correlates values via quotaName to billing limits\n */\nexport interface WorkspaceQuotaCollector {\n /** Prometheus metric name, e.g. \"vibecontrols_tunnels_active\" */\n readonly metricName: string;\n /** Human-readable description shown in Prometheus HELP output */\n readonly help: string;\n /**\n * Billing quota name this metric maps to.\n * activity-svc uses this to correlate scraped values with quota limits.\n * e.g. \"vibecontrols.tunnels.active\"\n */\n readonly quotaName: string;\n /**\n * Called on every Prometheus scrape.\n * Must return current value per workspace ID.\n * Should be a fast, bounded DB query (GROUP BY workspace_id).\n * Failures are caught with Promise.allSettled — one failing collector does not block others.\n */\n collect(): Promise<Map<string, number>>;\n}\n\nclass WorkspaceQuotaRegistry {\n private readonly collectors: WorkspaceQuotaCollector[] = [];\n private readonly gauges = new Map<string, Gauge>();\n\n register(collector: WorkspaceQuotaCollector): void {\n this.collectors.push(collector);\n }\n\n /**\n * Runs all registered collectors and updates their gauges with fresh values.\n * Gauges are created lazily on first collectAll() to ensure MetricsRegistry\n * is initialized before gauge creation (instrumentation must be set up first).\n */\n async collectAll(): Promise<void> {\n await Promise.allSettled(\n this.collectors.map(async (collector) => {\n if (!this.gauges.has(collector.metricName)) {\n this.gauges.set(collector.metricName, getMetricsRegistry().createGauge(collector.metricName, collector.help));\n }\n const gauge = this.gauges.get(collector.metricName);\n if (!gauge) return;\n const values = await collector.collect();\n for (const [workspaceId, value] of values) {\n gauge.set(value, { workspace_id: workspaceId, quota_name: collector.quotaName });\n }\n })\n );\n }\n\n /** Returns registered collectors — useful for activity-svc to discover tracked quota names. */\n getCollectors(): readonly WorkspaceQuotaCollector[] {\n return this.collectors;\n }\n}\n\nlet _registry: WorkspaceQuotaRegistry | null = null;\n\nexport function getWorkspaceQuotaRegistry(): WorkspaceQuotaRegistry {\n if (!_registry) _registry = new WorkspaceQuotaRegistry();\n return _registry;\n}\n\n/** For testing only. */\nexport function resetWorkspaceQuotaRegistry(): void {\n _registry = null;\n}\n"]}
1
+ {"version":3,"sources":["../src/metrics/workspace-quota-metrics.ts"],"names":["WorkspaceQuotaRegistry","collectors","gauges","Map","register","collector","push","collectAll","Promise","allSettled","map","has","metricName","set","getMetricsRegistry","createGauge","help","gauge","get","values","collect","workspaceId","value","workspace_id","quota_name","quotaName","getCollectors","_registry","getWorkspaceQuotaRegistry","resetWorkspaceQuotaRegistry"],"mappings":";;;;AAkCA,IAAMA,sBAAAA,GAAN,MAAMA,uBAAAA,CAAAA;EAlCN;;;AAmCmBC,EAAAA,UAAAA,GAAwC,EAAA;AACxCC,EAAAA,MAAAA,uBAAaC,GAAAA,EAAAA;AAE9BC,EAAAA,QAAAA,CAASC,SAAAA,EAA0C;AACjD,IAAA,IAAA,CAAKJ,UAAAA,CAAWK,KAAKD,SAAAA,CAAAA;AACvB,EAAA;;;;;;AAOA,EAAA,MAAME,UAAAA,GAA4B;AAChC,IAAA,MAAMC,QAAQC,UAAAA,CACZ,IAAA,CAAKR,UAAAA,CAAWS,GAAAA,CAAI,OAAOL,SAAAA,KAAAA;AACzB,MAAA,IAAI,CAAC,IAAA,CAAKH,MAAAA,CAAOS,GAAAA,CAAIN,SAAAA,CAAUO,UAAU,CAAA,EAAG;AAC1C,QAAA,IAAA,CAAKV,MAAAA,CAAOW,GAAAA,CAAIR,SAAAA,CAAUO,UAAAA,EAAYE,kBAAAA,EAAAA,CAAqBC,WAAAA,CAAYV,SAAAA,CAAUO,UAAAA,EAAYP,SAAAA,CAAUW,IAAI,CAAA,CAAA;AAC7G,MAAA;AACA,MAAA,MAAMC,KAAAA,GAAQ,IAAA,CAAKf,MAAAA,CAAOgB,GAAAA,CAAIb,UAAUO,UAAU,CAAA;AAClD,MAAA,IAAI,CAACK,KAAAA,EAAO;AACZ,MAAA,MAAME,MAAAA,GAAS,MAAMd,SAAAA,CAAUe,OAAAA,EAAO;AACtC,MAAA,KAAA,MAAW,CAACC,WAAAA,EAAaC,KAAAA,CAAAA,IAAUH,MAAAA,EAAQ;AACzCF,QAAAA,KAAAA,CAAMJ,IAAIS,KAAAA,EAAO;UAAEC,YAAAA,EAAcF,WAAAA;AAAaG,UAAAA,UAAAA,EAAYnB,SAAAA,CAAUoB;SAAU,CAAA;AAChF,MAAA;AACF,IAAA,CAAA,CAAA,CAAA;AAEJ,EAAA;;EAGAC,aAAAA,GAAoD;AAClD,IAAA,OAAO,IAAA,CAAKzB,UAAAA;AACd,EAAA;AACF,CAAA;AAEA,IAAI0B,SAAAA,GAA2C,IAAA;AAExC,SAASC,yBAAAA,GAAAA;AACd,EAAA,IAAI,CAACD,SAAAA,EAAWA,SAAAA,GAAY,IAAI3B,sBAAAA,EAAAA;AAChC,EAAA,OAAO2B,SAAAA;AACT;AAHgBC,MAAAA,CAAAA,yBAAAA,EAAAA,2BAAAA,CAAAA;AAMT,SAASC,2BAAAA,GAAAA;AACdF,EAAAA,SAAAA,GAAY,IAAA;AACd;AAFgBE,MAAAA,CAAAA,2BAAAA,EAAAA,6BAAAA,CAAAA","file":"chunk-4OPOVK54.js","sourcesContent":["import { getMetricsRegistry } from '../instrumentation/metrics-collector.js';\nimport type { Gauge } from '../instrumentation/metrics-collector.js';\n\n/**\n * A single workspace-scoped quota metric.\n *\n * Services implement this and register it with WorkspaceQuotaRegistry at startup.\n * The metrics endpoint calls collectAll() on every scrape so values are always fresh.\n *\n * Pattern:\n * 1. Service registers collectors at startup (after instrumentation is initialized)\n * 2. /api/metrics handler calls collectAll() before serializing Prometheus output\n * 3. activity-svc scrapes /api/metrics and correlates values via quotaName to billing limits\n */\nexport interface WorkspaceQuotaCollector {\n /** Prometheus metric name, e.g. \"vibecontrols_tunnels_active\" */\n readonly metricName: string;\n /** Human-readable description shown in Prometheus HELP output */\n readonly help: string;\n /**\n * Billing quota name this metric maps to.\n * activity-svc uses this to correlate scraped values with quota limits.\n * e.g. \"vibecontrols.tunnels.active\"\n */\n readonly quotaName: string;\n /**\n * Called on every Prometheus scrape.\n * Must return current value per workspace ID.\n * Should be a fast, bounded DB query (GROUP BY workspace_id).\n * Failures are caught with Promise.allSettled — one failing collector does not block others.\n */\n collect(): Promise<Map<string, number>>;\n}\n\nclass WorkspaceQuotaRegistry {\n private readonly collectors: WorkspaceQuotaCollector[] = [];\n private readonly gauges = new Map<string, Gauge>();\n\n register(collector: WorkspaceQuotaCollector): void {\n this.collectors.push(collector);\n }\n\n /**\n * Runs all registered collectors and updates their gauges with fresh values.\n * Gauges are created lazily on first collectAll() to ensure MetricsRegistry\n * is initialized before gauge creation (instrumentation must be set up first).\n */\n async collectAll(): Promise<void> {\n await Promise.allSettled(\n this.collectors.map(async (collector) => {\n if (!this.gauges.has(collector.metricName)) {\n this.gauges.set(collector.metricName, getMetricsRegistry().createGauge(collector.metricName, collector.help));\n }\n const gauge = this.gauges.get(collector.metricName);\n if (!gauge) return;\n const values = await collector.collect();\n for (const [workspaceId, value] of values) {\n gauge.set(value, { workspace_id: workspaceId, quota_name: collector.quotaName });\n }\n })\n );\n }\n\n /** Returns registered collectors — useful for activity-svc to discover tracked quota names. */\n getCollectors(): readonly WorkspaceQuotaCollector[] {\n return this.collectors;\n }\n}\n\nlet _registry: WorkspaceQuotaRegistry | null = null;\n\nexport function getWorkspaceQuotaRegistry(): WorkspaceQuotaRegistry {\n if (!_registry) _registry = new WorkspaceQuotaRegistry();\n return _registry;\n}\n\n/** For testing only. */\nexport function resetWorkspaceQuotaRegistry(): void {\n _registry = null;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { updateInstrumentationConfig, resetMetricsRegistry, resetInstrumentationConfig, isMetricsRegistryInitialized, isInstrumentationConfigInitialized, isFeatureEnabled, initializeMetricsRegistry, initializeInstrumentationConfig, getMetricsRegistry, getInstrumentationConfig, createUpDownCounter, createHistogram, createGauge, createCounter, buildTracingConfig, buildMetricsConfig, buildInstrumentationConfig, buildGraphQLConfig, buildFeatureFlags, buildDatabaseConfig, MetricsRegistry, ENV_VARS, DEFAULT_TRACING_CONFIG, DEFAULT_METRICS_CONFIG, DEFAULT_LOGGING_CONFIG, DEFAULT_HTTP_CONFIG, DEFAULT_GRAPHQL_CONFIG, DEFAULT_FEATURE_FLAGS, DEFAULT_EVENT_QUEUE_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_CACHE_CONFIG } from './chunk-REF7PANB.js';
1
+ import { updateInstrumentationConfig, resetMetricsRegistry, resetInstrumentationConfig, isMetricsRegistryInitialized, isInstrumentationConfigInitialized, isFeatureEnabled, initializeMetricsRegistry, initializeInstrumentationConfig, getMetricsRegistry, getInstrumentationConfig, createUpDownCounter, createHistogram, createGauge, createCounter, buildTracingConfig, buildMetricsConfig, buildInstrumentationConfig, buildGraphQLConfig, buildFeatureFlags, buildDatabaseConfig, MetricsRegistry, ENV_VARS, DEFAULT_TRACING_CONFIG, DEFAULT_METRICS_CONFIG, DEFAULT_LOGGING_CONFIG, DEFAULT_HTTP_CONFIG, DEFAULT_GRAPHQL_CONFIG, DEFAULT_FEATURE_FLAGS, DEFAULT_EVENT_QUEUE_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_CACHE_CONFIG } from './chunk-Q6UAOZFZ.js';
2
2
  import { logger } from './chunk-CBZNP6RF.js';
3
3
  import { __export, __name } from './chunk-XE4OXN2W.js';
4
4
  import { createRequire } from 'module';
@@ -1594,5 +1594,5 @@ function setupInstrumentation(serviceName, options) {
1594
1594
  __name(setupInstrumentation, "setupInstrumentation");
1595
1595
 
1596
1596
  export { Instrument, Log, Metric, STANDARD_METRICS, SpanKind, SpanStatus, Trace, Tracer, createApolloInlineTracePlugin, createGraphQLInstrumentationPlugin, createPrometheusPlugin, extractOperationInfo, extractTraceContext, getGraphQLOperationFromContext, getGraphQLSpanFromContext, getLogger, getTraceContext, getTracer, initializeInstrumentation, initializeTracer, injectTraceContext, instrumentResolver, instrumentResolverMap, instrumentation_exports, instrumented, isApolloInlineTraceAvailable, isInstrumentationInitialized, isPrometheusAvailable, isTracerInitialized, resetInstrumentation, setActiveTelemetryLogger, setupInstrumentation, startSpan, traced, withSpan };
1597
- //# sourceMappingURL=chunk-ACYGOENW.js.map
1598
- //# sourceMappingURL=chunk-ACYGOENW.js.map
1597
+ //# sourceMappingURL=chunk-GTX65XAP.js.map
1598
+ //# sourceMappingURL=chunk-GTX65XAP.js.map