liveBook · Manning

Spring.ai.chat.client metric

As explained in Spring AI in Action

The spring.ai.chat.client metric records counts and durations of operations performed through ChatClient.

The spring.ai.chat.client metric records aggregate counts and durations for operations flowing through Spring AI’s ChatClient. Its measurements accumulate since application startup, while spring.ai.chat.client.active reports operations currently in progress. section 9.1.4 section 9.1

Use the metric to:

  • Count ChatClient operations and inspect their total duration. section 9.1.4
  • Separate streaming from nonstreaming requests with the spring.ai.chat.client.stream tag. section 9.1.4
  • Query the metric through the Actuator metrics endpoint after exposing the metrics endpoint. section 9.1

Filtering streaming operations

An endpoint response showing 23 operations can be filtered by spring.ai.chat.client.stream:true to identify 11 streaming operations; the remaining 12 are nonstreaming.

How Spring AI in Action covers it

How deep it goes
Explains aggregate and active measurements, available tags, and streaming filters, but does not detail metric implementation internals.
Examples
Uses Actuator JSON responses showing one request, 23 requests, and an 11-request streaming subset.
What it assumes
Assumes Spring AI ChatClient usage and requires Spring Boot Actuator with the metrics endpoint exposed.
What you can do after
Diagnose ChatClient usage with Actuator by counting operations, measuring elapsed time, and filtering streaming requests.
How it connects
Connects ChatClient metrics with Actuator, active metrics, streaming requests, and advisor metrics.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring AI in Action. The section links point to the parts of the book it draws on.