İzleme, Günlükleme ve Gözlemlenebilirlik
Günlükleri okuyarak, temel ölçümleri izleyerek, Edge Functions için izleme ekleyerek ve küçük sorunlar kesintiye dönüşmeden önce uyarılar kurarak üretimdeki Supabase arka ucunuzu sağlıklı tutun.
İzleme, Günlükleme ve Gözlemlenebilirlik, CoddyKit'te ücretsiz bir Supabase Backend as a Service 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, Supabase Backend as a Service öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Supabase Backend as a Service kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Why Observability Matters
Deploying is only half the job. Once your backend serves real traffic you need to see what it is doing. Observability is the practice of understanding system state from its outputs.
- Logs tell you what happened
- Metrics tell you how much and how fast
- Traces tell you where time was spent
The Supabase Logs Explorer
Supabase exposes logs for every service in the dashboard under Logs: API gateway, Postgres, Auth, Storage, and Edge Functions. Each is queryable with SQL-like syntax.
Filtering by status code and path quickly surfaces failing requests.
Querying Logs
The Logs Explorer accepts SQL over structured log events. Here we count API errors grouped by path over the last hour.
select path, count(*) as errors
from edge_logs
where status_code >= 500
group by path
order by errors desc;Structured Logging in Edge Functions
Inside Edge Functions, prefer structured JSON logs over plain strings. They are far easier to filter and aggregate later.
console.log(JSON.stringify({
level: 'info',
event: 'order_created',
orderId: order.id,
userId: user.id,
durationMs: Date.now() - start
}));Log Levels
Use consistent levels so you can filter noise from signal.
debugfor development detailinfofor normal eventswarnfor recoverable problemserrorfor failures needing attention
In production, avoid logging at debug to control cost and volume.
Key Database Metrics
Watch a handful of Postgres metrics closely:
- Active connections vs the pool limit
- Cache hit ratio (aim above 99%)
- Slow query count
- Disk and CPU usage
Supabase surfaces these on the Reports page.
Finding Slow Queries
Enable pg_stat_statements to see which queries consume the most total time. This is the single most useful tool for performance triage.
select query, calls, mean_exec_time, total_exec_time
from pg_stat_statements
order by total_exec_time desc
limit 10;Never Log Secrets
Logs are persisted and often shared. Never write passwords, tokens, full card numbers, or service-role keys into logs.
- Redact sensitive fields before logging
- Log identifiers, not raw payloads
- Treat log access as a security boundary
Correlating Requests
Attach a request ID to every log line in a function so you can reconstruct a single request's full journey across logs.
const requestId = crypto.randomUUID();
console.log(JSON.stringify({ requestId, event: 'start' }));
// ... work ...
console.log(JSON.stringify({ requestId, event: 'done' }));Alerting
Logs you never look at help no one. Set up alerts for the conditions that matter: error-rate spikes, connection exhaustion, disk nearing capacity.
Forward logs to an external sink (e.g. via webhooks or a log drain) when you need richer alerting than the dashboard provides.
Retention and Cost
Logs cost money and storage. Decide a retention policy deliberately.
- Keep high-value audit logs longer
- Sample or drop chatty debug logs
- Archive to cheap storage before deletion if needed for compliance
Quick Check
Test your observability knowledge.
Recap
You now have a foundation for production observability.
- Use the Logs Explorer and structured JSON logs
- Apply consistent log levels and request IDs
- Track connections, cache hit ratio, and slow queries
- Use
pg_stat_statementsfor performance triage - Never log secrets; set alerts and a retention policy
Sıkça Sorulan Sorular
“İzleme, Günlükleme ve Gözlemlenebilirlik” dersi ücretsiz mi?
Evet — “İzleme, Günlükleme ve Gözlemlenebilirlik” 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 Supabase Backend as a Service kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Supabase Backend as a Service kursu toplamda 4 dersten oluşur.
“İzleme, Günlükleme ve Gözlemlenebilirlik” dersinde ne öğreneceğim?
Günlükleri okuyarak, temel ölçümleri izleyerek, Edge Functions için izleme ekleyerek ve küçük sorunlar kesintiye dönüşmeden önce uyarılar kurarak üretimdeki Supabase arka ucunuzu sağlıklı tutun. Supabase Backend as a Service 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.
Supabase Backend as a Service öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Supabase Backend as a Service, 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.
“İzleme, Günlükleme ve Gözlemlenebilirlik” 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 Supabase Backend as a Service dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Supabase Backend as a Service 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
- Ortam Yönetimi ve CI/CD
- Yedekleme, Geri Yükleme ve Felaket Kurtarma
- Güvenlik Denetimi ve En İyi Uygulamalar
- İzleme, Günlükleme ve Gözlemlenebilirlik