liveBook · Manning

Prometheus

As explained in Spring AI in Action

Prometheus is an open-source monitoring system that collects and stores time-series metrics and supports querying and alerting.

Prometheus is an open-source monitoring and alerting toolkit that collects application metrics through Micrometer, stores them as time series, and supports querying and visualization. In a Spring Boot application, it consumes metrics exposed by Actuator, including Spring AI operations. section 9.2 section 9.5

A typical Spring Boot integration proceeds as follows:

  • Add the Prometheus Micrometer registry dependency and expose the Actuator prometheus endpoint. section 9.2
  • Run a Prometheus instance, commonly with Docker Compose during development. section 9.2
  • Configure a scrape job for /actuator/prometheus, using a 15-second scrape interval in the example application. section 9.2
  • Query metrics by name or tag, then use Grafana to assemble interactive dashboards from the Prometheus data. section 9.1.4 section 9.3

Monitoring Spring AI chat operations

The spring.ai.chat.client metric reports counts and timing measurements for ChatClient operations. Its tags distinguish streaming interactions, errors, and the Spring AI component; Prometheus can display these values as tables or time-series graphs. section 9.1.4 section 9.2

global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: 'scrapeBoardGameBuddy'
    metrics_path: '/actuator/prometheus'
    scrape_interval: 15s
    static_configs:
      - targets: ['host.docker.internal:8080']

Use the scrape configuration to connect Prometheus to the application's Actuator endpoint and collect metrics at regular intervals. section 9.2

How Spring AI in Action covers it

How deep it goes
Explains dependency, endpoint, Docker Compose, and scrape configuration, then stops short of tracing internals.
Examples
Uses Spring AI ChatClient and advisor metrics, HTTP metric queries, Docker Compose services, and Grafana dashboards.
What it assumes
Assumes a Spring Boot application with Actuator and Micrometer metrics, while providing explicit dependency and container configuration.
What you can do after
Operate/configure Prometheus to scrape Actuator metrics and inspect Spring AI activity through queries and Grafana dashboards.
How it connects
Connects Micrometer, Spring Boot Actuator, Grafana, Docker Compose, and time-series metrics.

Also explained in

Compare how 8 books explain Prometheus →

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.