Integrating LLM Cost with Enterprise APMs: Sentry, Datadog, New Relic Patterns
If you have existing APM (Sentry, Datadog, New Relic), you can extend them for LLM telemetry instead of using a separate tool. This lesson covers LLM-specific features in 3 enterprise APMs, custom metric patterns, and cost attribution strategies.
Şükrü Yusuf KAYA
18 min read
Advanced🏢 Mevcut yatırımını koruyarak ileriye git
Şirketin zaten Datadog/Sentry/New Relic kullanıyorsa, LLM observability için ayrı bir tool eklemek yerine mevcut araçları extend etmek genelde daha mantıklı. Bu derste 3 enterprise APM için pattern'leri görüyoruz.
1️⃣ Datadog LLM Observability#
Datadog 2024 sonu LLM Observability modülünü çıkardı. Mevcut Datadog APM'in üzerine.
Feature seti#
- ✅ Built-in tracing for OpenAI, Anthropic, Cohere, Mistral
- ✅ Cost tracking (per provider)
- ✅ Cost attribution (Datadog's tag system)
- ✅ Eval framework (basic LLM-as-judge)
- ✅ Prompt drift detection
- ⚠️ Self-host Datadog yok (cloud-only)
Fiyatlandırma#
Datadog LLM Observability eklentisi: **1.27 / 10K events.
Entegrasyon#
from ddtrace.llmobs import LLMObs LLMObs.enable( ml_app="my-llm-product", api_key=os.environ["DD_API_KEY"], site=os.environ["DD_SITE"], ) # OpenAI auto-instrumented response = openai.chat.completions.create(...)
Avantaj/Dezavantaj#
✅ Mevcut Datadog dashboard'ına entegre
✅ Cross-service correlation (DB + cache + LLM aynı trace)
✅ Otomatik PII redaction (enterprise)
❌ Cost on top of existing Datadog (genelde pahalı)
❌ Self-host yok — KVKK için sınır
2️⃣ Sentry AI Monitoring#
Sentry 2024 sonu AI Monitoring feature'ı ekledi. Error tracking + performance + LLM cost.
Feature seti#
- ✅ Tracing (OpenAI, Anthropic, etc.)
- ✅ Cost tracking
- ✅ AI-specific error capture (token limit, rate limit, content filter)
- ✅ Performance overlay (latency p95)
- ✅ Self-host (Sentry'nin enterprise self-host'u)
- ❌ Eval framework yok
- ❌ Prompt management yok
Fiyatlandırma#
Sentry AI Monitoring dahil Team plan ($26/ay/dev) ve üstü. Volume-based event pricing.
Entegrasyon#
import sentry_sdk sentry_sdk.init( dsn="...", integrations=[ sentry_sdk.integrations.openai.OpenAIIntegration(), sentry_sdk.integrations.anthropic.AnthropicIntegration(), ], enable_tracing=True, )
Avantaj/Dezavantaj#
✅ Error tracking + LLM monitoring tek araç
✅ Self-host enterprise opsiyonu
✅ Türkiye'deki birçok SaaS zaten kullanıyor
❌ LLM-spesifik feature'lar Datadog'dan daha sınırlı
❌ Cost dashboard basit, deep-dive zayıf
3️⃣ New Relic AI Monitoring#
New Relic'in geleneksel APM'i artık LLM destekli.
Feature seti#
- ✅ Tracing
- ✅ Cost tracking
- ✅ Model performance benchmarks
- ✅ Token usage analytics
- ✅ Built-in alerts
- ⚠️ Self-host enterprise-only
Fiyatlandırma#
New Relic'in standart APM pricing'i geçerli — Compute Unit (CU) bazlı. LLM monitoring ek bir maliyet eklemez. Bu, mevcut New Relic müşterileri için avantaj.
Entegrasyon#
import newrelic.agent newrelic.agent.initialize("newrelic.ini") # OpenAI auto-instrumented (newrelic.ai modülü)
Hızlı Karşılaştırma#
| Özellik | Datadog | Sentry | New Relic | Langfuse (referans) |
|---|---|---|---|---|
| LLM-specific UI | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Cross-service correlation | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| Cost dashboard | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Eval framework | ⭐⭐ | ⭐ | ⭐⭐ | ⭐⭐⭐⭐⭐ |
| Self-host | ❌ | ✅ ent | ✅ ent | ✅ free |
| Fiyat (yüksek volume) | 💸💸💸 | 💸💸 | 💸💸 | 💸 |
Karar#
| Senaryo | Tavsiye |
|---|---|
| Mevcut Datadog kullanıyorsun + cost tracking yeter | Datadog LLM Observability |
| Mevcut Sentry kullanıyorsun + ucuz yeterli | Sentry AI Monitoring |
| Eval framework + prompt management gerekli | Langfuse paralel kur |
| KVKK + tam kontrol | Langfuse self-host veya OTel + ClickHouse |
Hybrid Pattern — En Yaygın Production Setup#
Aslında çoğu olgun ekibin yaptığı: iki araç birden.
[App] → LiteLLM proxy ↓ callback 1: Datadog (cross-service trace, error tracking) ↓ callback 2: Langfuse (LLM-specific eval, prompt mgmt, cost dashboard)
LiteLLM birden çok callback destekliyor:
import litellm litellm.success_callback = [ "datadog", "langfuse", ] litellm.failure_callback = [ "datadog", "langfuse", "sentry", ]
Bu pattern'ın çakışması yok — her araç güçlü olduğu yerde değer üretiyor.
Custom Metric Pattern'leri#
Bazı LLM-spesifik metric'leri APM'lerine kendin ekleyebilirsin (built-in feature olmasa bile).
Datadog custom metric örneği#
from datadog import statsd # Her LLM çağrısının sonunda statsd.gauge( "llm.cost_per_request", cost_usd, tags=[f"model:{model}", f"feature:{feature}", f"user:{user_id}"], ) statsd.histogram( "llm.tokens.input", input_tokens, tags=[f"model:{model}", f"cached:{is_cached}"], ) statsd.histogram( "llm.tokens.output", output_tokens, tags=[f"model:{model}"], ) statsd.increment( "llm.cache_hit" if cache_hit else "llm.cache_miss", tags=[f"model:{model}"], )
Sentry custom metric#
sentry_sdk.metrics.distribution( "llm.cost_per_request", cost_usd, unit="usd", tags={"model": model, "feature": feature}, )
Modül 3 Özet#
Bu modülde gördük:
- Telemetry felsefe — ölçemediğin neyi optimize edemezsin
- Usage objesi anatomi — 3 sağlayıcı, 3 farklı format
- Streaming nuance'leri — production'da 7 yaygın hata
- Araç karşılaştırma — Langfuse, Helicone, LangSmith, Phoenix, OTel
- Self-hosted stack — ClickHouse + Grafana ile maksimum kontrol
- Enterprise APM entegrasyonu — Datadog, Sentry, New Relic pattern'leri
Şimdi gerçekten ölçebiliyorsun. Modül 4'te bu telemetry'i cost attribution'a bağlayacağız: hangi feature, hangi kullanıcı, hangi takım ne kadar harcatıyor — ve bunu fiyatlandırmaya yansıtmak.
🚀 Modül 4'e geçiyoruz
Modül 4: Maliyet Atfı (Cost Attribution). Telemetry'in iş tarafına geçiyoruz. Per-tenant chargeback, per-feature ekonomik analiz, abuse detection, ve LiteLLM virtual keys mimari. Bir sonraki modülde.
Frequently Asked Questions
Yes, common pattern. Datadog for cross-service traces (DB+cache+LLM in same trace), Langfuse for LLM-specific eval/prompt management. Both feed from the same source via LiteLLM callbacks, no conflict. On cost: Langfuse free tier + Datadog's existing cost + $25/host/mo LLM add-on.
Yorumlar & Soru-Cevap
(0)Yorum yazmak için giriş yap.
Yorumlar yükleniyor...
Related Content
Module 0: Why Cost, Why Now?
The AI Cost Explosion: Why Token Prices Fell 96% from 2022 to 2026 — Yet Bills Grew 40×
Start LearningModule 0: Why Cost, Why Now?
Unit Economics Vocabulary: COGS, Gross Margin, $/User, Contribution Margin — 9 Financial Concepts Every AI Engineer Must Know
Start LearningModule 0: Why Cost, Why Now?