0Pricing
MLOps Academy · Ders

Metrikleri Prometheus ile Sunun

İstek hızını, hataları ve süreyi izleyin.

Metrikleri Prometheus ile Sunun, CoddyKit'te ücretsiz bir MLOps Academy dersidir. Bu, 4 dersinin 2. 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, MLOps Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. MLOps Academy kursu toplamda 4 dersten oluşur.

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

Logs vs Metrics

Logs tell the story of one request. Metrics are numbers aggregated over many requests, so you can see trends like rate and error count at a glance. 📈

Meet Prometheus

Prometheus is the standard tool for collecting these numbers. Your service exposes metrics, and Prometheus regularly reads them for you.

Pull, Not Push

Prometheus uses a pull model: it scrapes a metrics URL on your service every few seconds. Your job is just to expose that endpoint.

The Python Client

The prometheus_client library lets your Python service define and serve metrics with almost no boilerplate.

from prometheus_client import Counter, Histogram, start_http_server

A Counter Counts Up

A Counter only ever increases. It is perfect for totals like how many predictions your model has served since startup.

predictions = Counter("predictions_total", "Total predictions served")
predictions.inc()

A Histogram Times Things

A Histogram records a distribution, ideal for request duration. It buckets values so you can later read p50 and p99 latency.

latency = Histogram("predict_seconds", "Prediction latency in seconds")
with latency.time():
    model.predict(x)

Labels Add Dimensions

Labels split one metric by category, like model version or status. Then you can compare error rates per version side by side.

errors = Counter("errors_total", "Errors", ["model"])
errors.labels(model="churn-v3").inc()

Expose the /metrics Endpoint

Prometheus scrapes a path conventionally named /metrics. The client can serve it for you on its own port.

start_http_server(8000)
# metrics now live at http://localhost:8000/metrics

What a Metric Looks Like

On that endpoint each metric is plain text: a name, optional labels, and a value. Prometheus reads this format on every scrape.

predictions_total 1423.0
predict_seconds_bucket{le="0.1"} 1390.0

Configure the Scrape

Tell Prometheus where to look by adding your service as a target in its config. Then it pulls metrics on a fixed interval.

scrape_configs:
  - job_name: model-api
    static_configs:
      - targets: ["model-api:8000"]

Pick the Right Type

Rule of thumb: use a Counter for things that only grow, a Histogram for durations, and a Gauge for values that go up and down.

Quick Check

You want to track request latency so you can later read p99. Which Prometheus metric type fits?

Recap

You exposed a /metrics endpoint with prometheus_client, using Counters and Histograms plus labels. Prometheus now pulls live numbers from your model service. ✅

Sıkça Sorulan Sorular

“Metrikleri Prometheus ile Sunun” dersi ücretsiz mi?

Evet — “Metrikleri Prometheus ile Sunun” 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 MLOps Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. MLOps Academy kursu toplamda 4 dersten oluşur.

“Metrikleri Prometheus ile Sunun” dersinde ne öğreneceğim?

İstek hızını, hataları ve süreyi izleyin. MLOps Academy 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.

MLOps Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te MLOps Academy, 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 2. dersidir.

“Metrikleri Prometheus ile Sunun” 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 MLOps Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her MLOps Academy 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. Tahminler için Yapılandırılmış Günlükler
  2. Metrikleri Prometheus ile Sunun
  3. Bir Grafana Panosu Oluşturun
  4. Gecikme ve Hata Ani Artışları için Uyarı Verin
← MLOps Academy Sayfasına Dön