Observability for Multi-Tenant Platforms

Observability for Multi-Tenant Platforms

Why the metrics most platforms watch lag the incident, and how to instrument the per-tenant, per-boundary signals that lead it, without drowning in metric cardinality.

Series: Operating at Hyperscale (10 articles)

  1. …
  2. 10
    Observability for Multi-Tenant Platforms This article

You can't operate what you can't see per tenant

Every other operational capability depends on this one. You cannot shift away from an impaired Availability Zone you cannot detect, forecast a quota you are not measuring, or tell a customer which of their tenants is affected if your telemetry only knows account-wide totals. Observability is the foundation the rest of operating at scale is built on, and it is also the dimension most platforms quietly under-invest in, because the dashboards they already have look reassuring right up until an incident proves they were measuring the wrong thing.
This post continues my series on  operating multi-tenant platforms at hyperscale on AWS . It is a deep-dive into the first and most foundational dimension: signal and observability. The examples use Amazon CloudWatch, but the principles apply to any observability stack.

Leading signals versus lagging ones

The core mistake is watching metrics that confirm an incident instead of ones that predict it. Aggregate error rate is a lagging indicator: by the time it moves, customers are already affected. The signals worth building toward lead the incident:
  • Per-tenant consumption and throttle rate, so a noisy neighbor shows up before it drains a shared quota.
  • Quota-consumption velocity, so you see a limit cliff hours ahead, not at the 429.
  • Per-Availability-Zone availability and latency, so a single-AZ impairment surfaces instead of averaging away.
  • Boundary latency, the time added at each hop across your accounts, gateways, and upstream dependencies, so root cause is a lookup rather than a debate.
Every one of these shares a property: it is a dimension of a metric, not a new metric. Which is exactly where the difficulty, and the cost, lives.

Make telemetry tenant-aware at the boundary

The highest-leverage move is to attach identity to telemetry at the ingress boundary, before a request fans out into the system. Tag availability and latency with the tenant, the tier, and the Availability Zone, so that any metric can be sliced by who was affected and where. Once the telemetry carries that context, per-tenant rate limiting, per-tenant dashboards, and per-tenant incident updates all become possible. Without it, every one of them is a manual reconstruction during the incident.
A clean way to emit this on AWS is the  CloudWatch embedded metric format (EMF) : you write a single structured log record, and CloudWatch automatically extracts the metrics from it. You get the metric and the detailed log event in one write, which means you can alarm on the metric and then query the same record in CloudWatch Logs Insights to find the root cause. It also needs only the  logs:PutLogEvents  permission, not  cloudwatch:PutMetricData .
# Emit per-tenant telemetry via EMF (aws-embedded-metrics)
from aws_embedded_metrics import metric_scope

@metric_scope
def record_request(tenant_id, tier, az_id, latency_ms, throttled, metrics):
metrics.set_namespace("Platform/MultiTenant")
# Dimensions: keep these LOW-cardinality (see next section)
metrics.put_dimensions({"Tier": tier, "AvailabilityZoneId": az_id})
# High-cardinality identifiers go as properties, not dimensions
metrics.set_property("TenantId", tenant_id)
metrics.put_metric("RequestLatency", latency_ms, "Milliseconds")
metrics.put_metric("ThrottledRequests", 1 if throttled else 0, "Count")

The cardinality trap, and how to avoid it

Here is the part that bites teams who do tenant-aware observability naively. With EMF, CloudWatch creates a separate custom metric for every unique combination of dimension values. AWS says this plainly and warns against it: if you put a high-cardinality attribute like a request ID, or a tenant ID at a platform with tens of thousands of tenants, into the dimension set, you generate a custom metric per unique value, and both your metric count and your bill climb fast.
The resolution is a deliberate split:
  • Dimensions: low-cardinality only. Tier, Availability Zone, Region, endpoint class. These are the axes you want to alarm and dashboard on, and there are few enough of each that the metric count stays bounded.
  • Properties (log fields): high-cardinality identifiers. Tenant ID, request ID, trace ID. They stay queryable in Logs Insights and usable by Contributor Insights, but they do not each mint a metric.
This is the single most important design decision in multi-tenant observability. Get it wrong and you either lose per-tenant visibility (because you were afraid to add the dimension) or you get a surprise bill and a throttled metrics pipeline (because you added it as a dimension). The split gives you both: bounded metric cost, full per-tenant analyzability.

See the noisy neighbor without exploding cardinality

So how do you rank tenants when tenant ID is deliberately not a dimension? Two tools.
First,  CloudWatch Logs Insights  over the EMF records, because the tenant is a queryable property:
-- Top tenants by throttle rate in the last hour
fields @timestamp, TenantId, ThrottledRequests
| filter ispresent(TenantId)
| stats sum(ThrottledRequests) as throttles, count(*) as requests by TenantId
| sort throttles desc
| limit 10
Second, for a continuously evaluated signal you can alarm on,  CloudWatch Contributor Insights . It evaluates your structured logs and reports the top contributors and the number of unique contributors, keyed on a high-cardinality field like tenant ID, without you turning that field into a metric dimension. You can then alarm on its output with the  INSIGHT_RULE_METRIC  function:
INSIGHT_RULE_METRIC("top-tenants-by-throttle", "UniqueContributors")
That is the mechanism behind "page me when a single tenant's throttling becomes a problem for everyone else", a leading signal, derived from high-cardinality data, that costs you one rule instead of ten thousand metrics.

Instrument the boundaries, not just the endpoints

A multi-tenant platform spans several accounts, serverless layers, a gateway or proxy tier, and upstream dependencies you do not own. The slowest part of many incidents is the argument about where the latency or error originated. Shorten it by emitting a trace that spans the hops, so each boundary reports the time it added.  AWS X-Ray  annotations let you keep those traces filterable by the same tenant and AZ identifiers you put on your metrics, so a metric alarm and a trace tell the same story with the same labels. One naming detail that keeps this consistent: X-Ray annotation keys must be alphanumeric (dots and underscores are allowed, hyphens are not), so pick identifier names like  tenantId  and  availabilityZoneId  that are valid as a metric dimension, a log property, and a trace annotation alike. When the question "is it us, the gateway, or the upstream" has an instrumented answer, you reclaim the first critical minutes of every incident.

Getting started

  1. Attach tenant, tier, and AZ to telemetry at ingress, before the request fans out. This is the prerequisite for everything else.
  1. Adopt EMF so each record carries both an alarmable metric and a queryable log event.
  1. Make the dimensions-versus-properties split deliberately: low-cardinality fields as dimensions, high-cardinality identifiers as properties. Decide this before you ship, not after the bill.
  1. Stand up one Contributor Insights rule (top tenants by throttle or error rate) so the noisy neighbor is a leading signal, not a post-incident finding.
  1. Add boundary tracing with tenant-consistent annotations so root cause is a lookup.
If you operate a multi-tenant platform at scale, the test is simple: when a single tenant starts degrading the experience for the others, does a signal fire on its own, or does someone have to go looking? The difference is whether your observability leads the incident or merely records it.

References (AWS documentation)

Series: Operating at Hyperscale (10 articles)

  1. …
  2. 10
    Observability for Multi-Tenant Platforms This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article