@smthrs/observability 0.33.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.
Files changed (247) hide show
  1. package/LICENSE +21 -0
  2. package/docker-compose.otel.yml +104 -0
  3. package/grafana/dashboards/smithers-dashboard.json +453 -0
  4. package/grafana/provisioning/dashboards/dashboards.yml +12 -0
  5. package/grafana/provisioning/datasources/datasources.yml +49 -0
  6. package/loki/loki-config.yaml +35 -0
  7. package/otel-collector-config.yml +38 -0
  8. package/package.json +47 -0
  9. package/prometheus/prometheus.yml +8 -0
  10. package/src/MetricName.ts +1 -0
  11. package/src/MetricsServiceLive.js +9 -0
  12. package/src/README.md +28 -0
  13. package/src/ResolvedSmithersObservabilityOptions.ts +12 -0
  14. package/src/SmithersEvent.ts +773 -0
  15. package/src/SmithersLogFormat.ts +1 -0
  16. package/src/SmithersMetricDefinition.ts +15 -0
  17. package/src/SmithersMetricType.ts +1 -0
  18. package/src/SmithersMetricUnit.ts +1 -0
  19. package/src/SmithersObservability.js +15 -0
  20. package/src/SmithersObservabilityOptions.ts +12 -0
  21. package/src/SmithersObservabilityService.ts +13 -0
  22. package/src/_coreCorrelation/CorrelationContext.ts +10 -0
  23. package/src/_coreCorrelation/CorrelationContextLive.js +11 -0
  24. package/src/_coreCorrelation/CorrelationContextService.js +15 -0
  25. package/src/_coreCorrelation/CorrelationContextServiceShape.ts +12 -0
  26. package/src/_coreCorrelation/CorrelationPatch.ts +3 -0
  27. package/src/_coreCorrelation/README.md +20 -0
  28. package/src/_coreCorrelation/_correlationStorage.js +4 -0
  29. package/src/_coreCorrelation/correlationContextFiberRef.js +5 -0
  30. package/src/_coreCorrelation/correlationContextToLogAnnotations.js +18 -0
  31. package/src/_coreCorrelation/getCurrentCorrelationContext.js +9 -0
  32. package/src/_coreCorrelation/getCurrentCorrelationContextEffect.js +11 -0
  33. package/src/_coreCorrelation/index.js +14 -0
  34. package/src/_coreCorrelation/mergeCorrelationContext.js +51 -0
  35. package/src/_coreCorrelation/runWithCorrelationContext.js +14 -0
  36. package/src/_coreCorrelation/updateCurrentCorrelationContext.js +17 -0
  37. package/src/_coreCorrelation/withCorrelationContext.js +38 -0
  38. package/src/_coreCorrelation/withCurrentCorrelationContext.js +11 -0
  39. package/src/_coreMetrics.js +14 -0
  40. package/src/_coreMetricsShape.ts +44 -0
  41. package/src/_corePrometheus.js +91 -0
  42. package/src/_corePrometheusShape.ts +11 -0
  43. package/src/_coreTracing.js +132 -0
  44. package/src/_coreTracingShape.ts +17 -0
  45. package/src/_otelLogBuilders.js +102 -0
  46. package/src/_sessionFileResolvers.js +164 -0
  47. package/src/_smithersSpanAttributeAliases.js +19 -0
  48. package/src/_smithersTraceSpanStorage.js +3 -0
  49. package/src/_traceEventNormalizers.js +499 -0
  50. package/src/_traceRedaction.js +162 -0
  51. package/src/agentSessionEventToOtelLogRecord.js +55 -0
  52. package/src/agentTrace.ts +144 -0
  53. package/src/agentTraceCapabilities.js +151 -0
  54. package/src/annotateSmithersTrace.js +11 -0
  55. package/src/canonicalTraceEventToOtelLogRecord.js +55 -0
  56. package/src/correlation.js +56 -0
  57. package/src/createSmithersObservabilityLayer.js +59 -0
  58. package/src/createSmithersOtelLayer.js +23 -0
  59. package/src/createSmithersRuntimeLayer.js +2 -0
  60. package/src/detectAgentFamily.js +26 -0
  61. package/src/detectCaptureMode.js +24 -0
  62. package/src/emitOtelLogRecord.js +19 -0
  63. package/src/getCurrentSmithersTraceAnnotations.js +14 -0
  64. package/src/getCurrentSmithersTraceSpan.js +7 -0
  65. package/src/index.d.ts +1321 -0
  66. package/src/index.js +136 -0
  67. package/src/kindPhase.js +17 -0
  68. package/src/logging.js +248 -0
  69. package/src/makeSmithersSpanAttributes.js +20 -0
  70. package/src/metrics/README.md +22 -0
  71. package/src/metrics/SmithersMetricDefinition.ts +17 -0
  72. package/src/metrics/SmithersMetricType.ts +1 -0
  73. package/src/metrics/SmithersMetricUnit.ts +1 -0
  74. package/src/metrics/_asyncExternalWaitCounts.js +4 -0
  75. package/src/metrics/_buckets.js +37 -0
  76. package/src/metrics/_incrementGauge.js +11 -0
  77. package/src/metrics/_processStartMs.js +1 -0
  78. package/src/metrics/activeNodes.js +2 -0
  79. package/src/metrics/activeRuns.js +2 -0
  80. package/src/metrics/agentActionsTotal.js +2 -0
  81. package/src/metrics/agentDurationMs.js +3 -0
  82. package/src/metrics/agentErrorsTotal.js +2 -0
  83. package/src/metrics/agentEventsTotal.js +2 -0
  84. package/src/metrics/agentInvocationsTotal.js +2 -0
  85. package/src/metrics/agentRetriesTotal.js +2 -0
  86. package/src/metrics/agentSessionsTotal.js +2 -0
  87. package/src/metrics/agentTokensTotal.js +2 -0
  88. package/src/metrics/alertDeliveriesAttempted.js +2 -0
  89. package/src/metrics/alertDeliveriesSuppressed.js +2 -0
  90. package/src/metrics/alertsAcknowledgedTotal.js +2 -0
  91. package/src/metrics/alertsActive.js +2 -0
  92. package/src/metrics/alertsEscalatedTotal.js +2 -0
  93. package/src/metrics/alertsFiredTotal.js +2 -0
  94. package/src/metrics/alertsReopenedTotal.js +2 -0
  95. package/src/metrics/alertsResolvedTotal.js +2 -0
  96. package/src/metrics/alertsSilencedTotal.js +2 -0
  97. package/src/metrics/approvalPending.js +2 -0
  98. package/src/metrics/approvalWaitDuration.js +5 -0
  99. package/src/metrics/approvalsDenied.js +2 -0
  100. package/src/metrics/approvalsGranted.js +2 -0
  101. package/src/metrics/approvalsRequested.js +2 -0
  102. package/src/metrics/attemptDuration.js +3 -0
  103. package/src/metrics/attentionBacklog.js +2 -0
  104. package/src/metrics/cacheHits.js +2 -0
  105. package/src/metrics/cacheMisses.js +2 -0
  106. package/src/metrics/dbQueryDuration.js +3 -0
  107. package/src/metrics/dbRetries.js +2 -0
  108. package/src/metrics/dbTransactionDuration.js +3 -0
  109. package/src/metrics/dbTransactionRetries.js +2 -0
  110. package/src/metrics/dbTransactionRollbacks.js +2 -0
  111. package/src/metrics/devtoolsActiveSubscribers.js +2 -0
  112. package/src/metrics/devtoolsBackpressureDisconnectTotal.js +2 -0
  113. package/src/metrics/devtoolsDeltaBuildMs.js +3 -0
  114. package/src/metrics/devtoolsEventBytes.js +3 -0
  115. package/src/metrics/devtoolsEventTotal.js +2 -0
  116. package/src/metrics/devtoolsSnapshotBuildMs.js +5 -0
  117. package/src/metrics/devtoolsSubscribeTotal.js +2 -0
  118. package/src/metrics/errorsTotal.js +2 -0
  119. package/src/metrics/eventsEmittedTotal.js +2 -0
  120. package/src/metrics/externalWaitAsyncPending.js +2 -0
  121. package/src/metrics/gatewayApprovalDecisionsTotal.js +2 -0
  122. package/src/metrics/gatewayAuthEventsTotal.js +2 -0
  123. package/src/metrics/gatewayConnectionsActive.js +2 -0
  124. package/src/metrics/gatewayConnectionsClosedTotal.js +2 -0
  125. package/src/metrics/gatewayConnectionsTotal.js +2 -0
  126. package/src/metrics/gatewayCronTriggersTotal.js +2 -0
  127. package/src/metrics/gatewayErrorsTotal.js +2 -0
  128. package/src/metrics/gatewayHeartbeatTicksTotal.js +2 -0
  129. package/src/metrics/gatewayMessagesReceivedTotal.js +2 -0
  130. package/src/metrics/gatewayMessagesSentTotal.js +2 -0
  131. package/src/metrics/gatewayRpcCallsTotal.js +2 -0
  132. package/src/metrics/gatewayRpcDuration.js +3 -0
  133. package/src/metrics/gatewayRunEventBackpressureDisconnectTotal.js +4 -0
  134. package/src/metrics/gatewayRunsCompletedTotal.js +2 -0
  135. package/src/metrics/gatewayRunsStartedTotal.js +2 -0
  136. package/src/metrics/gatewaySignalsTotal.js +2 -0
  137. package/src/metrics/gatewayWebhooksReceivedTotal.js +2 -0
  138. package/src/metrics/gatewayWebhooksRejectedTotal.js +2 -0
  139. package/src/metrics/gatewayWebhooksVerifiedTotal.js +2 -0
  140. package/src/metrics/heartbeatDataSizeBytes.js +5 -0
  141. package/src/metrics/heartbeatIntervalMs.js +3 -0
  142. package/src/metrics/hotReloadDuration.js +3 -0
  143. package/src/metrics/hotReloadFailures.js +2 -0
  144. package/src/metrics/hotReloads.js +2 -0
  145. package/src/metrics/httpRequestDuration.js +3 -0
  146. package/src/metrics/httpRequests.js +2 -0
  147. package/src/metrics/index.d.ts +1163 -0
  148. package/src/metrics/index.js +168 -0
  149. package/src/metrics/memoryFactReads.js +3 -0
  150. package/src/metrics/memoryFactWrites.js +3 -0
  151. package/src/metrics/memoryMessageSaves.js +3 -0
  152. package/src/metrics/memoryRecallDuration.js +11 -0
  153. package/src/metrics/memoryRecallQueries.js +3 -0
  154. package/src/metrics/metricsServiceAdapter.js +181 -0
  155. package/src/metrics/nodeDuration.js +3 -0
  156. package/src/metrics/nodeRetriesTotal.js +2 -0
  157. package/src/metrics/nodesFailed.js +2 -0
  158. package/src/metrics/nodesFinished.js +2 -0
  159. package/src/metrics/nodesStarted.js +2 -0
  160. package/src/metrics/openApiToolCallErrorsTotal.js +3 -0
  161. package/src/metrics/openApiToolCallsTotal.js +3 -0
  162. package/src/metrics/openApiToolDuration.js +9 -0
  163. package/src/metrics/processHeapUsedBytes.js +2 -0
  164. package/src/metrics/processMemoryRssBytes.js +2 -0
  165. package/src/metrics/processUptimeSeconds.js +2 -0
  166. package/src/metrics/promptSizeBytes.js +3 -0
  167. package/src/metrics/replaysStarted.js +3 -0
  168. package/src/metrics/responseSizeBytes.js +3 -0
  169. package/src/metrics/rewindDurationMs.js +3 -0
  170. package/src/metrics/rewindFramesDeleted.js +3 -0
  171. package/src/metrics/rewindRollbackTotal.js +2 -0
  172. package/src/metrics/rewindSandboxesReverted.js +3 -0
  173. package/src/metrics/rewindTotal.js +2 -0
  174. package/src/metrics/runDuration.js +3 -0
  175. package/src/metrics/runForksCreated.js +3 -0
  176. package/src/metrics/runsAncestryDepth.js +3 -0
  177. package/src/metrics/runsCancelledTotal.js +2 -0
  178. package/src/metrics/runsCarriedStateBytes.js +5 -0
  179. package/src/metrics/runsContinuedTotal.js +2 -0
  180. package/src/metrics/runsFailedTotal.js +2 -0
  181. package/src/metrics/runsFinishedTotal.js +2 -0
  182. package/src/metrics/runsResumedTotal.js +2 -0
  183. package/src/metrics/runsTotal.js +2 -0
  184. package/src/metrics/sandboxActive.js +2 -0
  185. package/src/metrics/sandboxBundleSizeBytes.js +5 -0
  186. package/src/metrics/sandboxCompletedTotal.js +2 -0
  187. package/src/metrics/sandboxCreatedTotal.js +2 -0
  188. package/src/metrics/sandboxDurationMs.js +3 -0
  189. package/src/metrics/sandboxPatchCount.js +3 -0
  190. package/src/metrics/sandboxTransportDurationMs.js +5 -0
  191. package/src/metrics/schedulerConcurrencyUtilization.js +2 -0
  192. package/src/metrics/schedulerQueueDepth.js +2 -0
  193. package/src/metrics/schedulerWaitDuration.js +5 -0
  194. package/src/metrics/scorerDuration.js +9 -0
  195. package/src/metrics/scorerEventsFailed.js +2 -0
  196. package/src/metrics/scorerEventsFinished.js +2 -0
  197. package/src/metrics/scorerEventsStarted.js +2 -0
  198. package/src/metrics/scorersFailed.js +3 -0
  199. package/src/metrics/scorersFinished.js +3 -0
  200. package/src/metrics/scorersStarted.js +3 -0
  201. package/src/metrics/smithersMetricCatalog.js +893 -0
  202. package/src/metrics/smithersMetricCatalogByKey.js +2 -0
  203. package/src/metrics/smithersMetricCatalogByName.js +2 -0
  204. package/src/metrics/smithersMetricCatalogByPrometheusName.js +4 -0
  205. package/src/metrics/snapshotDuration.js +9 -0
  206. package/src/metrics/snapshotsCaptured.js +3 -0
  207. package/src/metrics/supervisorPollDuration.js +5 -0
  208. package/src/metrics/supervisorPollsTotal.js +2 -0
  209. package/src/metrics/supervisorResumeLag.js +5 -0
  210. package/src/metrics/supervisorResumedTotal.js +2 -0
  211. package/src/metrics/supervisorSkippedTotal.js +2 -0
  212. package/src/metrics/supervisorStaleDetected.js +2 -0
  213. package/src/metrics/taskHeartbeatTimeoutTotal.js +2 -0
  214. package/src/metrics/taskHeartbeatsTotal.js +2 -0
  215. package/src/metrics/timerDelayDuration.js +3 -0
  216. package/src/metrics/timersCancelled.js +2 -0
  217. package/src/metrics/timersCreated.js +2 -0
  218. package/src/metrics/timersFired.js +2 -0
  219. package/src/metrics/timersPending.js +2 -0
  220. package/src/metrics/toPrometheusMetricName.js +8 -0
  221. package/src/metrics/tokensCacheReadTotal.js +2 -0
  222. package/src/metrics/tokensCacheWriteTotal.js +2 -0
  223. package/src/metrics/tokensContextWindowBucketTotal.js +2 -0
  224. package/src/metrics/tokensContextWindowPerCall.js +5 -0
  225. package/src/metrics/tokensInputPerCall.js +3 -0
  226. package/src/metrics/tokensInputTotal.js +2 -0
  227. package/src/metrics/tokensOutputPerCall.js +3 -0
  228. package/src/metrics/tokensOutputTotal.js +2 -0
  229. package/src/metrics/tokensReasoningTotal.js +2 -0
  230. package/src/metrics/toolCallErrorsTotal.js +2 -0
  231. package/src/metrics/toolCallsTotal.js +2 -0
  232. package/src/metrics/toolDuration.js +3 -0
  233. package/src/metrics/toolOutputTruncatedTotal.js +2 -0
  234. package/src/metrics/trackEvent.js +608 -0
  235. package/src/metrics/updateAsyncExternalWaitPending.js +18 -0
  236. package/src/metrics/updateProcessMetrics.js +20 -0
  237. package/src/metrics/vcsDuration.js +3 -0
  238. package/src/normalizeStructuredEvent.js +15 -0
  239. package/src/prometheusContentType.js +1 -0
  240. package/src/renderPrometheusMetrics.js +212 -0
  241. package/src/resolveAgentTraceCapabilities.js +59 -0
  242. package/src/resolveSmithersObservabilityOptions.js +109 -0
  243. package/src/smithersMetrics.js +2 -0
  244. package/src/smithersSpanNames.js +6 -0
  245. package/src/unsupportedKindsForCapabilities.js +32 -0
  246. package/src/withSmithersSpan.js +17 -0
  247. package/tempo/tempo.yml +17 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 William Cory
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,104 @@
1
+ version: "3.9"
2
+
3
+ services:
4
+ otel-collector:
5
+ image: otel/opentelemetry-collector-contrib:0.148.0
6
+ restart: unless-stopped
7
+ command: ["--config", "/etc/otelcol/config.yml"]
8
+ volumes:
9
+ - ./otel-collector-config.yml:/etc/otelcol/config.yml:ro
10
+ ports:
11
+ - "4317:4317" # gRPC
12
+ - "4318:4318" # HTTP (Smithers sends here)
13
+ - "8889:8889" # Prometheus exporter scrape endpoint
14
+ depends_on:
15
+ tempo:
16
+ condition: service_healthy
17
+ loki:
18
+ condition: service_healthy
19
+ healthcheck:
20
+ test: ["CMD", "/otelcol-contrib", "--version"]
21
+ interval: 10s
22
+ timeout: 5s
23
+ retries: 12
24
+ start_period: 10s
25
+
26
+ loki:
27
+ image: grafana/loki:3.3.2
28
+ restart: unless-stopped
29
+ command: ["-config.file=/etc/loki/local-config.yaml"]
30
+ volumes:
31
+ - ./loki/loki-config.yaml:/etc/loki/local-config.yaml:ro
32
+ - ./data/loki:/loki
33
+ ports:
34
+ - "3100:3100"
35
+ healthcheck:
36
+ test: ["CMD", "wget", "-q", "-O-", "http://127.0.0.1:3100/ready"]
37
+ interval: 10s
38
+ timeout: 5s
39
+ retries: 18
40
+ start_period: 10s
41
+
42
+ prometheus:
43
+ image: prom/prometheus:v3.2.0
44
+ restart: unless-stopped
45
+ volumes:
46
+ - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
47
+ - ./data/prometheus:/prometheus
48
+ ports:
49
+ - "9090:9090"
50
+ depends_on:
51
+ otel-collector:
52
+ condition: service_healthy
53
+ healthcheck:
54
+ test: ["CMD", "wget", "-q", "-O-", "http://127.0.0.1:9090/-/ready"]
55
+ interval: 10s
56
+ timeout: 5s
57
+ retries: 18
58
+ start_period: 10s
59
+
60
+ tempo:
61
+ image: grafana/tempo:2.7.0
62
+ restart: unless-stopped
63
+ command: ["-config.file=/etc/tempo/tempo.yml"]
64
+ volumes:
65
+ - ./tempo/tempo.yml:/etc/tempo/tempo.yml:ro
66
+ - ./data/tempo:/tmp/tempo
67
+ ports:
68
+ - "3200:3200" # Tempo query API
69
+ - "4317" # OTLP gRPC (internal)
70
+ healthcheck:
71
+ test: ["CMD", "wget", "-q", "-O-", "http://127.0.0.1:3200/api/search"]
72
+ interval: 10s
73
+ timeout: 5s
74
+ retries: 24
75
+ start_period: 20s
76
+
77
+ grafana:
78
+ image: grafana/grafana:11.5.0
79
+ restart: unless-stopped
80
+ environment:
81
+ # Local dev default is "admin"; override via env for anything shared.
82
+ - GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD:-admin}
83
+ # Anonymous browsing stays on for frictionless local dev, but read-only.
84
+ - GF_AUTH_ANONYMOUS_ENABLED=${GF_AUTH_ANONYMOUS_ENABLED:-true}
85
+ - GF_AUTH_ANONYMOUS_ORG_ROLE=${GF_AUTH_ANONYMOUS_ORG_ROLE:-Viewer}
86
+ volumes:
87
+ - ./grafana/provisioning:/etc/grafana/provisioning:ro
88
+ - ./grafana/dashboards:/var/lib/grafana/dashboards:ro
89
+ - ./data/grafana:/var/lib/grafana
90
+ ports:
91
+ - "3001:3000"
92
+ depends_on:
93
+ prometheus:
94
+ condition: service_healthy
95
+ tempo:
96
+ condition: service_healthy
97
+ loki:
98
+ condition: service_healthy
99
+ healthcheck:
100
+ test: ["CMD", "wget", "-q", "-O-", "http://127.0.0.1:3000/api/health"]
101
+ interval: 10s
102
+ timeout: 5s
103
+ retries: 24
104
+ start_period: 20s
@@ -0,0 +1,453 @@
1
+ {
2
+ "uid": "smithers-overview",
3
+ "title": "Smithers Overview",
4
+ "tags": ["smithers", "ai", "orchestration"],
5
+ "timezone": "browser",
6
+ "schemaVersion": 39,
7
+ "version": 1,
8
+ "refresh": "10s",
9
+ "time": { "from": "now-1h", "to": "now" },
10
+ "editable": true,
11
+ "panels": [
12
+ {
13
+ "type": "row",
14
+ "title": "Overview",
15
+ "collapsed": false,
16
+ "gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 },
17
+ "id": 1
18
+ },
19
+ {
20
+ "type": "stat",
21
+ "title": "Active Runs",
22
+ "id": 2,
23
+ "gridPos": { "h": 4, "w": 4, "x": 0, "y": 1 },
24
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
25
+ "targets": [{ "expr": "smithers_smithers_runs_active", "refId": "A" }],
26
+ "fieldConfig": {
27
+ "defaults": {
28
+ "thresholds": {
29
+ "mode": "absolute",
30
+ "steps": [
31
+ { "color": "green", "value": null },
32
+ { "color": "yellow", "value": 5 },
33
+ { "color": "red", "value": 10 }
34
+ ]
35
+ },
36
+ "color": { "mode": "thresholds" }
37
+ }
38
+ },
39
+ "options": {
40
+ "reduceOptions": { "calcs": ["lastNotNull"] },
41
+ "colorMode": "background",
42
+ "graphMode": "area"
43
+ }
44
+ },
45
+ {
46
+ "type": "stat",
47
+ "title": "Total Runs",
48
+ "id": 3,
49
+ "gridPos": { "h": 4, "w": 4, "x": 4, "y": 1 },
50
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
51
+ "targets": [{ "expr": "smithers_smithers_runs_total", "refId": "A" }],
52
+ "fieldConfig": { "defaults": { "color": { "mode": "fixed", "fixedColor": "blue" } } },
53
+ "options": {
54
+ "reduceOptions": { "calcs": ["lastNotNull"] },
55
+ "colorMode": "value",
56
+ "graphMode": "area"
57
+ }
58
+ },
59
+ {
60
+ "type": "stat",
61
+ "title": "Active Nodes",
62
+ "id": 4,
63
+ "gridPos": { "h": 4, "w": 4, "x": 8, "y": 1 },
64
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
65
+ "targets": [{ "expr": "smithers_smithers_nodes_active", "refId": "A" }],
66
+ "fieldConfig": {
67
+ "defaults": {
68
+ "thresholds": {
69
+ "mode": "absolute",
70
+ "steps": [
71
+ { "color": "green", "value": null },
72
+ { "color": "yellow", "value": 10 },
73
+ { "color": "red", "value": 20 }
74
+ ]
75
+ },
76
+ "color": { "mode": "thresholds" }
77
+ }
78
+ },
79
+ "options": {
80
+ "reduceOptions": { "calcs": ["lastNotNull"] },
81
+ "colorMode": "background",
82
+ "graphMode": "area"
83
+ }
84
+ },
85
+ {
86
+ "type": "stat",
87
+ "title": "Node Success Rate",
88
+ "id": 5,
89
+ "gridPos": { "h": 4, "w": 4, "x": 12, "y": 1 },
90
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
91
+ "targets": [{
92
+ "expr": "(smithers_smithers_nodes_finished / (smithers_smithers_nodes_finished + smithers_smithers_nodes_failed > 0)) * 100 or vector(100)",
93
+ "refId": "A"
94
+ }],
95
+ "fieldConfig": {
96
+ "defaults": {
97
+ "unit": "percent",
98
+ "thresholds": {
99
+ "mode": "absolute",
100
+ "steps": [
101
+ { "color": "red", "value": null },
102
+ { "color": "yellow", "value": 90 },
103
+ { "color": "green", "value": 99 }
104
+ ]
105
+ },
106
+ "color": { "mode": "thresholds" },
107
+ "min": 0,
108
+ "max": 100
109
+ }
110
+ },
111
+ "options": {
112
+ "reduceOptions": { "calcs": ["lastNotNull"] },
113
+ "colorMode": "background",
114
+ "graphMode": "none"
115
+ }
116
+ },
117
+ {
118
+ "type": "stat",
119
+ "title": "Cache Hit Rate",
120
+ "id": 6,
121
+ "gridPos": { "h": 4, "w": 4, "x": 16, "y": 1 },
122
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
123
+ "targets": [{
124
+ "expr": "(smithers_smithers_cache_hits / (smithers_smithers_cache_hits + smithers_smithers_cache_misses > 0)) * 100 or vector(0)",
125
+ "refId": "A"
126
+ }],
127
+ "fieldConfig": {
128
+ "defaults": {
129
+ "unit": "percent",
130
+ "thresholds": {
131
+ "mode": "absolute",
132
+ "steps": [
133
+ { "color": "red", "value": null },
134
+ { "color": "yellow", "value": 30 },
135
+ { "color": "green", "value": 70 }
136
+ ]
137
+ },
138
+ "color": { "mode": "thresholds" },
139
+ "min": 0,
140
+ "max": 100
141
+ }
142
+ },
143
+ "options": {
144
+ "reduceOptions": { "calcs": ["lastNotNull"] },
145
+ "colorMode": "background",
146
+ "graphMode": "none"
147
+ }
148
+ },
149
+ {
150
+ "type": "stat",
151
+ "title": "DB Retries",
152
+ "id": 7,
153
+ "gridPos": { "h": 4, "w": 4, "x": 20, "y": 1 },
154
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
155
+ "targets": [{ "expr": "smithers_smithers_db_retries", "refId": "A" }],
156
+ "fieldConfig": {
157
+ "defaults": {
158
+ "thresholds": {
159
+ "mode": "absolute",
160
+ "steps": [
161
+ { "color": "green", "value": null },
162
+ { "color": "yellow", "value": 5 },
163
+ { "color": "red", "value": 20 }
164
+ ]
165
+ },
166
+ "color": { "mode": "thresholds" }
167
+ }
168
+ },
169
+ "options": {
170
+ "reduceOptions": { "calcs": ["lastNotNull"] },
171
+ "colorMode": "value",
172
+ "graphMode": "area"
173
+ }
174
+ },
175
+
176
+ {
177
+ "type": "row",
178
+ "title": "Runs & Nodes",
179
+ "collapsed": false,
180
+ "gridPos": { "h": 1, "w": 24, "x": 0, "y": 5 },
181
+ "id": 10
182
+ },
183
+ {
184
+ "type": "timeseries",
185
+ "title": "Node Throughput",
186
+ "id": 11,
187
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 6 },
188
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
189
+ "targets": [
190
+ { "expr": "rate(smithers_smithers_nodes_started[5m])", "legendFormat": "Started", "refId": "A" },
191
+ { "expr": "rate(smithers_smithers_nodes_finished[5m])", "legendFormat": "Finished", "refId": "B" },
192
+ { "expr": "rate(smithers_smithers_nodes_failed[5m])", "legendFormat": "Failed", "refId": "C" }
193
+ ],
194
+ "fieldConfig": {
195
+ "defaults": {
196
+ "custom": { "drawStyle": "line", "lineWidth": 2, "fillOpacity": 10, "gradientMode": "scheme" },
197
+ "color": { "mode": "palette-classic" },
198
+ "unit": "ops"
199
+ }
200
+ },
201
+ "options": {
202
+ "tooltip": { "mode": "multi", "sort": "desc" },
203
+ "legend": { "displayMode": "list", "placement": "bottom", "calcs": ["mean", "max"] }
204
+ }
205
+ },
206
+ {
207
+ "type": "heatmap",
208
+ "title": "Node Duration",
209
+ "id": 12,
210
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 6 },
211
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
212
+ "targets": [{
213
+ "expr": "sum(increase(smithers_smithers_node_duration_ms_bucket[5m])) by (le)",
214
+ "legendFormat": "{{le}}",
215
+ "refId": "A",
216
+ "format": "heatmap"
217
+ }],
218
+ "options": {
219
+ "calculate": false,
220
+ "yAxis": { "unit": "ms" },
221
+ "color": { "mode": "scheme", "scheme": "Oranges", "steps": 64 },
222
+ "cellGap": 1
223
+ }
224
+ },
225
+
226
+ {
227
+ "type": "row",
228
+ "title": "Tools",
229
+ "collapsed": false,
230
+ "gridPos": { "h": 1, "w": 24, "x": 0, "y": 14 },
231
+ "id": 20
232
+ },
233
+ {
234
+ "type": "timeseries",
235
+ "title": "Tool Call Rate",
236
+ "id": 21,
237
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 15 },
238
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
239
+ "targets": [{
240
+ "expr": "rate(smithers_smithers_tool_calls_total[5m])",
241
+ "legendFormat": "Tool Calls / sec",
242
+ "refId": "A"
243
+ }],
244
+ "fieldConfig": {
245
+ "defaults": {
246
+ "custom": { "drawStyle": "line", "lineWidth": 2, "fillOpacity": 10 },
247
+ "color": { "mode": "fixed", "fixedColor": "purple" },
248
+ "unit": "ops"
249
+ }
250
+ },
251
+ "options": {
252
+ "tooltip": { "mode": "single" },
253
+ "legend": { "displayMode": "list", "placement": "bottom" }
254
+ }
255
+ },
256
+ {
257
+ "type": "heatmap",
258
+ "title": "Tool Duration",
259
+ "id": 22,
260
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 15 },
261
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
262
+ "targets": [{
263
+ "expr": "sum(increase(smithers_smithers_tool_duration_ms_bucket[5m])) by (le)",
264
+ "legendFormat": "{{le}}",
265
+ "refId": "A",
266
+ "format": "heatmap"
267
+ }],
268
+ "options": {
269
+ "calculate": false,
270
+ "yAxis": { "unit": "ms" },
271
+ "color": { "mode": "scheme", "scheme": "Blues", "steps": 64 },
272
+ "cellGap": 1
273
+ }
274
+ },
275
+
276
+ {
277
+ "type": "row",
278
+ "title": "Infrastructure",
279
+ "collapsed": false,
280
+ "gridPos": { "h": 1, "w": 24, "x": 0, "y": 23 },
281
+ "id": 30
282
+ },
283
+ {
284
+ "type": "timeseries",
285
+ "title": "HTTP Request Latency",
286
+ "id": 31,
287
+ "gridPos": { "h": 8, "w": 8, "x": 0, "y": 24 },
288
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
289
+ "targets": [
290
+ {
291
+ "expr": "histogram_quantile(0.50, sum(rate(smithers_smithers_http_request_duration_ms_bucket[5m])) by (le))",
292
+ "legendFormat": "p50",
293
+ "refId": "A"
294
+ },
295
+ {
296
+ "expr": "histogram_quantile(0.95, sum(rate(smithers_smithers_http_request_duration_ms_bucket[5m])) by (le))",
297
+ "legendFormat": "p95",
298
+ "refId": "B"
299
+ },
300
+ {
301
+ "expr": "histogram_quantile(0.99, sum(rate(smithers_smithers_http_request_duration_ms_bucket[5m])) by (le))",
302
+ "legendFormat": "p99",
303
+ "refId": "C"
304
+ }
305
+ ],
306
+ "fieldConfig": {
307
+ "defaults": {
308
+ "custom": { "drawStyle": "line", "lineWidth": 2, "fillOpacity": 5 },
309
+ "color": { "mode": "palette-classic" },
310
+ "unit": "ms"
311
+ }
312
+ },
313
+ "options": {
314
+ "tooltip": { "mode": "multi", "sort": "desc" },
315
+ "legend": { "displayMode": "list", "placement": "bottom" }
316
+ }
317
+ },
318
+ {
319
+ "type": "heatmap",
320
+ "title": "DB Query Duration",
321
+ "id": 32,
322
+ "gridPos": { "h": 8, "w": 8, "x": 8, "y": 24 },
323
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
324
+ "targets": [{
325
+ "expr": "sum(increase(smithers_smithers_db_query_ms_bucket[5m])) by (le)",
326
+ "legendFormat": "{{le}}",
327
+ "refId": "A",
328
+ "format": "heatmap"
329
+ }],
330
+ "options": {
331
+ "calculate": false,
332
+ "yAxis": { "unit": "ms" },
333
+ "color": { "mode": "scheme", "scheme": "Greens", "steps": 64 },
334
+ "cellGap": 1
335
+ }
336
+ },
337
+ {
338
+ "type": "timeseries",
339
+ "title": "VCS & Hot Reload",
340
+ "id": 33,
341
+ "gridPos": { "h": 8, "w": 8, "x": 16, "y": 24 },
342
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
343
+ "targets": [
344
+ {
345
+ "expr": "rate(smithers_smithers_hot_reloads[5m])",
346
+ "legendFormat": "Hot Reloads / sec",
347
+ "refId": "A"
348
+ },
349
+ {
350
+ "expr": "rate(smithers_smithers_hot_reload_failures[5m])",
351
+ "legendFormat": "Reload Failures / sec",
352
+ "refId": "B"
353
+ },
354
+ {
355
+ "expr": "histogram_quantile(0.95, sum(rate(smithers_smithers_vcs_duration_ms_bucket[5m])) by (le))",
356
+ "legendFormat": "VCS p95 (ms)",
357
+ "refId": "C"
358
+ }
359
+ ],
360
+ "fieldConfig": {
361
+ "defaults": {
362
+ "custom": { "drawStyle": "line", "lineWidth": 2, "fillOpacity": 10 },
363
+ "color": { "mode": "palette-classic" }
364
+ }
365
+ },
366
+ "options": {
367
+ "tooltip": { "mode": "multi", "sort": "desc" },
368
+ "legend": { "displayMode": "list", "placement": "bottom" }
369
+ }
370
+ },
371
+
372
+ {
373
+ "type": "row",
374
+ "title": "Approvals",
375
+ "collapsed": false,
376
+ "gridPos": { "h": 1, "w": 24, "x": 0, "y": 32 },
377
+ "id": 40
378
+ },
379
+ {
380
+ "type": "timeseries",
381
+ "title": "Approval Flow",
382
+ "id": 41,
383
+ "gridPos": { "h": 8, "w": 12, "x": 0, "y": 33 },
384
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
385
+ "targets": [
386
+ { "expr": "rate(smithers_smithers_approvals_requested[5m])", "legendFormat": "Requested", "refId": "A" },
387
+ { "expr": "rate(smithers_smithers_approvals_granted[5m])", "legendFormat": "Granted", "refId": "B" },
388
+ { "expr": "rate(smithers_smithers_approvals_denied[5m])", "legendFormat": "Denied", "refId": "C" }
389
+ ],
390
+ "fieldConfig": {
391
+ "defaults": {
392
+ "custom": { "drawStyle": "bars", "lineWidth": 1, "fillOpacity": 50 },
393
+ "color": { "mode": "palette-classic" },
394
+ "unit": "ops"
395
+ }
396
+ },
397
+ "options": {
398
+ "tooltip": { "mode": "multi" },
399
+ "legend": { "displayMode": "list", "placement": "bottom" }
400
+ }
401
+ },
402
+ {
403
+ "type": "timeseries",
404
+ "title": "HTTP Request Rate",
405
+ "id": 42,
406
+ "gridPos": { "h": 8, "w": 12, "x": 12, "y": 33 },
407
+ "datasource": { "type": "prometheus", "uid": "prometheus" },
408
+ "targets": [{
409
+ "expr": "rate(smithers_smithers_http_requests[5m])",
410
+ "legendFormat": "Requests / sec",
411
+ "refId": "A"
412
+ }],
413
+ "fieldConfig": {
414
+ "defaults": {
415
+ "custom": { "drawStyle": "line", "lineWidth": 2, "fillOpacity": 15, "gradientMode": "scheme" },
416
+ "color": { "mode": "fixed", "fixedColor": "green" },
417
+ "unit": "reqps"
418
+ }
419
+ },
420
+ "options": {
421
+ "tooltip": { "mode": "single" },
422
+ "legend": { "displayMode": "list", "placement": "bottom" }
423
+ }
424
+ },
425
+
426
+ {
427
+ "type": "row",
428
+ "title": "Traces",
429
+ "collapsed": true,
430
+ "gridPos": { "h": 1, "w": 24, "x": 0, "y": 41 },
431
+ "id": 50,
432
+ "panels": [
433
+ {
434
+ "type": "traces",
435
+ "title": "Recent Traces",
436
+ "id": 51,
437
+ "gridPos": { "h": 12, "w": 24, "x": 0, "y": 42 },
438
+ "datasource": { "type": "tempo", "uid": "tempo" },
439
+ "targets": [{
440
+ "datasource": { "type": "tempo", "uid": "tempo" },
441
+ "queryType": "traceqlSearch",
442
+ "limit": 20,
443
+ "tableType": "traces",
444
+ "filters": [
445
+ { "id": "service-name", "tag": "service.name", "operator": "=", "value": ["smithers"], "scope": "resource" }
446
+ ],
447
+ "refId": "A"
448
+ }]
449
+ }
450
+ ]
451
+ }
452
+ ]
453
+ }
@@ -0,0 +1,12 @@
1
+ apiVersion: 1
2
+
3
+ providers:
4
+ - name: default
5
+ orgId: 1
6
+ folder: ""
7
+ type: file
8
+ disableDeletion: false
9
+ updateIntervalSeconds: 30
10
+ allowUiUpdates: true
11
+ options:
12
+ path: /var/lib/grafana/dashboards
@@ -0,0 +1,49 @@
1
+ apiVersion: 1
2
+
3
+ datasources:
4
+ - name: Prometheus
5
+ type: prometheus
6
+ uid: prometheus
7
+ access: proxy
8
+ url: http://prometheus:9090
9
+ isDefault: true
10
+ editable: false
11
+ jsonData:
12
+ httpMethod: POST
13
+ exemplarTraceIdDestinations:
14
+ - name: traceID
15
+ datasourceUid: tempo
16
+
17
+ - name: Loki
18
+ type: loki
19
+ uid: loki
20
+ access: proxy
21
+ url: http://loki:3100
22
+ editable: false
23
+ jsonData:
24
+ maxLines: 1000
25
+
26
+ - name: Tempo
27
+ type: tempo
28
+ uid: tempo
29
+ access: proxy
30
+ url: http://tempo:3200
31
+ editable: false
32
+ jsonData:
33
+ tracesToLogs:
34
+ datasourceUid: loki
35
+ tags: ["service.name"]
36
+ mappedTags:
37
+ - key: service.name
38
+ value: service.name
39
+ mapTagNamesEnabled: false
40
+ spanStartTimeShift: "-1h"
41
+ spanEndTimeShift: "1h"
42
+ filterByTraceID: false
43
+ filterBySpanID: false
44
+ tracesToMetrics:
45
+ datasourceUid: prometheus
46
+ spanStartTimeShift: "-1h"
47
+ spanEndTimeShift: "1h"
48
+ nodeGraph:
49
+ enabled: true
@@ -0,0 +1,35 @@
1
+ auth_enabled: false
2
+
3
+ server:
4
+ http_listen_port: 3100
5
+
6
+ common:
7
+ instance_addr: 127.0.0.1
8
+ path_prefix: /loki
9
+ storage:
10
+ filesystem:
11
+ chunks_directory: /loki/chunks
12
+ rules_directory: /loki/rules
13
+ replication_factor: 1
14
+ ring:
15
+ kvstore:
16
+ store: inmemory
17
+
18
+ schema_config:
19
+ configs:
20
+ - from: 2020-10-24
21
+ store: tsdb
22
+ object_store: filesystem
23
+ schema: v13
24
+ index:
25
+ prefix: index_
26
+ period: 24h
27
+
28
+ limits_config:
29
+ allow_structured_metadata: true
30
+
31
+ ruler:
32
+ alertmanager_url: http://localhost:9093
33
+
34
+ analytics:
35
+ reporting_enabled: false