Spring Boot 4 Complete Guide · レッスン

MicrometerとPrometheusによるメトリクスとダッシュボード

Micrometerでアプリケーションメトリクスを公開し、Prometheusで収集して、Grafanaで傾向を可視化することで、完全なオブザーバビリティを実現します。

レッスン 4/413 ステップ

「MicrometerとPrometheusによるメトリクスとダッシュボード」はCoddyKit上の無料Spring Boot 4 Complete Guideレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはSpring Boot 4 Complete Guide学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Spring Boot 4 Complete Guideコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Beyond Logs and Traces

Logs tell you what happened and traces show request paths, but metrics reveal trends over time: request rates, error percentages, memory use. They complete the observability picture.

What Is Micrometer?

Micrometer is a metrics facade, like SLF4J but for metrics. You instrument once and export to many backends such as Prometheus or Datadog.

Wiring in Prometheus

Add the Prometheus registry dependency and Actuator exposes a scrape endpoint automatically.

<dependency>
  <groupId>io.micrometer</groupId>
  <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

Exposing the Endpoint

Enable the Prometheus endpoint so metrics are served at /actuator/prometheus in a format Prometheus understands.

management.endpoints.web.exposure.include=health,prometheus

The Three Core Meter Types

Most metrics fall into three types.

  • Counter — only goes up (requests served)
  • Gauge — goes up and down (queue size)
  • Timer — measures durations

Creating a Counter

Register a counter and increment it when an event occurs.

Counter c = registry.counter("orders.placed");
c.increment();

Timing Code

A Timer records how long operations take, giving you latency percentiles.

Timer t = registry.timer("checkout.duration");
t.record(() -> processCheckout());

Tags for Dimensionality

Add tags (labels) to slice metrics by endpoint, status, or region. Avoid high-cardinality tags like user IDs, which explode storage.

registry.counter("http.requests", "status", "200").increment();

How Prometheus Scrapes

Prometheus periodically pulls the /actuator/prometheus endpoint and stores time-series data, which you can then query with PromQL.

Visualizing with Grafana

Grafana connects to Prometheus as a data source and renders dashboards. Spring Boot has ready-made dashboards for JVM and HTTP metrics.

Alerting on Metrics

Define alert rules, for example error rate above 5 percent, so the team is notified before users complain. Metrics turn into proactive operations.

Quick Check

Test your understanding of metrics and observability.

Recap

You exposed metrics via Micrometer and the Prometheus Actuator endpoint, learned counters, gauges, and timers, used tags wisely, and visualized and alerted with Prometheus and Grafana.

無料で開始

AI チューターと学ぶ Java — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
21
レッスン
84

よくある質問

「MicrometerとPrometheusによるメトリクスとダッシュボード」レッスンは無料ですか?

はい。「MicrometerとPrometheusによるメトリクスとダッシュボード」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Spring Boot 4 Complete Guideコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Spring Boot 4 Complete Guideコースには全4レッスンが含まれています。

「MicrometerとPrometheusによるメトリクスとダッシュボード」で何を学びますか?

Micrometerでアプリケーションメトリクスを公開し、Prometheusで収集して、Grafanaで傾向を可視化することで、完全なオブザーバビリティを実現します。 ブラウザで直接実行するハンズオンコードでSpring Boot 4 Complete Guideを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Spring Boot 4 Complete Guideを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのSpring Boot 4 Complete Guideは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「MicrometerとPrometheusによるメトリクスとダッシュボード」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このSpring Boot 4 Complete Guideレッスンでコードを書いて実行できますか?

はい。すべてのSpring Boot 4 Complete Guideレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. Kubernetesオーケストレーションの基礎
  2. SleuthとZipkinによる分散トレーシング
  3. ヘルスチェックとレジリエンスパターン
  4. MicrometerとPrometheusによるメトリクスとダッシュボード
← Spring Boot 4 Complete Guideに戻る