Covers the pull (Prometheus scrape) and push (OTLP, Azure Monitor exporter) models, self-hosted Prometheus and Grafana versus Azure Monitor managed Prometheus, Azure Managed Grafana and Application Insights metrics, PromQL versus KQL, cardinality limits and cost drivers, and a decision framework.
Prometheus pulls: it scrapes a /metrics endpoint on each target every 15 to 60 seconds and stores each metric-plus-label combination as a time series, queried with PromQL; Grafana draws the dashboards. Azure Monitor is push: the Azure Monitor OpenTelemetry exporter or an agent sends metrics to Application Insights (queried with KQL) or to Azure Monitor managed Prometheus, which keeps PromQL but removes the servers you would otherwise run, and pairs with Azure Managed Grafana.
In all of them cardinality is the cost driver: self-hosted Prometheus pays in memory and disk per active series, managed Prometheus bills per sample ingested, and Log Analytics bills per GB.
On AKS I'd usually pick managed Prometheus plus Grafana for metrics and Application Insights for traces and logs; the trade-off is that you then run two query languages.
"The first difference is who initiates. Prometheus is pull: each service exposes
/metrics, and Prometheus scrapes it every 15 to 60 seconds. That gives you a free health signal, theupmetric, and service discovery in Kubernetes finds pods automatically. Its weakness is short-lived things, a job that finishes between scrapes is never seen. Azure Monitor and OTLP are push: the OpenTelemetry SDK aggregates in process and sends every 60 seconds by default, which suits App Service, Functions and jobs, and goes through firewalls easily.Storage and query differ too. Prometheus keeps every metric-plus-label combination as a separate series in its local time-series database, queried with PromQL, and it's brilliant at rates and
histogram_quantile. But one Prometheus server doesn't do long retention or high availability on its own; you add Thanos or Mimir, or you use a managed service. Azure Monitor managed Prometheus is exactly that: an Azure Monitor workspace that accepts Prometheus metrics from the AKS add-on, keeps PromQL and recording rules, and you visualise it with Azure Managed Grafana. Application Insights metrics are different again: OpenTelemetry metrics land incustomMetrics, pre-aggregated per minute, histograms arrive as count, sum, min and max, and you query them with KQL next to your requests and traces.For example, at [company] we had [40] services on AKS. We kept Application Insights for traces and logs, moved metrics to managed Prometheus with Grafana dashboards, and [the metrics bill dropped by x% and dashboards loaded faster], because pre-aggregated series are much cheaper than metrics derived from logs.
The mistake I see is choosing by tool popularity. Cardinality costs the same in every option, just in a different currency: memory in self-hosted Prometheus, samples in managed Prometheus, gigabytes in Log Analytics."
| Pull (Prometheus scrape) | Push (OTLP, Azure Monitor exporter) | |
|---|---|---|
| Who starts | Prometheus server | The application |
| Target health | Free (up == 0 when the scrape fails) |
Need a heartbeat or absence alert |
| Short-lived jobs | Missed between scrapes (Pushgateway workaround) | Fine, flush on shutdown |
| Network | Server must reach every pod | App needs outbound only |
| Discovery | Kubernetes service discovery, ServiceMonitor/PodMonitor |
Resource attributes identify the source |
| Self-hosted Prometheus + Grafana | Azure Monitor managed Prometheus + Azure Managed Grafana | Application Insights metrics | |
|---|---|---|---|
| Query | PromQL | PromQL | KQL |
| Who runs it | You (HA, storage, upgrades) | Microsoft | Microsoft |
| Retention | What your disk/Thanos/Mimir allows | 18 months in the workspace | Log Analytics retention settings |
| Cost driver | Active series × memory and disk | Samples ingested + samples queried | GB ingested and retention |
| Percentiles | histogram_quantile on buckets |
Same | From requests raw data; metric histograms are count/sum/min/max |
| Best for | Multi-cloud, on-prem, full control | AKS on Azure | App Service/Functions, correlation with traces |
A team on AKS was charting request rates with KQL over requests, ingesting about [200] GB a month. Moving RED dashboards to managed Prometheus series from http.server.request.duration kept the same panels at a fraction of the ingestion, and freed them to sample traces at 20% without losing accurate rates.
Checks that the candidate understands how metrics systems actually collect, store and bill, and can make a reasoned platform choice.
Green flags
up metric, short-lived jobs)Red flags
A time series is identified by a metric name plus a set of label key/value pairs:
http_server_request_duration_seconds_bucket{service_name="orders-api", http_route="/orders/{id}", http_response_status_code="200", le="0.25"} 1843
Every distinct label combination is a separate series with its own chunk in memory. Prometheus keeps the last ~2 hours of samples in memory (the head block), then compacts to disk. A commonly quoted rule of thumb is a few kilobytes of memory per active series, so 5 million series need tens of gigabytes of RAM. That is why cardinality, not sample rate, decides cost.
pod :8080/metrics ◄── scrape every 30 s ── Prometheus (or ama-metrics add-on on AKS)
▲ │ remote write
ServiceMonitor / PodMonitor / annotations ▼
long-term store (Thanos, Mimir,
Azure Monitor workspace) ──► Grafana
On AKS, enabling managed Prometheus deploys the ama-metrics agent, which scrapes cluster components and, with configuration, your pods, then sends samples to an Azure Monitor workspace.
.NET app (OpenTelemetry SDK) ── OTLP every 60 s ──► OpenTelemetry Collector ──┬► Prometheus remote write / OTLP receiver
├► Azure Monitor exporter
└► other back ends
The Collector lets you drop labels, rename metrics and fan out to several back ends without redeploying services. Prometheus 3.x can also accept OTLP directly when started with its OTLP receiver enabled.
The Azure Monitor OpenTelemetry exporter sends custom metrics as pre-aggregated values into customMetrics (value, valueCount, valueSum, valueMin, valueMax, customDimensions). Histograms lose their buckets, which is why percentiles in Application Insights come from the requests and dependencies tables. Standard metrics (request rate, failures, duration) are also pre-aggregated by the exporter, so they stay accurate even when traces are sampled.
# PromQL: 5xx ratio per service
sum by (service_name) (rate(http_server_request_duration_seconds_count{http_response_status_code=~"5.."}[5m]))
/ sum by (service_name) (rate(http_server_request_duration_seconds_count[5m]))
// KQL: 5xx ratio per role from requests
requests
| where timestamp > ago(1h)
| summarize ratio = 100.0 * countif(toint(resultCode) >= 500) / count() by cloud_RoleName, bin(timestamp, 5m)
PromQL works on pre-aggregated series (fast, cheap, fixed dimensions). KQL works on events (any field, slower and paid by volume).
| Option | What a new label with 1,000 values does |
|---|---|
| Self-hosted Prometheus | 1,000× the series: memory, slower queries, possible OOM |
| Managed Prometheus | 1,000× the samples ingested and queried each interval |
Application Insights customMetrics |
More rows per minute, more GB; custom dimensions have documented limits |
topk(10, count by (__name__) ({__name__=~".+"})) to see which metrics have the most series.prometheus_tsdb_head_series climb.customMetrics.The same service wired for pull (Prometheus scrape) or push (OTLP to a Collector, or Azure Monitor):
// Program.cs (.NET 10)
using Azure.Monitor.OpenTelemetry.AspNetCore;
using OpenTelemetry.Metrics;
var builder = WebApplication.CreateBuilder(args);
var backend = builder.Configuration["Telemetry:Backend"] ?? "otlp";
var otel = builder.Services.AddOpenTelemetry()
.ConfigureResource(r => r.AddService("orders-api"))
.WithMetrics(m =>
{
m.AddAspNetCoreInstrumentation().AddHttpClientInstrumentation().AddRuntimeInstrumentation();
if (backend == "prometheus")
m.AddPrometheusExporter(); // pull: exposes /metrics for scraping
else if (backend == "otlp")
m.AddOtlpExporter(); // push: to a Collector every 60 s by default
});
if (backend == "azuremonitor")
otel.UseAzureMonitor(); // push: to Application Insights (connection string from config)
var app = builder.Build();
if (backend == "prometheus")
app.MapPrometheusScrapingEndpoint(); // GET /metrics
app.MapGet("/", () => "ok");
app.Run();
# ServiceMonitor (Prometheus Operator) so Prometheus discovers and scrapes the pods
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: orders-api
spec:
selector:
matchLabels: { app: orders-api }
endpoints:
- port: http
path: /metrics
interval: 30s
# Which metric names have the most series? (run in Grafana Explore against Prometheus)
topk(10, count by (__name__) ({__name__=~".+"}))
customMetrics. Why it is wrong: the Azure Monitor exporter sends count, sum, min and max, not buckets. Instead: use requests/dependencies or managed Prometheus.The choice is mostly about operations, not features. Self-hosted Prometheus is excellent but becomes a platform you run: two replicas for high availability (and deduplication in Thanos or Mimir), object storage for retention beyond a few weeks, Alertmanager clustering, upgrades, and someone on call when the monitoring itself breaks. Scaling it means sharding scrape targets once a server passes a few million active series. On Azure, managed Prometheus removes all of that while keeping PromQL, recording rules and the community dashboards, and it integrates with Azure RBAC, private links and Azure Monitor alerts. Application Insights stays the best place for correlated traces, logs and requests in .NET, with Application Map and end-to-end transaction views. Many teams end up with both, and that's fine if the split is deliberate: metrics for dashboards and alerts, Application Insights for drill-down.
Whatever you pick, set a cardinality budget per service and measure it. As a rough guide, a typical .NET service with built-in ASP.NET Core, HttpClient and runtime metrics produces a few thousand series; a 40-service estate sits in the low hundreds of thousands; anything heading to millions usually means an unbounded label.
| Option | When it fits | Cost | When not to |
|---|---|---|---|
| Self-hosted Prometheus + Grafana | Multi-cloud or on-prem, strong platform team | Servers, storage, people, on-call | Small team without on-call for the monitoring stack |
| Managed Prometheus + Azure Managed Grafana | AKS on Azure, PromQL skills | Per sample ingested/queried + Grafana instance | Mostly App Service/Functions with no Prometheus skills |
| Application Insights metrics | App Service, Functions, KQL teams | Per GB ingested and retained | High-cardinality, high-frequency metrics at scale |
| Third-party SaaS (Datadog, Grafana Cloud, New Relic) | One tool across clouds | Per host / per series pricing | Strict data residency without an Australian region option |
Cardinality is the number of unique label combinations; each is a separate time series. A user_id label multiplies a metric's series by the number of active users, and on a histogram that is again multiplied by every bucket, so 20 routes × 5 status codes × 17 buckets × 50,000 users is 85 million series.
I confirm it with prometheus_tsdb_head_series (or the Azure Monitor workspace's active series and ingestion metrics), find the metric with topk(10, count by (__name__) ({__name__=~".+"})), and the label with count(count by (user_id) (...)). I stop the bleeding without a deploy by dropping the label in the OpenTelemetry Collector or with Prometheus labeldrop, then remove the tag in code and move per-user questions to traces and logs.
The trade-off: per-user detail is real value, but metrics are the wrong place for unbounded data.
All four store structured logs and let you search them, but they differ in how much they index, which drives cost.
I choose by team size, volume, existing cloud and who runs it, and I ship logs with OpenTelemetry so the choice stays reversible. The trade-off is index everything and query fast versus index little and pay less.
An incident dashboard must answer three questions in the first screen: are users hurting, since when, and where. So the top row is SLO status and error budget, then RED for the service (rate, 5xx ratio, p50/p95/p99) with the SLO threshold drawn on the panels. The next row is RED for each dependency (database, downstream APIs, queues) so you can see where the fault starts. Below that, USE panels for the runtime, pods and database, collapsed by default.
Every time series carries deploy and feature-flag annotations, because most incidents follow a change, and panels link to traces and logs filtered to the same service and time window. One template as code with service and region variables serves every service.
The trade-off: fewer panels make it faster to read, but you need drill-down paths for the detail you removed.
How to tell it (STAR)
**S:** At [company] all our dashboards for [40] AKS services were KQL queries over request logs, ingesting about [200] GB a month and loading slowly during incidents. **T:** I was asked to cut cost without losing visibility. **A:** I confirmed requests were the largest table, checked every service already emitted the ASP.NET Core duration histogram, and trialled managed Prometheus with Grafana on one cluster, comparing numbers for a week. We moved RED dashboards to PromQL, then turned on trace sampling and wrote an ADR for the split. **R:** Ingestion fell by [x]%, dashboards loaded in under [3] seconds, and rates stayed exact despite sampling.
Last updated 23 Nov 2026.