0Pricing
API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) · Ders

Actuator ve Prometheus ile Metrikleri Sunma

Ağ geçidi durumunu ve rota metriklerini Spring Boot Actuator üzerinden sunun; tam gözlemlenebilirlik için bunları Prometheus ile toplayın.

Actuator ve Prometheus ile Metrikleri Sunma, CoddyKit'te ücretsiz bir API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Seeing Inside the Gateway

Tracing shows individual request journeys, but you also need aggregate metrics: request rates, error counts, latency. Spring Boot Actuator plus Micrometer expose these for the gateway.

Adding Actuator

The Actuator starter adds production-ready endpoints for health, info, and metrics.

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

Exposing Endpoints

By default most endpoints are hidden over HTTP. Expose the ones you need explicitly.

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus,gateway

The Gateway Endpoint

The gateway actuator endpoint lists all active routes and their configuration, invaluable for debugging routing in a running system.

curl http://localhost:8080/actuator/gateway/routes

Micrometer Metrics

Micrometer is the metrics facade. The gateway records timers like spring.cloud.gateway.requests tagged by route id, status, and method.

Enabling Gateway Metrics

Make sure metric collection for the gateway is turned on so per-route timers are recorded.

spring:
  cloud:
    gateway:
      metrics:
        enabled: true

The Prometheus Registry

Add the Prometheus registry so metrics are published in Prometheus' text format at /actuator/prometheus.

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

Inspecting the Scrape Endpoint

Hit the endpoint to see raw metrics. Prometheus will scrape this same URL on a schedule.

curl http://localhost:8080/actuator/prometheus

Configuring a Scrape Job

Point Prometheus at the gateway with a scrape job describing the path and target.

scrape_configs:
  - job_name: gateway
    metrics_path: /actuator/prometheus
    static_configs:
      - targets: ['gateway:8080']

Useful Metrics to Watch

Key signals include request count, error rate (5xx), and p95 latency per route. Alert when error rate or latency crosses a threshold.

  • spring_cloud_gateway_requests_seconds_count
  • spring_cloud_gateway_requests_seconds_max

Securing the Endpoints

Actuator endpoints can leak internals. In production restrict them to an internal network or protect them with authentication.

management:
  endpoints:
    web:
      base-path: /internal/actuator

Quick Check

Which actuator endpoint exposes metrics in a format Prometheus can scrape?

Recap

You made the gateway observable:

  • Actuator exposes health, metrics, and the gateway route view
  • Micrometer records per-route timers
  • The Prometheus registry serves /actuator/prometheus
  • Prometheus scrapes and you alert on errors and latency

With tracing plus metrics you have end-to-end visibility into gateway traffic.

Sıkça Sorulan Sorular

“Actuator ve Prometheus ile Metrikleri Sunma” dersi ücretsiz mi?

Evet — “Actuator ve Prometheus ile Metrikleri Sunma” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.

“Actuator ve Prometheus ile Metrikleri Sunma” dersinde ne öğreneceğim?

Ağ geçidi durumunu ve rota metriklerini Spring Boot Actuator üzerinden sunun; tam gözlemlenebilirlik için bunları Prometheus ile toplayın. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway), başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“Actuator ve Prometheus ile Metrikleri Sunma” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersinde kod yazıp çalıştırabilir miyim?

Evet. Her API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. JWT Kimlik Doğrulama ve Yetkilendirme
  2. Sleuth/Zipkin ile Dağıtık İzleme
  3. Config Server ile Merkezî Yapılandırma
  4. Actuator ve Prometheus ile Metrikleri Sunma
← API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) Sayfasına Dön