Quick revision
The short answer
First find where the series come from: rank metrics and tags by how many time series they create, and fix the unbounded tags such as user ids, raw URLs or exception messages. Then put guard rails in the shared Spring Boot starter with MeterFilters that deny known bad tags and cap the number of values per tag, write down naming, tagging and histogram rules, show each team the cost of its own metrics, and check new metrics in code review against a short guideline.
What to remember
In this answer, we saw that a tripled metrics bill usually comes from a few metrics with unbounded tags multiplied by instances and histogram buckets. We find them by counting series per metric and per tag, fix the worst ones first, and then add guard rails in the shared starter with MeterFilters that ignore forbidden tags, cap tag values and make histograms opt-in. Clear naming and tagging conventions, a series budget per service, cost shown per team and three simple review questions keep the problem from coming back.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
First find where the series come from: rank metrics and tags by how many time series they create, and fix the unbounded tags such as user ids, raw URLs or exception messages. Then put guard rails in the shared Spring Boot starter with MeterFilters that deny known bad tags and cap the number of values per tag, write down naming, tagging and histogram rules, show each team the cost of its own metrics, and check new metrics in code review against a short guideline.
Why this question is asked
A metrics bill that triples in a year is rarely caused by growth in traffic. It is usually caused by a few metrics whose tags multiply without limit, and the same series that inflate the bill also make every dashboard query scan millions of rows. Interviewers ask this at a senior level because the fix is half technical and half organisational: we need a way to find the culprits, a mechanism that stops it from happening again, and habits in the teams so that we do not need heroic clean-ups each year. In this answer, we will recap what a time series is and why tags multiply, walk through finding the top producers, put controls into the shared starter, agree on conventions, and finally make cost visible and part of review.
1A Quick Recap: Why Tags Multiply
A time series is one metric name plus one exact combination of tag values. The backend stores and bills each combination separately. So the number of series for a metric is roughly the product of the number of values of each tag, multiplied by the number of instances.
Take http.server.requests with 30 endpoints, 2 methods, 6 status codes and 40 instances. That is 30 x 2 x 6 x 40 = 14,400 series, which is fine. Now someone adds a userId tag with 50,000 active users. The same metric now has hundreds of millions of possible combinations, and even if only a fraction appear, it can easily create millions of series. With a percentile histogram on top, each of those is multiplied again by the number of buckets. One line of code can do this, which is why the problem grows quietly.
2Finding the Top Series Producers
Before changing anything we measure. Most backends can count series by metric name and by tag. In Prometheus-compatible systems, a query over all series grouped by name shows the worst metrics in seconds, and a second query on one metric shows which label has the most distinct values. Vendors usually offer a cardinality or usage page that shows the same thing with cost attached.
In a case like this, we usually find that three or four metrics from a handful of services produce most of the series. Fixing those first gives the biggest saving for the least work, so we open tickets for the owning teams with the numbers, and in urgent cases we drop the tag centrally while they fix the code. The typical culprits are user or order ids, raw request paths instead of URI templates, free text such as exception messages, and histograms enabled on every timer.
3Guard Rails in the Shared Starter
Most organisations with many Spring Boot services have a shared starter, a library every service depends on that carries common configuration. That is the right place for controls, because one release protects every service. Micrometer gives us MeterFilter, a hook that can rename, drop or limit meters before they are registered.
Notice what each filter does. ignoreTags removes the tag but keeps the metric, so the team still has its counter. maximumAllowableTags stops a runaway tag after a fixed number of values. The last one makes histograms opt-in, with an allow list we control. We should also log or count what the filters deny, so teams learn that their tag was dropped instead of wondering where it went. Spring Boot can also disable whole meter families with management.metrics.enable.<prefix>=false, which is useful for noisy auto-configured meters a service does not need.
4Conventions Teams Can Follow
Filters catch mistakes; conventions prevent them. We write a short page, no longer than a screen, that teams will actually read. It says that metric names are dotted lower case and start with the domain (orders.placed, payment.authorised), that tags must have a known, small set of values, and that anything unique per request belongs in a trace or a log, not in a metric. It also sets a budget for histograms: allowed on inbound HTTP, messaging consumers and key business timers, otherwise use a few slo boundaries.
A useful rule of thumb to include is a series budget per service, for example 20,000 series per instance, with an alert when a service crosses it. That turns a vague principle into something a team can check.
5Making Cost Visible and Reviewing New Metrics
People optimise what they can see. Most backends can report series or ingested samples per service, and we can map services to teams through a service catalogue. A monthly report that says team Payments produced 1.4 million series costing about 18,000 dollars, of which one metric is 70 percent, changes behaviour faster than any policy. It is showback, not punishment: the goal is that owners see the effect of their choices.
Finally, new metrics go through normal code review with a checklist of three questions: is every tag bounded, is the name in the convention, and does this timer really need a histogram. Reviewers do not need to be experts if the questions are simple. Combined with the starter's filters and the series alert, the platform now catches mistakes at three points: in review, at registration time, and in the bill.
- Code reviewThree questions: bounded tags, naming, histogram needed?
- Shared starter
MeterFiltersdeny bad tags and cap values - Series budget alertService crosses 20,000 series per instance
- Over budget?YesTicket to owning team with top metricsNoNo action
- Monthly showbackSeries and cost per team
5 steps in order. Play them, or step through them one at a time.
Each layer catches what the one before missed.
6Follow-up questions
Why not simply drop all custom metrics until the bill is under control?
Because the problem is concentrated. In most cases a few metrics produce most of the series, and the other metrics are what teams use to run their services. Cutting everything would hurt incident response and destroy trust in the platform team. Targeting the top producers gives most of the saving in days.
Where should per-customer information go if not into metric tags?
Into traces and logs, which are built to hold high-cardinality values such as customer or order ids. If the business really needs per-customer counts, that is an analytics question, and a data pipeline or a database table is a better and cheaper home than a time series database.
Does reducing series also fix slow dashboards?
Mostly, yes. A dashboard query has to read every series that matches it, so a panel over a metric with two million series is slow no matter how it is written. After the clean-up, it also helps to replace expensive panels with recording rules or pre-aggregated metrics for the most used dashboards.
7Conclusion
In this answer, we saw that a tripled metrics bill usually comes from a few metrics with unbounded tags multiplied by instances and histogram buckets. We find them by counting series per metric and per tag, fix the worst ones first, and then add guard rails in the shared starter with MeterFilters that ignore forbidden tags, cap tag values and make histograms opt-in. Clear naming and tagging conventions, a series budget per service, cost shown per team and three simple review questions keep the problem from coming back.
Open with
I'd start by measuring, not by writing policy. I'd count series per metric name and then per tag on the worst metrics, because it's almost always a few metrics with unbounded tags, like user ids, raw request paths or exception messages, multiplied by instances and histogram buckets.
Then, if they want more
I'd fix those first with the owning teams, and if it's urgent, drop the tag centrally. Then I'd make sure it can't silently come back.
Our services share a Spring Boot starter, so I'd add MeterFilters there: ignoreTags for ids we never allow, maximumAllowableTags to cap things like the uri tag, and a filter that makes percentile histograms opt-in for an allowed list of timers. I'd also log what gets denied so teams aren't confused.
Alongside that, a short convention page: naming, bounded tags only, anything per request goes to traces or logs, and when histograms are allowed. I'd give each service a series budget with an alert. Then cost visibility: a monthly report of series and cost per team, framed as showback so owners see the effect of their choices.
And in code review, three simple questions for any new metric: are the tags bounded, is the name right, and does it need a histogram.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Cloud documentation, Resilience4j documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Your metrics bill has tripled in a year and dashboards are slow. Investigation shows...": https://scrivio-interview-library.netlify.app/spring-boot/observability/30cbe3967f/