You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Add more explanation in observability documentation about metrics
* Document base → Prometheus name mapping (gen_ai.client.operation → _seconds_count|sum|max, _active_count)
* Explain Active vs Completed (LongTaskTimer vs Timer)
* Add References to OTel/Micrometer/Prometheus specs
Auto-cherry-pick to 1.0.x
Fixes#4222
Signed-off-by: heechann <[email protected]>
Copy file name to clipboardExpand all lines: spring-ai-docs/src/main/antora/modules/ROOT/pages/observability/index.adoc
+158Lines changed: 158 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -363,3 +363,161 @@ Spring AI supports logging vector search response data, useful for troubleshooti
363
363
|===
364
364
365
365
WARNING: If you enable logging of the vector search response data, there's a risk of exposing sensitive or private information. Please, be careful!
366
+
367
+
== More Metrics Reference
368
+
369
+
This section documents the metrics emitted by Spring AI components as they appear in Prometheus.
370
+
371
+
=== Metric Naming Conventions
372
+
373
+
Spring AI uses Micrometer. Base metric names use dots (e.g., `gen_ai.client.operation`), which Prometheus exports with underscores and standard suffixes:
374
+
375
+
* **Timers** → `<base>_seconds_count`, `<base>_seconds_sum`, `<base>_seconds_max`, and (when supported) `<base>_active_count`
376
+
* **Counters** → `<base>_total` (monotonic)
377
+
378
+
[NOTE]
379
+
====
380
+
The following shows how base metric names expand to Prometheus time series.
381
+
382
+
[cols="2,3", options="header", stripes=even]
383
+
|===
384
+
| Base metric name | Exported time series
385
+
| `gen_ai.client.operation` |
386
+
`gen_ai_client_operation_seconds_count` +
387
+
`gen_ai_client_operation_seconds_sum` +
388
+
`gen_ai_client_operation_seconds_max` +
389
+
`gen_ai_client_operation_active_count`
390
+
| `db.vector.client.operation` |
391
+
`db_vector_client_operation_seconds_count` +
392
+
`db_vector_client_operation_seconds_sum` +
393
+
`db_vector_client_operation_seconds_max` +
394
+
`db_vector_client_operation_active_count`
395
+
|===
396
+
====
397
+
398
+
==== References
399
+
400
+
* OpenTelemetry — https://opentelemetry.io/docs/specs/semconv/gen-ai/[Semantic Conventions for Generative AI (overview)]
0 commit comments