@smthrs/observability 0.35.0 → 1.0.0-rc.12

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.
Files changed (363) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/LICENSE +1 -1
  3. package/README.md +87 -0
  4. package/dist/cjs/BrowserOtel.d.ts +37 -0
  5. package/dist/cjs/BrowserOtel.d.ts.map +1 -0
  6. package/dist/cjs/BrowserOtel.js +47 -0
  7. package/dist/cjs/BrowserOtel.js.map +7 -0
  8. package/dist/cjs/Endpoint.d.ts +70 -0
  9. package/dist/cjs/Endpoint.d.ts.map +1 -0
  10. package/dist/cjs/Endpoint.js +85 -0
  11. package/dist/cjs/Endpoint.js.map +7 -0
  12. package/dist/cjs/JournalLogger.d.ts +232 -0
  13. package/dist/cjs/JournalLogger.d.ts.map +1 -0
  14. package/dist/cjs/JournalLogger.js +415 -0
  15. package/dist/cjs/JournalLogger.js.map +7 -0
  16. package/dist/cjs/Logger.d.ts +56 -0
  17. package/dist/cjs/Logger.d.ts.map +1 -0
  18. package/dist/cjs/Logger.js +72 -0
  19. package/dist/cjs/Logger.js.map +7 -0
  20. package/dist/cjs/Metric.d.ts +67 -0
  21. package/dist/cjs/Metric.d.ts.map +1 -0
  22. package/dist/cjs/Metric.js +68 -0
  23. package/dist/cjs/Metric.js.map +7 -0
  24. package/dist/cjs/NodeOtel.d.ts +42 -0
  25. package/dist/cjs/NodeOtel.d.ts.map +1 -0
  26. package/dist/cjs/NodeOtel.js +78 -0
  27. package/dist/cjs/NodeOtel.js.map +7 -0
  28. package/dist/cjs/Otel.d.ts +63 -0
  29. package/dist/cjs/Otel.d.ts.map +1 -0
  30. package/dist/cjs/Otel.js +75 -0
  31. package/dist/cjs/Otel.js.map +7 -0
  32. package/dist/cjs/Otlp.d.ts +203 -0
  33. package/dist/cjs/Otlp.d.ts.map +1 -0
  34. package/dist/cjs/Otlp.js +251 -0
  35. package/dist/cjs/Otlp.js.map +7 -0
  36. package/dist/cjs/Resource.d.ts +163 -0
  37. package/dist/cjs/Resource.d.ts.map +1 -0
  38. package/dist/cjs/Resource.js +186 -0
  39. package/dist/cjs/Resource.js.map +7 -0
  40. package/dist/cjs/index.d.ts +61 -0
  41. package/dist/cjs/index.d.ts.map +1 -0
  42. package/dist/cjs/index.js +47 -0
  43. package/dist/cjs/index.js.map +7 -0
  44. package/dist/cjs/internal/schemaIssuePath.d.ts +31 -0
  45. package/dist/cjs/internal/schemaIssuePath.d.ts.map +1 -0
  46. package/dist/cjs/internal/schemaIssuePath.js +49 -0
  47. package/dist/cjs/internal/schemaIssuePath.js.map +7 -0
  48. package/dist/cjs/package.json +1 -0
  49. package/dist/esm/BrowserOtel.d.ts +37 -0
  50. package/dist/esm/BrowserOtel.d.ts.map +1 -0
  51. package/dist/esm/BrowserOtel.js +24 -0
  52. package/dist/esm/BrowserOtel.js.map +1 -0
  53. package/dist/esm/Endpoint.d.ts +70 -0
  54. package/dist/esm/Endpoint.d.ts.map +1 -0
  55. package/dist/esm/Endpoint.js +110 -0
  56. package/dist/esm/Endpoint.js.map +1 -0
  57. package/dist/esm/JournalLogger.d.ts +232 -0
  58. package/dist/esm/JournalLogger.d.ts.map +1 -0
  59. package/dist/esm/JournalLogger.js +520 -0
  60. package/dist/esm/JournalLogger.js.map +1 -0
  61. package/dist/esm/Logger.d.ts +56 -0
  62. package/dist/esm/Logger.d.ts.map +1 -0
  63. package/dist/esm/Logger.js +61 -0
  64. package/dist/esm/Logger.js.map +1 -0
  65. package/dist/esm/Metric.d.ts +67 -0
  66. package/dist/esm/Metric.d.ts.map +1 -0
  67. package/dist/esm/Metric.js +80 -0
  68. package/dist/esm/Metric.js.map +1 -0
  69. package/dist/esm/NodeOtel.d.ts +42 -0
  70. package/dist/esm/NodeOtel.d.ts.map +1 -0
  71. package/dist/esm/NodeOtel.js +56 -0
  72. package/dist/esm/NodeOtel.js.map +1 -0
  73. package/dist/esm/Otel.d.ts +63 -0
  74. package/dist/esm/Otel.d.ts.map +1 -0
  75. package/dist/esm/Otel.js +52 -0
  76. package/dist/esm/Otel.js.map +1 -0
  77. package/dist/esm/Otlp.d.ts +203 -0
  78. package/dist/esm/Otlp.d.ts.map +1 -0
  79. package/dist/esm/Otlp.js +384 -0
  80. package/dist/esm/Otlp.js.map +1 -0
  81. package/dist/esm/Resource.d.ts +163 -0
  82. package/dist/esm/Resource.d.ts.map +1 -0
  83. package/dist/esm/Resource.js +238 -0
  84. package/dist/esm/Resource.js.map +1 -0
  85. package/dist/esm/index.d.ts +61 -0
  86. package/dist/esm/index.d.ts.map +1 -0
  87. package/dist/esm/index.js +61 -0
  88. package/dist/esm/index.js.map +1 -0
  89. package/dist/esm/internal/schemaIssuePath.d.ts +31 -0
  90. package/dist/esm/internal/schemaIssuePath.d.ts.map +1 -0
  91. package/dist/esm/internal/schemaIssuePath.js +59 -0
  92. package/dist/esm/internal/schemaIssuePath.js.map +1 -0
  93. package/docs/README.md +164 -0
  94. package/docs/api.md +780 -0
  95. package/docs/concepts/instrumentation-and-export.md +98 -0
  96. package/docs/concepts/layer-map.md +73 -0
  97. package/docs/concepts/validated-acquisition.md +106 -0
  98. package/docs/guides/export-to-a-collector.md +190 -0
  99. package/docs/guides/forward-logs-to-the-journal.md +226 -0
  100. package/docs/guides/install-a-logger.md +111 -0
  101. package/docs/guides/read-runtime-metrics.md +83 -0
  102. package/docs/guides/testing.md +134 -0
  103. package/docs/guides/wire-an-opentelemetry-sdk.md +226 -0
  104. package/docs/installation.md +102 -0
  105. package/docs/quickstart.md +145 -0
  106. package/docs/troubleshooting.md +168 -0
  107. package/package.json +221 -32
  108. package/src/BrowserOtel.ts +51 -0
  109. package/src/Endpoint.ts +131 -0
  110. package/src/JournalLogger.ts +635 -0
  111. package/src/Logger.ts +107 -0
  112. package/src/Metric.ts +88 -0
  113. package/src/NodeOtel.ts +90 -0
  114. package/src/Otel.ts +118 -0
  115. package/src/Otlp.ts +514 -0
  116. package/src/Resource.ts +325 -0
  117. package/src/index.ts +67 -0
  118. package/src/internal/schemaIssuePath.ts +65 -0
  119. package/docker-compose.otel.yml +0 -104
  120. package/grafana/dashboards/smithers-dashboard.json +0 -453
  121. package/grafana/provisioning/dashboards/dashboards.yml +0 -12
  122. package/grafana/provisioning/datasources/datasources.yml +0 -49
  123. package/loki/loki-config.yaml +0 -35
  124. package/otel-collector-config.yml +0 -38
  125. package/prometheus/prometheus.yml +0 -8
  126. package/src/MetricName.ts +0 -1
  127. package/src/MetricsServiceLive.js +0 -9
  128. package/src/README.md +0 -28
  129. package/src/ResolvedSmithersObservabilityOptions.ts +0 -12
  130. package/src/SmithersEvent.ts +0 -843
  131. package/src/SmithersLogFormat.ts +0 -1
  132. package/src/SmithersMetricDefinition.ts +0 -15
  133. package/src/SmithersMetricType.ts +0 -1
  134. package/src/SmithersMetricUnit.ts +0 -1
  135. package/src/SmithersObservability.js +0 -15
  136. package/src/SmithersObservabilityOptions.ts +0 -12
  137. package/src/SmithersObservabilityService.ts +0 -13
  138. package/src/_coreCorrelation/CorrelationContext.ts +0 -10
  139. package/src/_coreCorrelation/CorrelationContextLive.js +0 -11
  140. package/src/_coreCorrelation/CorrelationContextService.js +0 -15
  141. package/src/_coreCorrelation/CorrelationContextServiceShape.ts +0 -12
  142. package/src/_coreCorrelation/CorrelationPatch.ts +0 -3
  143. package/src/_coreCorrelation/README.md +0 -20
  144. package/src/_coreCorrelation/_correlationStorage.js +0 -4
  145. package/src/_coreCorrelation/correlationContextFiberRef.js +0 -5
  146. package/src/_coreCorrelation/correlationContextToLogAnnotations.js +0 -18
  147. package/src/_coreCorrelation/getCurrentCorrelationContext.js +0 -9
  148. package/src/_coreCorrelation/getCurrentCorrelationContextEffect.js +0 -11
  149. package/src/_coreCorrelation/index.js +0 -14
  150. package/src/_coreCorrelation/mergeCorrelationContext.js +0 -51
  151. package/src/_coreCorrelation/runWithCorrelationContext.js +0 -14
  152. package/src/_coreCorrelation/updateCurrentCorrelationContext.js +0 -17
  153. package/src/_coreCorrelation/withCorrelationContext.js +0 -38
  154. package/src/_coreCorrelation/withCurrentCorrelationContext.js +0 -11
  155. package/src/_coreMetrics.js +0 -14
  156. package/src/_coreMetricsShape.ts +0 -44
  157. package/src/_corePrometheus.js +0 -91
  158. package/src/_corePrometheusShape.ts +0 -11
  159. package/src/_coreTracing.js +0 -132
  160. package/src/_coreTracingShape.ts +0 -17
  161. package/src/_otelLogBuilders.js +0 -102
  162. package/src/_sessionFileResolvers.js +0 -164
  163. package/src/_smithersSpanAttributeAliases.js +0 -19
  164. package/src/_smithersTraceSpanStorage.js +0 -3
  165. package/src/_traceEventNormalizers.js +0 -499
  166. package/src/_traceRedaction.js +0 -162
  167. package/src/agentSessionEventToOtelLogRecord.js +0 -55
  168. package/src/agentTrace.ts +0 -144
  169. package/src/agentTraceCapabilities.js +0 -151
  170. package/src/annotateSmithersTrace.js +0 -11
  171. package/src/canonicalTraceEventToOtelLogRecord.js +0 -55
  172. package/src/correlation.js +0 -56
  173. package/src/createSmithersObservabilityLayer.js +0 -59
  174. package/src/createSmithersOtelLayer.js +0 -23
  175. package/src/createSmithersRuntimeLayer.js +0 -2
  176. package/src/detectAgentFamily.js +0 -26
  177. package/src/detectCaptureMode.js +0 -29
  178. package/src/emitOtelLogRecord.js +0 -19
  179. package/src/getCurrentSmithersTraceAnnotations.js +0 -14
  180. package/src/getCurrentSmithersTraceSpan.js +0 -7
  181. package/src/index.d.ts +0 -1392
  182. package/src/index.js +0 -137
  183. package/src/kindPhase.js +0 -17
  184. package/src/logging.js +0 -264
  185. package/src/makeSmithersSpanAttributes.js +0 -20
  186. package/src/metrics/README.md +0 -22
  187. package/src/metrics/SmithersMetricDefinition.ts +0 -17
  188. package/src/metrics/SmithersMetricType.ts +0 -1
  189. package/src/metrics/SmithersMetricUnit.ts +0 -1
  190. package/src/metrics/_asyncExternalWaitCounts.js +0 -4
  191. package/src/metrics/_buckets.js +0 -37
  192. package/src/metrics/_incrementGauge.js +0 -11
  193. package/src/metrics/_processStartMs.js +0 -1
  194. package/src/metrics/activeNodes.js +0 -2
  195. package/src/metrics/activeRuns.js +0 -2
  196. package/src/metrics/agentActionsTotal.js +0 -2
  197. package/src/metrics/agentDurationMs.js +0 -3
  198. package/src/metrics/agentErrorsTotal.js +0 -2
  199. package/src/metrics/agentEventsTotal.js +0 -2
  200. package/src/metrics/agentInvocationsTotal.js +0 -2
  201. package/src/metrics/agentRetriesTotal.js +0 -2
  202. package/src/metrics/agentSessionsTotal.js +0 -2
  203. package/src/metrics/agentTokensTotal.js +0 -2
  204. package/src/metrics/alertDeliveriesAttempted.js +0 -2
  205. package/src/metrics/alertDeliveriesSuppressed.js +0 -2
  206. package/src/metrics/alertsAcknowledgedTotal.js +0 -2
  207. package/src/metrics/alertsActive.js +0 -2
  208. package/src/metrics/alertsEscalatedTotal.js +0 -2
  209. package/src/metrics/alertsFiredTotal.js +0 -2
  210. package/src/metrics/alertsReopenedTotal.js +0 -2
  211. package/src/metrics/alertsResolvedTotal.js +0 -2
  212. package/src/metrics/alertsSilencedTotal.js +0 -2
  213. package/src/metrics/approvalPending.js +0 -2
  214. package/src/metrics/approvalWaitDuration.js +0 -5
  215. package/src/metrics/approvalsDenied.js +0 -2
  216. package/src/metrics/approvalsGranted.js +0 -2
  217. package/src/metrics/approvalsRequested.js +0 -2
  218. package/src/metrics/attemptDuration.js +0 -3
  219. package/src/metrics/attentionBacklog.js +0 -2
  220. package/src/metrics/cacheHits.js +0 -2
  221. package/src/metrics/cacheMisses.js +0 -2
  222. package/src/metrics/dbQueryDuration.js +0 -3
  223. package/src/metrics/dbRetries.js +0 -2
  224. package/src/metrics/dbTransactionDuration.js +0 -3
  225. package/src/metrics/dbTransactionRetries.js +0 -2
  226. package/src/metrics/dbTransactionRollbacks.js +0 -2
  227. package/src/metrics/devtoolsActiveSubscribers.js +0 -2
  228. package/src/metrics/devtoolsBackpressureDisconnectTotal.js +0 -2
  229. package/src/metrics/devtoolsDeltaBuildMs.js +0 -3
  230. package/src/metrics/devtoolsEventBytes.js +0 -3
  231. package/src/metrics/devtoolsEventTotal.js +0 -2
  232. package/src/metrics/devtoolsSnapshotBuildMs.js +0 -5
  233. package/src/metrics/devtoolsSubscribeTotal.js +0 -2
  234. package/src/metrics/errorsTotal.js +0 -2
  235. package/src/metrics/eventsEmittedTotal.js +0 -2
  236. package/src/metrics/externalWaitAsyncPending.js +0 -2
  237. package/src/metrics/gatewayApprovalDecisionsTotal.js +0 -2
  238. package/src/metrics/gatewayAuthEventsTotal.js +0 -2
  239. package/src/metrics/gatewayConnectionsActive.js +0 -2
  240. package/src/metrics/gatewayConnectionsClosedTotal.js +0 -2
  241. package/src/metrics/gatewayConnectionsTotal.js +0 -2
  242. package/src/metrics/gatewayCronTriggersTotal.js +0 -2
  243. package/src/metrics/gatewayErrorsTotal.js +0 -2
  244. package/src/metrics/gatewayHeartbeatTicksTotal.js +0 -2
  245. package/src/metrics/gatewayMessagesReceivedTotal.js +0 -2
  246. package/src/metrics/gatewayMessagesSentTotal.js +0 -2
  247. package/src/metrics/gatewayRpcCallsTotal.js +0 -2
  248. package/src/metrics/gatewayRpcDuration.js +0 -3
  249. package/src/metrics/gatewayRunEventBackpressureDisconnectTotal.js +0 -4
  250. package/src/metrics/gatewayRunsCompletedTotal.js +0 -2
  251. package/src/metrics/gatewayRunsStartedTotal.js +0 -2
  252. package/src/metrics/gatewaySignalsTotal.js +0 -2
  253. package/src/metrics/gatewayWebhooksReceivedTotal.js +0 -2
  254. package/src/metrics/gatewayWebhooksRejectedTotal.js +0 -2
  255. package/src/metrics/gatewayWebhooksVerifiedTotal.js +0 -2
  256. package/src/metrics/heartbeatDataSizeBytes.js +0 -5
  257. package/src/metrics/heartbeatIntervalMs.js +0 -3
  258. package/src/metrics/hotReloadDuration.js +0 -3
  259. package/src/metrics/hotReloadFailures.js +0 -2
  260. package/src/metrics/hotReloads.js +0 -2
  261. package/src/metrics/httpRequestDuration.js +0 -3
  262. package/src/metrics/httpRequests.js +0 -2
  263. package/src/metrics/index.d.ts +0 -1222
  264. package/src/metrics/index.js +0 -168
  265. package/src/metrics/memoryFactReads.js +0 -3
  266. package/src/metrics/memoryFactWrites.js +0 -3
  267. package/src/metrics/memoryMessageSaves.js +0 -3
  268. package/src/metrics/memoryRecallDuration.js +0 -11
  269. package/src/metrics/memoryRecallQueries.js +0 -3
  270. package/src/metrics/metricsServiceAdapter.js +0 -181
  271. package/src/metrics/nodeDuration.js +0 -3
  272. package/src/metrics/nodeRetriesTotal.js +0 -2
  273. package/src/metrics/nodesFailed.js +0 -2
  274. package/src/metrics/nodesFinished.js +0 -2
  275. package/src/metrics/nodesStarted.js +0 -2
  276. package/src/metrics/openApiToolCallErrorsTotal.js +0 -3
  277. package/src/metrics/openApiToolCallsTotal.js +0 -3
  278. package/src/metrics/openApiToolDuration.js +0 -9
  279. package/src/metrics/processHeapUsedBytes.js +0 -2
  280. package/src/metrics/processMemoryRssBytes.js +0 -2
  281. package/src/metrics/processUptimeSeconds.js +0 -2
  282. package/src/metrics/promptSizeBytes.js +0 -3
  283. package/src/metrics/replaysStarted.js +0 -3
  284. package/src/metrics/responseSizeBytes.js +0 -3
  285. package/src/metrics/rewindDurationMs.js +0 -3
  286. package/src/metrics/rewindFramesDeleted.js +0 -3
  287. package/src/metrics/rewindRollbackTotal.js +0 -2
  288. package/src/metrics/rewindSandboxesReverted.js +0 -3
  289. package/src/metrics/rewindTotal.js +0 -2
  290. package/src/metrics/runDuration.js +0 -3
  291. package/src/metrics/runForksCreated.js +0 -3
  292. package/src/metrics/runsAncestryDepth.js +0 -3
  293. package/src/metrics/runsCancelledTotal.js +0 -2
  294. package/src/metrics/runsCarriedStateBytes.js +0 -5
  295. package/src/metrics/runsContinuedTotal.js +0 -2
  296. package/src/metrics/runsFailedTotal.js +0 -2
  297. package/src/metrics/runsFinishedTotal.js +0 -2
  298. package/src/metrics/runsResumedTotal.js +0 -2
  299. package/src/metrics/runsTotal.js +0 -2
  300. package/src/metrics/sandboxActive.js +0 -2
  301. package/src/metrics/sandboxBundleSizeBytes.js +0 -5
  302. package/src/metrics/sandboxCompletedTotal.js +0 -2
  303. package/src/metrics/sandboxCreatedTotal.js +0 -2
  304. package/src/metrics/sandboxDurationMs.js +0 -3
  305. package/src/metrics/sandboxPatchCount.js +0 -3
  306. package/src/metrics/sandboxTransportDurationMs.js +0 -5
  307. package/src/metrics/schedulerConcurrencyUtilization.js +0 -2
  308. package/src/metrics/schedulerQueueDepth.js +0 -2
  309. package/src/metrics/schedulerWaitDuration.js +0 -5
  310. package/src/metrics/scorerDuration.js +0 -9
  311. package/src/metrics/scorerEventsFailed.js +0 -2
  312. package/src/metrics/scorerEventsFinished.js +0 -2
  313. package/src/metrics/scorerEventsStarted.js +0 -2
  314. package/src/metrics/scorersFailed.js +0 -3
  315. package/src/metrics/scorersFinished.js +0 -3
  316. package/src/metrics/scorersStarted.js +0 -3
  317. package/src/metrics/smithersMetricCatalog.js +0 -893
  318. package/src/metrics/smithersMetricCatalogByKey.js +0 -2
  319. package/src/metrics/smithersMetricCatalogByName.js +0 -2
  320. package/src/metrics/smithersMetricCatalogByPrometheusName.js +0 -4
  321. package/src/metrics/snapshotDuration.js +0 -9
  322. package/src/metrics/snapshotsCaptured.js +0 -3
  323. package/src/metrics/supervisorPollDuration.js +0 -5
  324. package/src/metrics/supervisorPollsTotal.js +0 -2
  325. package/src/metrics/supervisorResumeLag.js +0 -5
  326. package/src/metrics/supervisorResumedTotal.js +0 -2
  327. package/src/metrics/supervisorSkippedTotal.js +0 -2
  328. package/src/metrics/supervisorStaleDetected.js +0 -2
  329. package/src/metrics/taskHeartbeatTimeoutTotal.js +0 -2
  330. package/src/metrics/taskHeartbeatsTotal.js +0 -2
  331. package/src/metrics/timerDelayDuration.js +0 -3
  332. package/src/metrics/timersCancelled.js +0 -2
  333. package/src/metrics/timersCreated.js +0 -2
  334. package/src/metrics/timersFired.js +0 -2
  335. package/src/metrics/timersPending.js +0 -2
  336. package/src/metrics/toPrometheusMetricName.js +0 -8
  337. package/src/metrics/tokensCacheReadTotal.js +0 -2
  338. package/src/metrics/tokensCacheWriteTotal.js +0 -2
  339. package/src/metrics/tokensContextWindowBucketTotal.js +0 -2
  340. package/src/metrics/tokensContextWindowPerCall.js +0 -5
  341. package/src/metrics/tokensInputPerCall.js +0 -3
  342. package/src/metrics/tokensInputTotal.js +0 -2
  343. package/src/metrics/tokensOutputPerCall.js +0 -3
  344. package/src/metrics/tokensOutputTotal.js +0 -2
  345. package/src/metrics/tokensReasoningTotal.js +0 -2
  346. package/src/metrics/toolCallErrorsTotal.js +0 -2
  347. package/src/metrics/toolCallsTotal.js +0 -2
  348. package/src/metrics/toolDuration.js +0 -3
  349. package/src/metrics/toolOutputTruncatedTotal.js +0 -2
  350. package/src/metrics/trackEvent.js +0 -608
  351. package/src/metrics/updateAsyncExternalWaitPending.js +0 -18
  352. package/src/metrics/updateProcessMetrics.js +0 -20
  353. package/src/metrics/vcsDuration.js +0 -3
  354. package/src/normalizeStructuredEvent.js +0 -15
  355. package/src/prometheusContentType.js +0 -1
  356. package/src/renderPrometheusMetrics.js +0 -212
  357. package/src/resolveAgentTraceCapabilities.js +0 -59
  358. package/src/resolveSmithersObservabilityOptions.js +0 -109
  359. package/src/smithersMetrics.js +0 -2
  360. package/src/smithersSpanNames.js +0 -6
  361. package/src/unsupportedKindsForCapabilities.js +0 -32
  362. package/src/withSmithersSpan.js +0 -17
  363. package/tempo/tempo.yml +0 -17
@@ -1,893 +0,0 @@
1
- import { toPrometheusMetricName } from "./toPrometheusMetricName.js";
2
- import {
3
- durationBuckets,
4
- fastBuckets,
5
- toolBuckets,
6
- tokenBuckets,
7
- contextWindowBuckets,
8
- sizeBuckets,
9
- carriedStateSizeBuckets,
10
- ancestryDepthBuckets,
11
- } from "./_buckets.js";
12
- // Local metric instances
13
- import { runsTotal } from "./runsTotal.js";
14
- import { nodesStarted } from "./nodesStarted.js";
15
- import { nodesFinished } from "./nodesFinished.js";
16
- import { nodesFailed } from "./nodesFailed.js";
17
- import { toolCallsTotal } from "./toolCallsTotal.js";
18
- import { cacheHits } from "./cacheHits.js";
19
- import { cacheMisses } from "./cacheMisses.js";
20
- import { dbRetries } from "./dbRetries.js";
21
- import { dbTransactionRollbacks } from "./dbTransactionRollbacks.js";
22
- import { dbTransactionRetries } from "./dbTransactionRetries.js";
23
- import { hotReloads } from "./hotReloads.js";
24
- import { hotReloadFailures } from "./hotReloadFailures.js";
25
- import { httpRequests } from "./httpRequests.js";
26
- import { approvalsRequested } from "./approvalsRequested.js";
27
- import { approvalsGranted } from "./approvalsGranted.js";
28
- import { approvalsDenied } from "./approvalsDenied.js";
29
- import { timersCreated } from "./timersCreated.js";
30
- import { timersFired } from "./timersFired.js";
31
- import { timersCancelled } from "./timersCancelled.js";
32
- import { sandboxCreatedTotal } from "./sandboxCreatedTotal.js";
33
- import { sandboxCompletedTotal } from "./sandboxCompletedTotal.js";
34
- import { alertsFiredTotal } from "./alertsFiredTotal.js";
35
- import { alertsAcknowledgedTotal } from "./alertsAcknowledgedTotal.js";
36
- import { scorerEventsStarted } from "./scorerEventsStarted.js";
37
- import { scorerEventsFinished } from "./scorerEventsFinished.js";
38
- import { scorerEventsFailed } from "./scorerEventsFailed.js";
39
- import { tokensInputTotal } from "./tokensInputTotal.js";
40
- import { tokensOutputTotal } from "./tokensOutputTotal.js";
41
- import { tokensCacheReadTotal } from "./tokensCacheReadTotal.js";
42
- import { tokensCacheWriteTotal } from "./tokensCacheWriteTotal.js";
43
- import { tokensReasoningTotal } from "./tokensReasoningTotal.js";
44
- import { tokensContextWindowBucketTotal } from "./tokensContextWindowBucketTotal.js";
45
- import { runsFinishedTotal } from "./runsFinishedTotal.js";
46
- import { runsFailedTotal } from "./runsFailedTotal.js";
47
- import { runsCancelledTotal } from "./runsCancelledTotal.js";
48
- import { runsResumedTotal } from "./runsResumedTotal.js";
49
- import { runsContinuedTotal } from "./runsContinuedTotal.js";
50
- import { supervisorPollsTotal } from "./supervisorPollsTotal.js";
51
- import { supervisorStaleDetected } from "./supervisorStaleDetected.js";
52
- import { supervisorResumedTotal } from "./supervisorResumedTotal.js";
53
- import { supervisorSkippedTotal } from "./supervisorSkippedTotal.js";
54
- import { errorsTotal } from "./errorsTotal.js";
55
- import { nodeRetriesTotal } from "./nodeRetriesTotal.js";
56
- import { toolCallErrorsTotal } from "./toolCallErrorsTotal.js";
57
- import { toolOutputTruncatedTotal } from "./toolOutputTruncatedTotal.js";
58
- import { agentInvocationsTotal } from "./agentInvocationsTotal.js";
59
- import { agentTokensTotal } from "./agentTokensTotal.js";
60
- import { agentErrorsTotal } from "./agentErrorsTotal.js";
61
- import { agentRetriesTotal } from "./agentRetriesTotal.js";
62
- import { agentEventsTotal } from "./agentEventsTotal.js";
63
- import { agentSessionsTotal } from "./agentSessionsTotal.js";
64
- import { agentActionsTotal } from "./agentActionsTotal.js";
65
- import { gatewayConnectionsTotal } from "./gatewayConnectionsTotal.js";
66
- import { gatewayConnectionsClosedTotal } from "./gatewayConnectionsClosedTotal.js";
67
- import { gatewayMessagesReceivedTotal } from "./gatewayMessagesReceivedTotal.js";
68
- import { gatewayMessagesSentTotal } from "./gatewayMessagesSentTotal.js";
69
- import { gatewayRpcCallsTotal } from "./gatewayRpcCallsTotal.js";
70
- import { gatewayErrorsTotal } from "./gatewayErrorsTotal.js";
71
- import { gatewayRunsStartedTotal } from "./gatewayRunsStartedTotal.js";
72
- import { gatewayRunsCompletedTotal } from "./gatewayRunsCompletedTotal.js";
73
- import { gatewayApprovalDecisionsTotal } from "./gatewayApprovalDecisionsTotal.js";
74
- import { gatewaySignalsTotal } from "./gatewaySignalsTotal.js";
75
- import { gatewayAuthEventsTotal } from "./gatewayAuthEventsTotal.js";
76
- import { gatewayHeartbeatTicksTotal } from "./gatewayHeartbeatTicksTotal.js";
77
- import { gatewayCronTriggersTotal } from "./gatewayCronTriggersTotal.js";
78
- import { gatewayWebhooksReceivedTotal } from "./gatewayWebhooksReceivedTotal.js";
79
- import { gatewayWebhooksVerifiedTotal } from "./gatewayWebhooksVerifiedTotal.js";
80
- import { gatewayWebhooksRejectedTotal } from "./gatewayWebhooksRejectedTotal.js";
81
- import { eventsEmittedTotal } from "./eventsEmittedTotal.js";
82
- import { taskHeartbeatsTotal } from "./taskHeartbeatsTotal.js";
83
- import { taskHeartbeatTimeoutTotal } from "./taskHeartbeatTimeoutTotal.js";
84
- import { memoryFactReads } from "./memoryFactReads.js";
85
- import { memoryFactWrites } from "./memoryFactWrites.js";
86
- import { memoryRecallDuration } from "./memoryRecallDuration.js";
87
- import { memoryRecallQueries } from "./memoryRecallQueries.js";
88
- import { memoryMessageSaves } from "./memoryMessageSaves.js";
89
- import { openApiToolCallsTotal } from "./openApiToolCallsTotal.js";
90
- import { openApiToolCallErrorsTotal } from "./openApiToolCallErrorsTotal.js";
91
- import { openApiToolDuration } from "./openApiToolDuration.js";
92
- import { scorerDuration } from "./scorerDuration.js";
93
- import { scorersFailed } from "./scorersFailed.js";
94
- import { scorersFinished } from "./scorersFinished.js";
95
- import { scorersStarted } from "./scorersStarted.js";
96
- import { replaysStarted } from "./replaysStarted.js";
97
- import { runForksCreated } from "./runForksCreated.js";
98
- import { snapshotDuration } from "./snapshotDuration.js";
99
- import { snapshotsCaptured } from "./snapshotsCaptured.js";
100
- import { activeRuns } from "./activeRuns.js";
101
- import { activeNodes } from "./activeNodes.js";
102
- import { schedulerQueueDepth } from "./schedulerQueueDepth.js";
103
- import { sandboxActive } from "./sandboxActive.js";
104
- import { alertsActive } from "./alertsActive.js";
105
- import { gatewayConnectionsActive } from "./gatewayConnectionsActive.js";
106
- import { approvalPending } from "./approvalPending.js";
107
- import { externalWaitAsyncPending } from "./externalWaitAsyncPending.js";
108
- import { timersPending } from "./timersPending.js";
109
- import { schedulerConcurrencyUtilization } from "./schedulerConcurrencyUtilization.js";
110
- import { processUptimeSeconds } from "./processUptimeSeconds.js";
111
- import { processMemoryRssBytes } from "./processMemoryRssBytes.js";
112
- import { processHeapUsedBytes } from "./processHeapUsedBytes.js";
113
- import { nodeDuration } from "./nodeDuration.js";
114
- import { attemptDuration } from "./attemptDuration.js";
115
- import { toolDuration } from "./toolDuration.js";
116
- import { dbQueryDuration } from "./dbQueryDuration.js";
117
- import { dbTransactionDuration } from "./dbTransactionDuration.js";
118
- import { httpRequestDuration } from "./httpRequestDuration.js";
119
- import { hotReloadDuration } from "./hotReloadDuration.js";
120
- import { vcsDuration } from "./vcsDuration.js";
121
- import { agentDurationMs } from "./agentDurationMs.js";
122
- import { tokensInputPerCall } from "./tokensInputPerCall.js";
123
- import { tokensOutputPerCall } from "./tokensOutputPerCall.js";
124
- import { tokensContextWindowPerCall } from "./tokensContextWindowPerCall.js";
125
- import { runDuration } from "./runDuration.js";
126
- import { promptSizeBytes } from "./promptSizeBytes.js";
127
- import { responseSizeBytes } from "./responseSizeBytes.js";
128
- import { approvalWaitDuration } from "./approvalWaitDuration.js";
129
- import { timerDelayDuration } from "./timerDelayDuration.js";
130
- import { gatewayRpcDuration } from "./gatewayRpcDuration.js";
131
- import { schedulerWaitDuration } from "./schedulerWaitDuration.js";
132
- import { supervisorPollDuration } from "./supervisorPollDuration.js";
133
- import { supervisorResumeLag } from "./supervisorResumeLag.js";
134
- import { runsAncestryDepth } from "./runsAncestryDepth.js";
135
- import { runsCarriedStateBytes } from "./runsCarriedStateBytes.js";
136
- import { sandboxDurationMs } from "./sandboxDurationMs.js";
137
- import { sandboxBundleSizeBytes } from "./sandboxBundleSizeBytes.js";
138
- import { sandboxTransportDurationMs } from "./sandboxTransportDurationMs.js";
139
- import { sandboxPatchCount } from "./sandboxPatchCount.js";
140
- import { heartbeatDataSizeBytes } from "./heartbeatDataSizeBytes.js";
141
- import { heartbeatIntervalMs } from "./heartbeatIntervalMs.js";
142
- /** @typedef {import("./SmithersMetricType.ts").SmithersMetricType} SmithersMetricType */
143
-
144
- /** @typedef {import("./SmithersMetricDefinition.ts").SmithersMetricDefinition} SmithersMetricDefinition */
145
-
146
- /**
147
- * @param {any} boundaries
148
- * @returns {readonly number[]}
149
- */
150
- function metricBoundaryValues(boundaries) {
151
- return Array.from(boundaries?.values ?? []).sort((left, right) => left - right);
152
- }
153
- /**
154
- * @param {Metric.Metric<any, any, any>} metric
155
- * @returns {readonly number[]}
156
- */
157
- function metricHistogramBoundaries(metric) {
158
- return Array.from(metric?.keyType?.boundaries?.values ?? [])
159
- .filter((value) => Number.isFinite(value))
160
- .sort((left, right) => left - right);
161
- }
162
- /**
163
- * @param {string} key
164
- * @param {Metric.Metric<any, any, any>} metric
165
- * @param {string} name
166
- * @param {SmithersMetricType} type
167
- * @param {Omit< SmithersMetricDefinition, "key" | "metric" | "name" | "prometheusName" | "type" >} options
168
- * @returns {SmithersMetricDefinition}
169
- */
170
- function metricDefinition(key, metric, name, type, options) {
171
- return {
172
- key,
173
- metric,
174
- name,
175
- prometheusName: toPrometheusMetricName(name),
176
- type,
177
- ...options,
178
- };
179
- }
180
- const durationBucketValues = metricBoundaryValues(durationBuckets);
181
- const fastBucketValues = metricBoundaryValues(fastBuckets);
182
- const toolBucketValues = metricBoundaryValues(toolBuckets);
183
- const tokenBucketValues = metricBoundaryValues(tokenBuckets);
184
- const contextWindowBucketValues = metricBoundaryValues(contextWindowBuckets);
185
- const sizeBucketValues = metricBoundaryValues(sizeBuckets);
186
- const carriedStateSizeBucketValues = metricBoundaryValues(carriedStateSizeBuckets);
187
- const ancestryDepthBucketValues = metricBoundaryValues(ancestryDepthBuckets);
188
- export const smithersMetricCatalog = [
189
- metricDefinition("runsTotal", runsTotal, "smithers.runs.total", "counter", { label: "Runs started", unit: "count" }),
190
- metricDefinition("nodesStarted", nodesStarted, "smithers.nodes.started", "counter", {
191
- label: "Nodes started",
192
- unit: "count",
193
- }),
194
- metricDefinition("nodesFinished", nodesFinished, "smithers.nodes.finished", "counter", {
195
- label: "Nodes finished",
196
- unit: "count",
197
- }),
198
- metricDefinition("nodesFailed", nodesFailed, "smithers.nodes.failed", "counter", {
199
- label: "Nodes failed",
200
- unit: "count",
201
- }),
202
- metricDefinition("toolCallsTotal", toolCallsTotal, "smithers.tool_calls.total", "counter", {
203
- label: "Tool calls",
204
- unit: "count",
205
- }),
206
- metricDefinition("cacheHits", cacheHits, "smithers.cache.hits", "counter", { label: "Cache hits", unit: "count" }),
207
- metricDefinition("cacheMisses", cacheMisses, "smithers.cache.misses", "counter", {
208
- label: "Cache misses",
209
- unit: "count",
210
- }),
211
- metricDefinition("dbRetries", dbRetries, "smithers.db.retries", "counter", { label: "DB retries", unit: "count" }),
212
- metricDefinition("dbTransactionRollbacks", dbTransactionRollbacks, "smithers.db.transaction_rollbacks", "counter", {
213
- label: "DB transaction rollbacks",
214
- unit: "count",
215
- }),
216
- metricDefinition("dbTransactionRetries", dbTransactionRetries, "smithers.db.transaction_retries", "counter", {
217
- label: "DB transaction retries",
218
- unit: "count",
219
- }),
220
- metricDefinition("hotReloads", hotReloads, "smithers.hot.reloads", "counter", {
221
- label: "Hot reloads",
222
- unit: "count",
223
- }),
224
- metricDefinition("hotReloadFailures", hotReloadFailures, "smithers.hot.reload_failures", "counter", {
225
- label: "Hot reload failures",
226
- unit: "count",
227
- }),
228
- metricDefinition("httpRequests", httpRequests, "smithers.http.requests", "counter", {
229
- label: "HTTP requests",
230
- unit: "count",
231
- labels: ["method", "route", "status_code", "status_class"],
232
- }),
233
- metricDefinition("approvalsRequested", approvalsRequested, "smithers.approvals.requested", "counter", {
234
- label: "Approvals requested",
235
- unit: "count",
236
- }),
237
- metricDefinition("approvalsGranted", approvalsGranted, "smithers.approvals.granted", "counter", {
238
- label: "Approvals granted",
239
- unit: "count",
240
- }),
241
- metricDefinition("approvalsDenied", approvalsDenied, "smithers.approvals.denied", "counter", {
242
- label: "Approvals denied",
243
- unit: "count",
244
- }),
245
- metricDefinition("timersCreated", timersCreated, "smithers.timers.created", "counter", {
246
- label: "Timers created",
247
- unit: "count",
248
- }),
249
- metricDefinition("timersFired", timersFired, "smithers.timers.fired", "counter", {
250
- label: "Timers fired",
251
- unit: "count",
252
- }),
253
- metricDefinition("timersCancelled", timersCancelled, "smithers.timers.cancelled", "counter", {
254
- label: "Timers cancelled",
255
- unit: "count",
256
- }),
257
- metricDefinition("sandboxCreatedTotal", sandboxCreatedTotal, "smithers.sandbox.created_total", "counter", {
258
- label: "Sandboxes created",
259
- unit: "count",
260
- labels: ["runtime"],
261
- }),
262
- metricDefinition("sandboxCompletedTotal", sandboxCompletedTotal, "smithers.sandbox.completed_total", "counter", {
263
- label: "Sandboxes completed",
264
- unit: "count",
265
- labels: ["runtime", "status"],
266
- }),
267
- metricDefinition("alertsFiredTotal", alertsFiredTotal, "smithers.alerts.fired_total", "counter", {
268
- label: "Alerts fired",
269
- unit: "count",
270
- labels: ["policy"],
271
- }),
272
- metricDefinition(
273
- "alertsAcknowledgedTotal",
274
- alertsAcknowledgedTotal,
275
- "smithers.alerts.acknowledged_total",
276
- "counter",
277
- {
278
- label: "Alerts acknowledged",
279
- unit: "count",
280
- labels: ["policy"],
281
- },
282
- ),
283
- metricDefinition("scorerEventsStarted", scorerEventsStarted, "smithers.scorer_events.started", "counter", {
284
- label: "Scorer events started",
285
- unit: "count",
286
- }),
287
- metricDefinition("scorerEventsFinished", scorerEventsFinished, "smithers.scorer_events.finished", "counter", {
288
- label: "Scorer events finished",
289
- unit: "count",
290
- }),
291
- metricDefinition("scorerEventsFailed", scorerEventsFailed, "smithers.scorer_events.failed", "counter", {
292
- label: "Scorer events failed",
293
- unit: "count",
294
- }),
295
- metricDefinition("tokensInputTotal", tokensInputTotal, "smithers.tokens.input_total", "counter", {
296
- label: "Input tokens",
297
- unit: "tokens",
298
- labels: ["agent", "model"],
299
- }),
300
- metricDefinition("tokensOutputTotal", tokensOutputTotal, "smithers.tokens.output_total", "counter", {
301
- label: "Output tokens",
302
- unit: "tokens",
303
- labels: ["agent", "model"],
304
- }),
305
- metricDefinition("tokensCacheReadTotal", tokensCacheReadTotal, "smithers.tokens.cache_read_total", "counter", {
306
- label: "Cache read tokens",
307
- unit: "tokens",
308
- labels: ["agent", "model"],
309
- }),
310
- metricDefinition("tokensCacheWriteTotal", tokensCacheWriteTotal, "smithers.tokens.cache_write_total", "counter", {
311
- label: "Cache write tokens",
312
- unit: "tokens",
313
- labels: ["agent", "model"],
314
- }),
315
- metricDefinition("tokensReasoningTotal", tokensReasoningTotal, "smithers.tokens.reasoning_total", "counter", {
316
- label: "Reasoning tokens",
317
- unit: "tokens",
318
- labels: ["agent", "model"],
319
- }),
320
- metricDefinition(
321
- "tokensContextWindowBucketTotal",
322
- tokensContextWindowBucketTotal,
323
- "smithers.tokens.context_window_bucket_total",
324
- "counter",
325
- {
326
- label: "Context window bucket hits",
327
- unit: "count",
328
- labels: ["agent", "bucket", "model"],
329
- },
330
- ),
331
- metricDefinition("runsFinishedTotal", runsFinishedTotal, "smithers.runs.finished_total", "counter", {
332
- label: "Runs finished",
333
- unit: "count",
334
- }),
335
- metricDefinition("runsFailedTotal", runsFailedTotal, "smithers.runs.failed_total", "counter", {
336
- label: "Runs failed",
337
- unit: "count",
338
- }),
339
- metricDefinition("runsCancelledTotal", runsCancelledTotal, "smithers.runs.cancelled_total", "counter", {
340
- label: "Runs cancelled",
341
- unit: "count",
342
- }),
343
- metricDefinition("runsResumedTotal", runsResumedTotal, "smithers.runs.resumed_total", "counter", {
344
- label: "Runs resumed",
345
- unit: "count",
346
- }),
347
- metricDefinition("runsContinuedTotal", runsContinuedTotal, "smithers.runs.continued_total", "counter", {
348
- label: "Runs continued",
349
- unit: "count",
350
- }),
351
- metricDefinition("supervisorPollsTotal", supervisorPollsTotal, "smithers.supervisor.polls_total", "counter", {
352
- label: "Supervisor polls",
353
- unit: "count",
354
- }),
355
- metricDefinition(
356
- "supervisorStaleDetected",
357
- supervisorStaleDetected,
358
- "smithers.supervisor.stale_detected",
359
- "counter",
360
- { label: "Supervisor stale runs detected", unit: "count" },
361
- ),
362
- metricDefinition("supervisorResumedTotal", supervisorResumedTotal, "smithers.supervisor.resumed_total", "counter", {
363
- label: "Supervisor auto-resumes",
364
- unit: "count",
365
- }),
366
- metricDefinition("supervisorSkippedTotal", supervisorSkippedTotal, "smithers.supervisor.skipped_total", "counter", {
367
- label: "Supervisor skipped auto-resumes",
368
- unit: "count",
369
- labels: ["reason"],
370
- }),
371
- metricDefinition("errorsTotal", errorsTotal, "smithers.errors.total", "counter", { label: "Errors", unit: "count" }),
372
- metricDefinition("nodeRetriesTotal", nodeRetriesTotal, "smithers.node.retries_total", "counter", {
373
- label: "Node retries",
374
- unit: "count",
375
- }),
376
- metricDefinition("toolCallErrorsTotal", toolCallErrorsTotal, "smithers.tool_calls.errors_total", "counter", {
377
- label: "Tool call errors",
378
- unit: "count",
379
- }),
380
- metricDefinition(
381
- "toolOutputTruncatedTotal",
382
- toolOutputTruncatedTotal,
383
- "smithers.tool.output_truncated_total",
384
- "counter",
385
- { label: "Tool outputs truncated", unit: "count" },
386
- ),
387
- metricDefinition("agentInvocationsTotal", agentInvocationsTotal, "smithers.agent_invocations_total", "counter", {
388
- label: "Agent invocations",
389
- unit: "count",
390
- labels: ["engine", "model"],
391
- }),
392
- metricDefinition("agentTokensTotal", agentTokensTotal, "smithers.agent_tokens_total", "counter", {
393
- label: "Agent tokens",
394
- unit: "tokens",
395
- labels: ["engine", "model", "kind", "source"],
396
- }),
397
- metricDefinition("agentErrorsTotal", agentErrorsTotal, "smithers.agent_errors_total", "counter", {
398
- label: "Agent errors",
399
- unit: "count",
400
- labels: ["engine", "model", "reason", "source"],
401
- }),
402
- metricDefinition("agentRetriesTotal", agentRetriesTotal, "smithers.agent_retries_total", "counter", {
403
- label: "Agent retries",
404
- unit: "count",
405
- labels: ["engine", "model", "reason", "source"],
406
- }),
407
- metricDefinition("agentEventsTotal", agentEventsTotal, "smithers.agent_events_total", "counter", {
408
- label: "Agent events",
409
- unit: "count",
410
- labels: ["engine", "event_type", "source"],
411
- }),
412
- metricDefinition("agentSessionsTotal", agentSessionsTotal, "smithers.agent_sessions_total", "counter", {
413
- label: "Agent sessions",
414
- unit: "count",
415
- labels: ["engine", "model", "resume", "source", "status"],
416
- }),
417
- metricDefinition("agentActionsTotal", agentActionsTotal, "smithers.agent_actions_total", "counter", {
418
- label: "Agent actions",
419
- unit: "count",
420
- labels: ["action_kind", "engine", "entry_type", "level", "ok", "phase", "source"],
421
- }),
422
- metricDefinition(
423
- "gatewayConnectionsTotal",
424
- gatewayConnectionsTotal,
425
- "smithers.gateway.connections_total",
426
- "counter",
427
- {
428
- label: "Gateway connections opened",
429
- unit: "count",
430
- labels: ["transport"],
431
- },
432
- ),
433
- metricDefinition(
434
- "gatewayConnectionsClosedTotal",
435
- gatewayConnectionsClosedTotal,
436
- "smithers.gateway.connections_closed_total",
437
- "counter",
438
- {
439
- label: "Gateway connections closed",
440
- unit: "count",
441
- labels: ["code", "reason", "transport"],
442
- },
443
- ),
444
- metricDefinition(
445
- "gatewayMessagesReceivedTotal",
446
- gatewayMessagesReceivedTotal,
447
- "smithers.gateway.messages_received_total",
448
- "counter",
449
- {
450
- label: "Gateway messages received",
451
- unit: "count",
452
- labels: ["kind", "transport"],
453
- },
454
- ),
455
- metricDefinition(
456
- "gatewayMessagesSentTotal",
457
- gatewayMessagesSentTotal,
458
- "smithers.gateway.messages_sent_total",
459
- "counter",
460
- {
461
- label: "Gateway messages sent",
462
- unit: "count",
463
- labels: ["kind", "transport"],
464
- },
465
- ),
466
- metricDefinition("gatewayRpcCallsTotal", gatewayRpcCallsTotal, "smithers.gateway.rpc_calls_total", "counter", {
467
- label: "Gateway RPC calls",
468
- unit: "count",
469
- labels: ["method", "transport"],
470
- }),
471
- metricDefinition("gatewayErrorsTotal", gatewayErrorsTotal, "smithers.gateway.errors_total", "counter", {
472
- label: "Gateway errors",
473
- unit: "count",
474
- labels: ["code", "stage", "transport"],
475
- }),
476
- metricDefinition(
477
- "gatewayRunsStartedTotal",
478
- gatewayRunsStartedTotal,
479
- "smithers.gateway.runs_started_total",
480
- "counter",
481
- {
482
- label: "Gateway runs started",
483
- unit: "count",
484
- labels: ["transport"],
485
- },
486
- ),
487
- metricDefinition(
488
- "gatewayRunsCompletedTotal",
489
- gatewayRunsCompletedTotal,
490
- "smithers.gateway.runs_completed_total",
491
- "counter",
492
- {
493
- label: "Gateway runs completed",
494
- unit: "count",
495
- labels: ["status", "transport"],
496
- },
497
- ),
498
- metricDefinition(
499
- "gatewayApprovalDecisionsTotal",
500
- gatewayApprovalDecisionsTotal,
501
- "smithers.gateway.approval_decisions_total",
502
- "counter",
503
- {
504
- label: "Gateway approval decisions",
505
- unit: "count",
506
- labels: ["decision", "transport"],
507
- },
508
- ),
509
- metricDefinition("gatewaySignalsTotal", gatewaySignalsTotal, "smithers.gateway.signals_total", "counter", {
510
- label: "Gateway signals",
511
- unit: "count",
512
- labels: ["outcome", "transport"],
513
- }),
514
- metricDefinition("gatewayAuthEventsTotal", gatewayAuthEventsTotal, "smithers.gateway.auth_events_total", "counter", {
515
- label: "Gateway auth events",
516
- unit: "count",
517
- labels: ["outcome", "transport"],
518
- }),
519
- metricDefinition(
520
- "gatewayHeartbeatTicksTotal",
521
- gatewayHeartbeatTicksTotal,
522
- "smithers.gateway.heartbeat_ticks_total",
523
- "counter",
524
- { label: "Gateway heartbeats", unit: "count" },
525
- ),
526
- metricDefinition(
527
- "gatewayCronTriggersTotal",
528
- gatewayCronTriggersTotal,
529
- "smithers.gateway.cron_triggers_total",
530
- "counter",
531
- {
532
- label: "Gateway cron triggers",
533
- unit: "count",
534
- labels: ["source"],
535
- },
536
- ),
537
- metricDefinition(
538
- "gatewayWebhooksReceivedTotal",
539
- gatewayWebhooksReceivedTotal,
540
- "smithers.gateway.webhooks_received_total",
541
- "counter",
542
- {
543
- label: "Gateway webhooks received",
544
- unit: "count",
545
- labels: ["provider"],
546
- },
547
- ),
548
- metricDefinition(
549
- "gatewayWebhooksVerifiedTotal",
550
- gatewayWebhooksVerifiedTotal,
551
- "smithers.gateway.webhooks_verified_total",
552
- "counter",
553
- {
554
- label: "Gateway webhooks verified",
555
- unit: "count",
556
- labels: ["provider"],
557
- },
558
- ),
559
- metricDefinition(
560
- "gatewayWebhooksRejectedTotal",
561
- gatewayWebhooksRejectedTotal,
562
- "smithers.gateway.webhooks_rejected_total",
563
- "counter",
564
- {
565
- label: "Gateway webhooks rejected",
566
- unit: "count",
567
- labels: ["provider", "reason"],
568
- },
569
- ),
570
- metricDefinition("eventsEmittedTotal", eventsEmittedTotal, "smithers.events.emitted_total", "counter", {
571
- label: "Events emitted",
572
- unit: "count",
573
- }),
574
- metricDefinition("taskHeartbeatsTotal", taskHeartbeatsTotal, "smithers.heartbeats.total", "counter", {
575
- label: "Task heartbeats",
576
- unit: "count",
577
- }),
578
- metricDefinition(
579
- "taskHeartbeatTimeoutTotal",
580
- taskHeartbeatTimeoutTotal,
581
- "smithers.heartbeats.timeout_total",
582
- "counter",
583
- { label: "Task heartbeat timeouts", unit: "count" },
584
- ),
585
- metricDefinition("memoryFactReads", memoryFactReads, "smithers.memory.fact_reads", "counter", {
586
- label: "Memory fact reads",
587
- unit: "count",
588
- }),
589
- metricDefinition("memoryFactWrites", memoryFactWrites, "smithers.memory.fact_writes", "counter", {
590
- label: "Memory fact writes",
591
- unit: "count",
592
- }),
593
- metricDefinition("memoryRecallQueries", memoryRecallQueries, "smithers.memory.recall_queries", "counter", {
594
- label: "Memory recall queries",
595
- unit: "count",
596
- }),
597
- metricDefinition("memoryMessageSaves", memoryMessageSaves, "smithers.memory.message_saves", "counter", {
598
- label: "Memory messages saved",
599
- unit: "count",
600
- }),
601
- metricDefinition("openApiToolCallsTotal", openApiToolCallsTotal, "smithers.openapi.tool_calls", "counter", {
602
- label: "OpenAPI tool calls",
603
- unit: "count",
604
- }),
605
- metricDefinition(
606
- "openApiToolCallErrorsTotal",
607
- openApiToolCallErrorsTotal,
608
- "smithers.openapi.tool_call_errors",
609
- "counter",
610
- { label: "OpenAPI tool call errors", unit: "count" },
611
- ),
612
- metricDefinition("scorersStarted", scorersStarted, "smithers.scorers.started", "counter", {
613
- label: "Scorers started",
614
- unit: "count",
615
- }),
616
- metricDefinition("scorersFinished", scorersFinished, "smithers.scorers.finished", "counter", {
617
- label: "Scorers finished",
618
- unit: "count",
619
- }),
620
- metricDefinition("scorersFailed", scorersFailed, "smithers.scorers.failed", "counter", {
621
- label: "Scorers failed",
622
- unit: "count",
623
- }),
624
- metricDefinition("snapshotsCaptured", snapshotsCaptured, "smithers.snapshots.captured", "counter", {
625
- label: "Snapshots captured",
626
- unit: "count",
627
- }),
628
- metricDefinition("runForksCreated", runForksCreated, "smithers.forks.created", "counter", {
629
- label: "Run forks created",
630
- unit: "count",
631
- }),
632
- metricDefinition("replaysStarted", replaysStarted, "smithers.replays.started", "counter", {
633
- label: "Replays started",
634
- unit: "count",
635
- }),
636
- metricDefinition("activeRuns", activeRuns, "smithers.runs.active", "gauge", { label: "Active runs", unit: "count" }),
637
- metricDefinition("activeNodes", activeNodes, "smithers.nodes.active", "gauge", {
638
- label: "Active nodes",
639
- unit: "count",
640
- }),
641
- metricDefinition("schedulerQueueDepth", schedulerQueueDepth, "smithers.scheduler.queue_depth", "gauge", {
642
- label: "Scheduler queue depth",
643
- unit: "count",
644
- }),
645
- metricDefinition("sandboxActive", sandboxActive, "smithers.sandbox.active", "gauge", {
646
- label: "Active sandboxes",
647
- unit: "count",
648
- labels: ["runtime"],
649
- }),
650
- metricDefinition("alertsActive", alertsActive, "smithers.alerts.active", "gauge", {
651
- label: "Active alerts",
652
- unit: "count",
653
- labels: ["policy"],
654
- }),
655
- metricDefinition(
656
- "gatewayConnectionsActive",
657
- gatewayConnectionsActive,
658
- "smithers.gateway.connections_active",
659
- "gauge",
660
- {
661
- label: "Active gateway connections",
662
- unit: "count",
663
- labels: ["transport"],
664
- },
665
- ),
666
- metricDefinition("approvalPending", approvalPending, "smithers.approval.pending", "gauge", {
667
- label: "Pending approvals",
668
- unit: "count",
669
- }),
670
- metricDefinition(
671
- "externalWaitAsyncPending",
672
- externalWaitAsyncPending,
673
- "smithers.external_wait.async_pending",
674
- "gauge",
675
- {
676
- label: "Pending external waits",
677
- unit: "count",
678
- labels: ["kind"],
679
- defaultLabels: [{ kind: "approval" }, { kind: "event" }],
680
- },
681
- ),
682
- metricDefinition("timersPending", timersPending, "smithers.timers.pending", "gauge", {
683
- label: "Pending timers",
684
- unit: "count",
685
- }),
686
- metricDefinition(
687
- "schedulerConcurrencyUtilization",
688
- schedulerConcurrencyUtilization,
689
- "smithers.scheduler.concurrency_utilization",
690
- "gauge",
691
- {
692
- label: "Scheduler concurrency utilization",
693
- unit: "ratio",
694
- },
695
- ),
696
- metricDefinition("processUptimeSeconds", processUptimeSeconds, "smithers.process.uptime_seconds", "gauge", {
697
- label: "Process uptime",
698
- unit: "seconds",
699
- }),
700
- metricDefinition("processMemoryRssBytes", processMemoryRssBytes, "smithers.process.memory_rss_bytes", "gauge", {
701
- label: "Process RSS memory",
702
- unit: "bytes",
703
- }),
704
- metricDefinition("processHeapUsedBytes", processHeapUsedBytes, "smithers.process.heap_used_bytes", "gauge", {
705
- label: "Process heap used",
706
- unit: "bytes",
707
- }),
708
- metricDefinition("nodeDuration", nodeDuration, "smithers.node.duration_ms", "histogram", {
709
- label: "Node duration",
710
- unit: "milliseconds",
711
- boundaries: durationBucketValues,
712
- }),
713
- metricDefinition("attemptDuration", attemptDuration, "smithers.attempt.duration_ms", "histogram", {
714
- label: "Attempt duration",
715
- unit: "milliseconds",
716
- boundaries: durationBucketValues,
717
- }),
718
- metricDefinition("toolDuration", toolDuration, "smithers.tool.duration_ms", "histogram", {
719
- label: "Tool duration",
720
- unit: "milliseconds",
721
- boundaries: toolBucketValues,
722
- }),
723
- metricDefinition("dbQueryDuration", dbQueryDuration, "smithers.db.query_ms", "histogram", {
724
- label: "DB query duration",
725
- unit: "milliseconds",
726
- boundaries: fastBucketValues,
727
- }),
728
- metricDefinition("dbTransactionDuration", dbTransactionDuration, "smithers.db.transaction_ms", "histogram", {
729
- label: "DB transaction duration",
730
- unit: "milliseconds",
731
- boundaries: fastBucketValues,
732
- }),
733
- metricDefinition("httpRequestDuration", httpRequestDuration, "smithers.http.request_duration_ms", "histogram", {
734
- label: "HTTP request duration",
735
- unit: "milliseconds",
736
- labels: ["method", "route", "status_code", "status_class"],
737
- boundaries: fastBucketValues,
738
- }),
739
- metricDefinition("hotReloadDuration", hotReloadDuration, "smithers.hot.reload_duration_ms", "histogram", {
740
- label: "Hot reload duration",
741
- unit: "milliseconds",
742
- boundaries: durationBucketValues,
743
- }),
744
- metricDefinition("vcsDuration", vcsDuration, "smithers.vcs.duration_ms", "histogram", {
745
- label: "VCS duration",
746
- unit: "milliseconds",
747
- boundaries: fastBucketValues,
748
- }),
749
- metricDefinition("agentDurationMs", agentDurationMs, "smithers.agent_duration_ms", "histogram", {
750
- label: "Agent duration",
751
- unit: "milliseconds",
752
- labels: ["engine", "model"],
753
- boundaries: durationBucketValues,
754
- }),
755
- metricDefinition("tokensInputPerCall", tokensInputPerCall, "smithers.tokens.input_per_call", "histogram", {
756
- label: "Input tokens per call",
757
- unit: "tokens",
758
- labels: ["agent", "model"],
759
- boundaries: tokenBucketValues,
760
- }),
761
- metricDefinition("tokensOutputPerCall", tokensOutputPerCall, "smithers.tokens.output_per_call", "histogram", {
762
- label: "Output tokens per call",
763
- unit: "tokens",
764
- labels: ["agent", "model"],
765
- boundaries: tokenBucketValues,
766
- }),
767
- metricDefinition(
768
- "tokensContextWindowPerCall",
769
- tokensContextWindowPerCall,
770
- "smithers.tokens.context_window_per_call",
771
- "histogram",
772
- {
773
- label: "Context window per call",
774
- unit: "tokens",
775
- labels: ["agent", "model"],
776
- boundaries: contextWindowBucketValues,
777
- },
778
- ),
779
- metricDefinition("runDuration", runDuration, "smithers.run.duration_ms", "histogram", {
780
- label: "Run duration",
781
- unit: "milliseconds",
782
- boundaries: durationBucketValues,
783
- }),
784
- metricDefinition("promptSizeBytes", promptSizeBytes, "smithers.prompt.size_bytes", "histogram", {
785
- label: "Prompt size",
786
- unit: "bytes",
787
- boundaries: sizeBucketValues,
788
- }),
789
- metricDefinition("responseSizeBytes", responseSizeBytes, "smithers.response.size_bytes", "histogram", {
790
- label: "Response size",
791
- unit: "bytes",
792
- boundaries: sizeBucketValues,
793
- }),
794
- metricDefinition("approvalWaitDuration", approvalWaitDuration, "smithers.approval.wait_duration_ms", "histogram", {
795
- label: "Approval wait duration",
796
- unit: "milliseconds",
797
- boundaries: durationBucketValues,
798
- }),
799
- metricDefinition("timerDelayDuration", timerDelayDuration, "smithers.timers.delay_ms", "histogram", {
800
- label: "Timer delay",
801
- unit: "milliseconds",
802
- boundaries: durationBucketValues,
803
- }),
804
- metricDefinition("gatewayRpcDuration", gatewayRpcDuration, "smithers.gateway.rpc_duration_ms", "histogram", {
805
- label: "Gateway RPC duration",
806
- unit: "milliseconds",
807
- labels: ["method", "transport"],
808
- boundaries: durationBucketValues,
809
- }),
810
- metricDefinition("schedulerWaitDuration", schedulerWaitDuration, "smithers.scheduler.wait_duration_ms", "histogram", {
811
- label: "Scheduler wait duration",
812
- unit: "milliseconds",
813
- boundaries: durationBucketValues,
814
- }),
815
- metricDefinition(
816
- "supervisorPollDuration",
817
- supervisorPollDuration,
818
- "smithers.supervisor.poll_duration_ms",
819
- "histogram",
820
- { label: "Supervisor poll duration", unit: "milliseconds", boundaries: fastBucketValues },
821
- ),
822
- metricDefinition("supervisorResumeLag", supervisorResumeLag, "smithers.supervisor.resume_lag_ms", "histogram", {
823
- label: "Supervisor resume lag",
824
- unit: "milliseconds",
825
- boundaries: durationBucketValues,
826
- }),
827
- metricDefinition("runsAncestryDepth", runsAncestryDepth, "smithers.runs.ancestry_depth", "histogram", {
828
- label: "Run ancestry depth",
829
- unit: "depth",
830
- boundaries: ancestryDepthBucketValues,
831
- }),
832
- metricDefinition("runsCarriedStateBytes", runsCarriedStateBytes, "smithers.runs.carried_state_bytes", "histogram", {
833
- label: "Run carried state size",
834
- unit: "bytes",
835
- boundaries: carriedStateSizeBucketValues,
836
- }),
837
- metricDefinition("sandboxDurationMs", sandboxDurationMs, "smithers.sandbox.duration_ms", "histogram", {
838
- label: "Sandbox duration",
839
- unit: "milliseconds",
840
- boundaries: durationBucketValues,
841
- }),
842
- metricDefinition(
843
- "sandboxBundleSizeBytes",
844
- sandboxBundleSizeBytes,
845
- "smithers.sandbox.bundle_size_bytes",
846
- "histogram",
847
- { label: "Sandbox bundle size", unit: "bytes", boundaries: sizeBucketValues },
848
- ),
849
- metricDefinition(
850
- "sandboxTransportDurationMs",
851
- sandboxTransportDurationMs,
852
- "smithers.sandbox.transport_duration_ms",
853
- "histogram",
854
- { label: "Sandbox transport duration", unit: "milliseconds", boundaries: durationBucketValues },
855
- ),
856
- metricDefinition("sandboxPatchCount", sandboxPatchCount, "smithers.sandbox.patch_count", "histogram", {
857
- label: "Sandbox patch count",
858
- unit: "count",
859
- boundaries: tokenBucketValues,
860
- }),
861
- metricDefinition(
862
- "heartbeatDataSizeBytes",
863
- heartbeatDataSizeBytes,
864
- "smithers.heartbeats.data_size_bytes",
865
- "histogram",
866
- { label: "Heartbeat data size", unit: "bytes", boundaries: sizeBucketValues },
867
- ),
868
- metricDefinition("heartbeatIntervalMs", heartbeatIntervalMs, "smithers.heartbeats.interval_ms", "histogram", {
869
- label: "Heartbeat interval",
870
- unit: "milliseconds",
871
- boundaries: fastBucketValues,
872
- }),
873
- metricDefinition("memoryRecallDuration", memoryRecallDuration, "smithers.memory.recall_duration_ms", "histogram", {
874
- label: "Memory recall duration",
875
- unit: "milliseconds",
876
- boundaries: metricHistogramBoundaries(memoryRecallDuration),
877
- }),
878
- metricDefinition("openApiToolDuration", openApiToolDuration, "smithers.openapi.tool_duration_ms", "histogram", {
879
- label: "OpenAPI tool duration",
880
- unit: "milliseconds",
881
- boundaries: metricHistogramBoundaries(openApiToolDuration),
882
- }),
883
- metricDefinition("scorerDuration", scorerDuration, "smithers.scorer.duration_ms", "histogram", {
884
- label: "Scorer duration",
885
- unit: "milliseconds",
886
- boundaries: metricHistogramBoundaries(scorerDuration),
887
- }),
888
- metricDefinition("snapshotDuration", snapshotDuration, "smithers.snapshot.duration_ms", "histogram", {
889
- label: "Snapshot duration",
890
- unit: "milliseconds",
891
- boundaries: metricHistogramBoundaries(snapshotDuration),
892
- }),
893
- ];