What Is a Metric View in OpenTelemetry?

What Is a Metric View in OpenTelemetry?

A plain-English guide to the control panel that lets you rename, reshape, trim, or switch off your measurements before they ever leave your program — so your dashboards stay clear and your bill stays small.

Imagine a kitchen where the cook records every single thing that happens: every egg cracked, every onion chopped, every pan heated, every spoon washed. At the end of the day the cook hands you a notebook with four hundred pages. Somewhere in there is the answer to “Was dinner on time?” but you would need an afternoon to find it. A better cook keeps the same careful watch but hands you a single sheet: orders served, average wait, and the three slowest dishes.

Software programs measure themselves in much the same way. Libraries record numbers all day long: how many requests arrived, how long each took, how many items sit in a queue. Left alone, these measurements can be too detailed, badly named, expensive to store, or shaped in a way that does not suit your questions. OpenTelemetry gives you a tidy tool for fixing this at the source. It is called a View.

This guide explains views from the ground up. You will learn what they select, what they can change, what they cannot, how they protect you from runaway costs, and how to use them wisely and safely. Every new word is explained the first time it appears, so no earlier knowledge of observability is needed.

1What Is a Metric View?

The short answer first, then the words that make it clear.

A View in OpenTelemetry is a rule, registered inside your program, that says: “For measurements that match this description, change how they are summarised and sent.” A view can rename a measurement, change its description, keep only some of its labels, switch it to a different way of summarising, or turn it off entirely. It does all this inside the program, before any data travels over the network.

Let us unpack the vocabulary. OpenTelemetry, often shortened to OTel, is a free, open source framework, hosted by the Cloud Native Computing Foundation, that gives developers one standard way to produce telemetry: the stream of traces, metrics, and logs that describes how software behaves. A metric is a number measured over time, such as “requests per second” or “memory in use.” Code creates metrics through instruments. An instrument is a small object, such as a counter or a histogram, that your code calls each time something worth measuring happens. Each call is a measurement.

Between the moment your code records a measurement and the moment a number leaves your program, something must summarise the measurements. Imagine one million requests in a minute: nobody wants one million separate numbers on the wire. The summarising step is called aggregation. It adds counts together, remembers the latest value, or sorts durations into groups. A view is the rule that controls which aggregation is used, and how the result is labelled and named.

3
Things a view does: selects instruments, reshapes their output, or drops it
0
Changes needed in the code that records the measurements
1
Place views are configured: the meter provider, at startup
Everyday Analogy

Think of a photo editor standing between a camera and a newspaper. The camera takes everything. The editor decides which photos go in, crops them, writes the caption, and throws away the rest. A view is that editor. Your code is the camera, the exporter is the newspaper, and neither needs to change for the editor to do the job.

What a view answers

  • Which measurements? A view chooses its targets by name, type, unit, or the library that created them.
  • What name should it have? A view can give the outgoing metric a clearer or standard name.
  • Which labels matter? A view can keep only the labels you care about and discard the rest.
  • How should it be summarised? A view can switch a histogram’s group boundaries, or choose a different kind of aggregation.
  • Should it be sent at all? A view can switch a noisy metric off completely.

What a view is not

A view is not a new metric. It does not invent measurements that your code never recorded. It is also not a query: it cannot ask questions of data that has already left. And it is not part of the instrumented library. Library authors write the measurements; the application owner writes the views. That separation is the whole point, because the person running the program usually knows better than the library author what is useful and what is wasteful.

i
Remember This

Code decides what happens. A view decides how it is reported. You can change the report without touching the code.

A Closer Look at the Word “View”

Database people will recognise the word. A database view is a saved lens over a table: you do not change the table, but you look at it through a filter, with renamed columns and some rows or columns hidden. An OpenTelemetry view works the same way. The raw measurements stay as the instruments recorded them. The view is a lens that shapes how those measurements are presented to the outside world.

This lens idea explains a rule you will meet again and again: a view affects what is exported, not what your code records. Your code still calls the instrument in exactly the same way. The savings happen afterward, in the summarising step, which is why views can cut costs without any change to the program’s business logic.

Why Beginners Find Views Confusing at First

Newcomers often expect that the code which records a measurement is also the code that decides how it is reported. In many older tools that was true, and so a change in reporting meant a change in code. OpenTelemetry deliberately separates the two. The code that records measurements belongs to the library author, and the code that decides reporting belongs to the person who runs the program. The view is the bridge between these two worlds.

Once this separation is clear, many other details fall into place. It explains why views are registered on the provider and not on instruments, why they cannot change values, and why they can safely be applied to libraries you did not write. Keep this picture of two worlds and one bridge in mind as you read the rest of the guide.

2Why Views Exist

One-size-fits-all defaults are a good start and a poor finish.

When people share instrumented libraries, a web framework or a database driver for example, the library author must choose names, labels, and summarising styles without knowing who will use the library. The author imagines a typical user, and the defaults reflect that guess. But your program is not typical. Your latencies might be much faster or slower. Your traffic might carry labels the author never imagined. Your monitoring tool might expect different names.

Without views, you would have only two bad choices. You could change the library, which is not yours to change, or you could live with the defaults and fix everything later in the backend, after paying to send and store the unwanted data. Views give you a third, much better choice: adjust the output at the source, in your own program’s startup settings, leaving the library untouched.

Everyday Analogy

Think of buying a ready-made suit. The tailor in the factory cut it for an average person. You are not average, so you visit your own tailor, who takes in the waist and shortens the sleeves. You do not remake the suit from scratch, and you do not ask the factory to change. A view is the visit to your own tailor.

A short history

1

Early metric libraries

Older libraries often chose aggregations and names inside the code. Changing them meant editing or replacing the library.

2

API and SDK split

OpenTelemetry separated the API, which code calls to record measurements, from the SDK, which decides what to do with them. This split created a natural home for configuration.

3

Views as the SDK’s control surface

The specification defined views as the way an application owner customises metric streams, without any change to instrumentation.

4

Cardinality protection

As teams met surprise bills from labels with thousands of values, views gained attribute filtering, and the SDK gained a default cap on how many distinct label combinations one metric may produce.

5

Today

Views are configurable in code and, increasingly, in declarative configuration files, so a platform team can set them without developers editing any program.

i
The Core Insight

The person who writes the measurement and the person who pays for it are rarely the same. Views give the payer a voice, without forcing the writer to guess in advance.

The Cost of Doing Nothing

Teams that never use views often discover the cost slowly. At first, one service sends a hundred series and nobody worries. Then the team adopts a new library with twenty metrics, then a second service, then a third, and the series count climbs quietly. A year later, the monitoring bill is one of the largest line items in the budget, and no single decision caused it. Views let a team put a brake on this slow growth, by agreeing early on what each service is allowed to send.

There is also a human cost. Dashboards crowded with unused metrics are harder to read, and engineers waste time searching for the few lines that matter. A tidy set of metrics, shaped by views, is not only cheaper but easier to understand during an emergency, when every minute counts.

3Core Concepts You Need First

Eight small ideas hold up the whole topic. Learn these and the rest will feel natural.

Idea 1

Instrument

The object your code uses to record measurements. A counter counts things that only go up, a histogram records spreads of values such as durations, and a gauge reports a current level. Think of an instrument as a measuring tool in a workshop.

Idea 2

Measurement

One single recorded value, such as “this request took 0.2 seconds.” Measurements arrive constantly and are far too numerous to send one by one.

Idea 3

Attributes

Labels attached to a measurement, such as the route, the method, or the status code. They let you slice the numbers later. Each different combination of attribute values forms its own series.

Idea 4

Aggregation

The way measurements are boiled down: added into a total, reduced to the latest value, or sorted into groups. It is the step where a million measurements become a handful of numbers.

Idea 5

Metric stream

The finished result for one instrument under one set of choices: a name, a description, a unit, an aggregation, and the series inside it. A stream is what actually leaves the program.

Idea 6

Meter and meter provider

A meter is the named handle a library uses to create instruments. The meter provider is the manager at the top that owns every meter and every view. Views are registered on the provider.

Idea 7

Cardinality

The number of different label combinations a metric produces. Low cardinality means a few tidy series. High cardinality means thousands or millions, and a large bill.

Idea 8

Reader and exporter

A reader collects the finished streams on a schedule, and an exporter sends them onward. Together they are the delivery van that picks up the packages the views have prepared.

How the ideas fit together

Here is the whole story in one breath. Your code calls an instrument and records a measurement with some attributes. The meter provider checks its list of views to see which ones match the instrument. For each matching view, or for a default if none match, it creates a metric stream. Measurements flow into the stream, where the aggregation boils them down. On a timer, the reader collects the finished streams, and the exporter sends them out.

Everyday Analogy

Picture a school with a suggestion box. Pupils drop notes in all day (measurements). A teacher, the aggregation, sorts them into piles and counts each pile. A head teacher, the view, decides which piles are worth reporting, what to call them, and which details to leave out. At the end of the week, a messenger, the exporter, carries the summary to the governors. The pupils never learn how the summary was shaped.

The stream is the unit of everything

Beginners often picture one instrument producing one metric. In fact, one instrument can produce several streams, one for each view that matches it, or one default stream if no view matches. This is why views can be used to send the same measurement to two destinations in two different shapes. It is also why careless views can accidentally create duplicate names, which we will study in a later chapter.

i
A Helpful Mental Model

Instruments are the faucets, views are the plumbing rules, and streams are the pipes that actually carry water out of the house. You never need to rebuild the faucet to change where the water goes.

Why Attributes and Aggregation Interact

It is worth understanding one connection before moving on. Aggregation happens per combination of attributes. A counter with three label values keeps three separate running totals, one for each combination. When a view removes a label, the combinations that differed only by that label collapse into one, and their totals are added. This is why removing a label is so effective at reducing cost: it does not merely hide information, it reduces the number of running totals the program must keep in memory.

This connection also explains why a view that filters labels saves memory inside the application, not only storage in the backend. Fewer combinations mean fewer objects, less work at each measurement, and smaller exports, so the benefit is felt at every step along the path.

4The Anatomy of a View

Every view has two halves: a way to find its targets, and a description of what to do to them.

A view is like a work order at a repair shop. The top half says which vehicles the order applies to. The bottom half says what to do to each of them. In OpenTelemetry the top half is called the selection criteria and the bottom half is called the stream configuration.

The selection criteria

The criteria decide which instruments the view applies to. You can use one criterion or several together. When you give several, an instrument must satisfy all of them to match.

CriterionWhat it matchesExample in words
Instrument nameThe name of the instrument, with a wildcard allowed“All instruments whose name starts with http.server.”
Instrument typeCounter, histogram, gauge, and the other kinds“Every histogram in the program.”
UnitThe unit of measurement the instrument declares“Everything measured in milliseconds.”
Meter nameThe library that created the instrument“Everything from the database driver library.”
Meter versionThe version of that library“Only version 2 of the driver library.”
Meter schema addressThe address of the schema the library follows“Only libraries following a particular schema.”

The wildcard deserves a moment. A single star in a name criterion matches everything, and a star inside a pattern matches any run of characters. A view with only a star as its name criterion therefore applies to every instrument in the program. This is a powerful tool for company-wide rules, and also a dangerous one if used carelessly.

The stream configuration

The configuration says what the resulting stream should look like. Every field is optional. Anything you leave out keeps its default, which comes from the instrument itself.

SettingWhat it controlsIf you leave it out
NameThe name of the outgoing metricThe instrument’s own name is used
DescriptionThe human-readable explanation of the metricThe instrument’s own description is used
Attribute keysWhich labels survive; all others are removed and their values mergedAll labels are kept
AggregationHow measurements are boiled downThe default for that kind of instrument
Exemplar reservoirHow sample measurements are chosen to be attached as examplesThe default reservoir
Cardinality limitThe maximum number of distinct label combinations for the streamThe SDK’s default limit
Everyday Analogy

Think of a library’s relabelling project. The work order might say, “All books in the cooking section with a red spine (criteria) should get a new title sticker, lose the old price label, and be shelved in a different room (configuration).” The books are the same books. Only how they are presented has changed.

Two things views deliberately cannot change

First, a view cannot change the kind of instrument. A counter stays a counter. The rules about what a counter means, that it only goes up, are fixed by the instrument, and no view can override them. Second, a view cannot change the unit or the value of the measurements. It changes how they are grouped and labelled, not what they say. If you need to convert milliseconds to seconds, you must fix the instrumentation or do the conversion later in a Collector.

!
A View Is Not a Calculator

Views group and relabel. They do not add, convert, or invent numbers. If you catch yourself wanting to multiply a value or combine two metrics, a view is the wrong tool.

Reading a View Aloud

A good way to check a view is to read it aloud as a sentence. For example: “For every histogram created by the web framework library, keep only the route, method, and status labels, and use these bucket boundaries.” If the sentence sounds natural and describes exactly what you intend, the view is probably right. If it sounds vague, such as “for everything, remove some labels,” the view is probably too broad, and you should tighten the criteria before shipping it.

This habit also helps when reviewing a colleague’s work. A reviewer who can read the view as a plain sentence can quickly spot a wildcard that is too greedy or a rename that will surprise someone downstream.

5The Defaults: What Happens With No Views

Before you change anything, you should know what already happens when you change nothing.

If you register no views at all, the SDK still produces a stream for every instrument, using a standard default aggregation for each kind. This is why metrics appear in your backend even when nobody has configured anything. Knowing these defaults helps you decide when they are good enough and when they need a view.

Instrument kindWhat it is forDefault aggregationPlain meaning
CounterCounting events that only increase, such as requests servedSumAdd everything up
UpDownCounterCounting things that rise and fall, such as items in a queueSumAdd up all changes to get the current level
HistogramRecording spreads of values, such as durationsExplicit bucket histogramSort values into ranges and count each range
GaugeReporting a current reading, such as temperatureLast valueKeep only the most recent reading
Observable counterA counter read on request, such as total CPU timeSumReport the running total
Observable up-down counterAn up-and-down value read on requestSumReport the current level
Observable gaugeA gauge read on request, such as memory in useLast valueReport the latest reading

The default histogram buckets

A histogram sorts measurements into buckets, which are numeric ranges. The default explicit histogram uses a fixed list of boundaries: 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1,000, 2,500, 5,000, 7,500, and 10,000. That gives sixteen buckets, from “zero to five” up to “over ten thousand.” These numbers were chosen with milliseconds in mind, as a general-purpose spread.

Here lies one of the most common reasons to write a view. If your instrument records durations in seconds, a typical request of 0.2 seconds, 0.35 seconds, or 1.2 seconds all fall into the very first bucket, “zero to five,” or the second, “five to ten.” The histogram becomes a single useless lump, and every percentile you compute from it will be wrong. A view that supplies better boundaries fixes this immediately, without touching the code.

Everyday Analogy

Imagine sorting people by height into boxes labelled in metres, but with boxes labelled “0 to 5,” “5 to 10,” and so on. Every person, from a child to a basketball player, lands in the “0 to 5” box. Your sorting is perfectly consistent and completely useless. Choosing better box sizes is exactly what a bucket view does.

The default cardinality limit

The SDK also protects you with a default cap. By default, each metric stream may hold up to 2,000 distinct label combinations. When a stream reaches its limit, further new combinations are not stored one by one. Instead they are merged into a single special series that carries an overflow marker. This stops a runaway label from consuming memory without limit, but it also means that data beyond the cap is lumped together and loses its detail. We will return to this safety net in the chapter on cardinality.

i
Defaults Are a Starting Point

The defaults are good for getting started and for typical libraries. Views exist for the moment when the defaults no longer fit: wrong buckets, too many labels, awkward names, or a metric you simply do not want.

Gauges, Sums, and the Meaning of “Current”

The defaults reflect what each kind of instrument means. A counter measures how many things have happened, so adding is natural. A gauge measures a level at a moment, such as the temperature, so adding two readings would be nonsense, and the most recent reading is the sensible summary. An up-down counter measures changes in a level, such as items added to or removed from a queue, so adding all changes yields the current size.

When you later choose a different aggregation in a view, keep these meanings in mind. A view should refine how the quantity is reported, not contradict what the quantity is. If you find yourself wanting to sum a gauge, the better question is usually whether the right kind of instrument was created in the first place.

6The Menu of Aggregations

An aggregation is a recipe for boiling many numbers into few. A view lets you pick the recipe.

flowchart LR
    A["Application code calls an instrument"] --> B["Measurement with attributes"]
    B --> C{"Meter provider checks its views"}
    C -->|"Matching view found"| D["Metric stream shaped by the view"]
    C -->|"No view matches"| E["Default stream for that instrument kind"]
    D --> F["Aggregation boils measurements down"]
    E --> F
    F --> G["Reader collects on a schedule"]
    G --> H["Exporter sends the result onward"]
Figure 1: The path a measurement takes, and the point where views step in

Explaining Figure 1

Read the diagram from left to right. Your code calls an instrument, which creates a measurement with its labels. The meter provider then asks one question: does any registered view match this instrument? If yes, a stream is shaped by that view. If no, a default stream is created. Either way, the stream’s aggregation boils the many measurements into a few numbers. A reader collects the results on a timer, and an exporter ships them out. The view acts at a single point only, the moment the stream is defined, which explains why it is so cheap to apply.

The aggregations you can choose

AggregationWhat it producesBest forPlain meaning
DefaultThe standard choice for the instrument kindMost casesLet the SDK decide
SumA total of all measurementsCounters and up-down countersAdd everything together
Last valueThe most recent measurementGaugesRemember only the latest reading
Explicit bucket histogramCounts per range, using boundaries you chooseDurations and sizes when you know the likely rangeSort values into hand-picked boxes
Exponential bucket histogramCounts per range, with boxes that grow automaticallyValues whose range is unknown or very wideLet the boxes adapt themselves
DropNothing at allMetrics you never want to sendThrow the measurements away

Explicit versus exponential histograms

An explicit histogram uses boundaries that you write down in advance. It is easy to understand and works everywhere, but you must guess the right boundaries. If your latencies change over time, the boundaries may stop fitting. An exponential histogram generates its boxes by a formula, making each one a fixed percentage wider than the previous one. It covers a huge range with only a limited number of boxes, resizes itself as values appear, and usually gives better accuracy at low cost. The catch is that not every backend understands exponential histograms yet, so you should check your destination before switching.

Everyday Analogy

An explicit histogram is like a bookshelf with shelves you built to fixed heights. If a taller book arrives, it does not fit. An exponential histogram is like an adjustable shelf, where each level grows in steady steps, so any book can find a home without anyone measuring in advance.

Drop: the quiet hero

The Drop aggregation deserves special praise. A library might create twenty metrics when you only care about three. With a view that matches the unwanted ones and applies Drop, those seventeen metrics produce no data, no network traffic, and no storage cost. The measurements still arrive at the instruments, but they are discarded at once, which is nearly free.

!
Compatibility Matters

Not every aggregation suits every instrument. A gauge does not make sense summed, and a counter does not make sense as a last value. If you request an aggregation that does not fit the instrument kind, the SDK normally falls back to the default and may log a warning. Always check the output after changing an aggregation.

Choosing an Aggregation in Practice

A simple decision path works for most cases. If the instrument counts events, use Sum. If it reports a level, use Last value. If it records durations or sizes and you know the typical range, use an explicit histogram with boundaries that fit. If you do not know the range, or it varies a great deal, consider an exponential histogram, after confirming that your backend can read it. If you do not need the metric at all, use Drop. When unsure, leave the default and look at real output before changing anything.

Remember that each choice has a cost. Histograms are the most expensive aggregation, because each series holds a count for every bucket plus extra totals. Applying a histogram to something that only needed a count wastes memory and storage, so choose the lightest aggregation that still answers your question.

A Note on Memory and Speed

Each aggregation keeps a small amount of state for every combination of labels. A sum keeps one number, a last value keeps one number, and a histogram keeps a number for every bucket, plus a total and a count. Because this state lives in the application’s memory, a careless choice can make a busy program heavier. Choosing lightweight aggregations for simple questions and limiting label combinations keeps the monitoring cost of a program far smaller than the work it does for customers.

7Taming Cardinality With Attribute Filtering

The single most valuable thing a view does is decide which labels are worth their cost.

Every metric can carry labels, called attributes. A request counter might carry the route, the method, and the status code. Each different combination of label values becomes its own series, its own line on a chart, and its own row in storage. Cardinality is the count of those combinations. It is the number that decides how much a metric costs.

The arithmetic is multiplication, which grows frighteningly fast. Imagine a request counter with four labels: route with 20 values, method with 4, status code with 6, and customer identifier with 5,000. The number of possible series is 20 × 4 × 6 × 5,000 = 2,400,000. If you remove the customer identifier, the count falls to 20 × 4 × 6 = 480. One label was responsible for more than 99.9 percent of the series.

2,400,000
Series with all four labels (20 × 4 × 6 × 5,000)
480
Series after a view keeps only route, method, and status (20 × 4 × 6)
5,000×
Reduction from removing one label
flowchart TD
    A["Raw measurements with route, method, status, and customer"] --> B["Millions of possible label combinations"]
    B --> C{"View keeps only route, method, and status"}
    C --> D["Customer label removed"]
    D --> E["Measurements that differ only by customer are merged"]
    E --> F["Only 480 series remain"]
    B -.->|"No view and no limit"| G["Memory and cost grow without bound"]
Figure 2: Removing a high-cardinality label merges millions of series into hundreds

Explaining Figure 2

The diagram begins with raw measurements that carry four labels. Left alone, they produce millions of combinations, shown on the dotted path where memory and cost grow without bound. A view that keeps only three labels removes the customer label from each measurement. Measurements that used to differ only by customer now look identical, so they are merged: counts are added together, and histogram buckets are added bucket by bucket. The result is a few hundred tidy series that still answer the questions people actually ask.

What happens to the numbers when labels are removed

Removing a label does not delete information about how much happened. It only removes the ability to split by that label. For a counter, the merged series simply holds the sum of the series that were combined, so the total count of requests is unchanged. For a histogram, the buckets are added together, so overall percentiles remain meaningful. For a gauge, however, merging is trickier: the last value from one of several merged sources wins, and the result may not mean what you expect. Be careful when filtering labels from gauges.

Everyday Analogy

Think of a school that records attendance for every pupil on every day. If the head teacher only needs to know how many pupils attended each class, the names can be dropped, and the counts added up. The total attendance is exactly the same, but the sheet shrinks from a thousand rows to twenty. Pupils’ names were the high-cardinality label.

Allow-lists and block-lists

There are two ways to describe which labels survive. An allow-list names the labels to keep, and everything else is removed. A block-list names the labels to remove, and everything else stays. The allow-list is safer for protecting costs, because a new label added by a future library upgrade is removed automatically until you decide it is worth keeping. The block-list is friendlier when you just want to remove one troublesome label and keep the rest. Check which styles your language’s SDK supports, as the options differ.

The safety net: the cardinality limit

Even with careful views, a surprise can arrive. A bug might put a unique number into a label, and suddenly a metric produces a new series for every request. To prevent memory from exploding, the SDK enforces a limit on how many distinct label combinations one stream may hold, by default 2,000. When the limit is reached, new combinations are no longer tracked individually. Their measurements are added to a single overflow series, marked with a special label that says it is the overflow.

That overflow series is both a rescue and a warning. It rescues your memory and your bill. It warns you, because when it appears, your detailed data has begun to merge into a lump. A view can raise or lower the limit for a particular stream, which is useful when a legitimate metric genuinely needs more combinations, or when a fragile one needs a tighter cap.

!
A Cap Is a Net, Not a Plan

Do not rely on the overflow limit as your cardinality strategy. By the time it triggers, you are already losing detail. Use views to remove the expensive labels deliberately, and keep the limit as protection for the unexpected.

Estimating Cardinality Before You Ship

You can predict cardinality with a pencil and paper. List the labels of a metric and, beside each, write the number of distinct values it can take. Multiply them. If the result is in the hundreds, you are safe. If it is in the thousands, think carefully. If it is in the hundreds of thousands or more, change the design before shipping. Remember to multiply again by the number of running copies of your program if the backend stores each copy separately.

It also helps to ask of every label: “Is the set of values bounded and small?” Status codes, HTTP methods, and route templates are bounded. User identifiers, timestamps, session codes, and raw URLs are not. Unbounded labels are the usual cause of cardinality disasters, and a quick check at review time catches most of them.

8Choosing Histogram Buckets That Fit

A histogram is only as good as its boxes. A view lets you build better ones.

Histograms answer questions such as “How slow are the slowest ten percent of requests?” They do this by counting how many measurements fall into each bucket. The backend then estimates percentiles by looking at those counts. If most measurements land in one bucket, the estimate is poor, because inside a bucket the backend can only guess.

Let us make this concrete. Suppose a service records request durations in seconds, and almost every request lasts between 0.02 and 0.8 seconds. With the default boundaries, which start at 0, 5, 10, and 25, every one of these measurements falls into the first bucket, “zero to five.” The histogram holds one big count and fifteen empty buckets. Any computed 99th percentile will be a meaningless number somewhere inside that first box.

SituationDefault boundariesBetter boundaries for secondsResult
Web request duration0, 5, 10, 25 and upward0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10Fine detail where most requests live, and room for slow outliers
Database query duration0, 5, 10, 25 and upward0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1Distinguishes fast indexed queries from slow scans
Message size in bytes0, 5, 10, 25 and upward100, 1,000, 10,000, 100,000, 1,000,000Covers small notes to large attachments
Unknown or wide rangeFixed listSwitch to the exponential histogramBoxes adapt to whatever arrives

Rules for good boundaries

  • Put boundaries where decisions live. If your promise to customers is “under 0.5 seconds,” make sure 0.5 is a boundary, so you can count exactly how many met the promise.
  • Use finer steps near the typical value. The busiest region of the range deserves the most boundaries.
  • Leave room above the worst case. The last bucket collects everything beyond the final boundary, so make that boundary comfortably high.
  • Do not use too many. Every boundary multiplies the data for every label combination. Ten to twenty boundaries are usually plenty.
  • Keep them the same across services. If different services use different boundaries for the same kind of metric, combining them later becomes awkward.
Everyday Analogy

Think of a doctor measuring children’s heights. A chart that groups everyone into “under 2 metres” and “over 2 metres” tells her nothing. A chart with a line every five centimetres, packed most densely around the ages she sees most, gives her real insight. Buckets are the lines on the height chart.

sequenceDiagram
    participant S as Startup code
    participant P as Meter provider
    participant L as Library code
    participant R as Reader and exporter
    S->>P: Register views, then create the provider
    L->>P: Create an instrument named request duration
    P->>P: Match the instrument against the views
    Note over P: Matching view supplies better bucket boundaries
    L->>P: Record measurements all day
    R->>P: Collect on a timer
    P-->>R: Streams with the chosen buckets
    R->>R: Export onward
Figure 3: Views are registered first, applied when an instrument is created, and used on every later collection

Explaining Figure 3

The diagram shows the lifetime of a view. At startup, your configuration code registers the views and creates the meter provider. Later, a library creates an instrument. At that exact moment, the provider matches the instrument against the views and fixes the stream’s settings, such as the bucket boundaries. From then on, every measurement flows into that stream. When the reader’s timer fires, the provider hands over the finished streams, and the exporter sends them out. Because the choice is made at creation, views must be registered before instruments appear.

i
Register Early

Set up all your views at the very start of your program, before any library creates an instrument. A view that arrives late cannot reshape streams that already exist.

Comparing Percentile Accuracy

Percentile accuracy depends on how narrow the bucket containing the percentile is. Suppose the true 95th percentile of your requests is 0.42 seconds. With boundaries at 0.25 and 0.5, the backend knows only that the answer lies somewhere between those two numbers, and it will usually report an estimate near the middle or edge. If you add a boundary at 0.4, the estimate improves, because the range is narrower. The more boundaries you place near the values you care about, the more precise your percentiles become.

This is why you should place boundaries at the numbers that matter to the business, such as a promised response time. A bucket edge exactly at the promise lets you count, without any estimation, how many requests met or missed it.

9Renaming, Describing, Dropping, and Conflicts

A view can change a metric’s name, but names carry promises, so change them with care.

A view can give the outgoing stream a new name and a new description. This is helpful when a library uses an unusual name and your company uses a standard one, or when two teams call the same idea by different names. But a metric’s name is also its identity: every dashboard, alert, and report that mentions it depends on that name staying put. Renaming a metric through a view will make old charts go blank, so plan the change together with the people who use the data.

Renaming rules to remember

  • A name needs a single target. If you set a new name, the view should match exactly one instrument. A wildcard that matches many instruments, all renamed to the same thing, creates conflicts.
  • Descriptions are safe. Changing a description affects only the human-readable help text and breaks no dashboards.
  • Units are not changed. Renaming a duration metric from milliseconds to seconds in its name does not convert the numbers. That would be a lie in the name.
  • Announce renames. Tell dashboard owners before you ship, and keep the old name for a short time if you can.

What a conflict is

A conflict happens when two streams end up with the same name but different meanings, for example one counter and one histogram both called “requests,” or two instruments with different units. Backends dislike this, because one name should describe one thing. The SDK usually detects such conflicts, writes a warning to its diagnostic output, and either keeps both streams or lets one take priority, depending on the language. Neither result is what you wanted.

flowchart TD
    A["A view renames or merges streams"] --> B{"Do two streams now share one name?"}
    B -- "No" --> C["Everything exports normally"]
    B -- "Yes" --> D{"Same kind, same unit, same description?"}
    D -- "Yes" --> E["Streams are treated as one and merged safely"]
    D -- "No" --> F["Conflict: the SDK logs a warning"]
    F --> G["Fix the view so each name has one meaning"]
Figure 4: A shared name is fine only when the streams truly mean the same thing

Explaining Figure 4

After a view renames something, the first question is whether two streams now share a name. If not, all is well. If they do, the next question is whether they are really the same thing: same kind of instrument, same unit, same description. If so, the SDK may safely treat them as one. If not, a conflict is raised, a warning is logged, and you must fix the view so that every name has exactly one meaning.

Everyday Analogy

Imagine two shops in a town that both change their sign to “The Corner Shop.” One sells bread and the other sells bicycles. Customers become confused, deliveries go to the wrong door, and the mapping company marks a warning. Each business needs its own name. Metric names work the same way.

Using Drop to remove a stream

When you apply the Drop aggregation to matching instruments, they produce no stream at all. This is the cleanest way to silence a chatty library without patching it. Be careful with broad wildcards. A view that drops “everything starting with http” may also drop metrics that your alerts need. A good habit is to drop by exact name for the specific metrics you reviewed, rather than by broad patterns.

!
Order and Overlap

When more than one view matches the same instrument, each one creates its own stream. That is a feature when you want two shapes, and a trap when you did not intend overlap. Test the final output after every change and look for unexpected duplicates.

A Naming Standard Helps Everyone

Renaming is easiest when a company has a naming standard that everybody follows. A common approach is to use lowercase words separated by dots, to put the thing being measured first and the unit near the end, and to avoid putting labels or versions into the name. When views are used to bring every service to the same standard, dashboards become portable: a chart built for one service works for any other with no changes.

Standards also reduce conflicts. If every service uses the same name for the same idea, the question of whether two streams share a meaning almost never arises. The effort of writing the standard is repaid every time a new service joins the company.

Testing a Rename Safely

A careful way to rename a metric is to send both names for a short period. Create one view that keeps the old stream, and another that produces the new name, and tell dashboard owners which date the old name will be removed. During the overlap, owners update their charts and alerts to the new name, and nothing breaks. When the date arrives, remove the view that keeps the old name. This approach costs a little extra data for a few weeks and avoids the far larger cost of broken alerts.

10Views or the Collector? Choosing Where to Reshape

Both can rename, filter, and drop. They differ in where the work happens and how much it saves.

The OpenTelemetry Collector is a standalone program that receives telemetry, processes it, and forwards it. Its processors can rename metrics, remove labels, and filter streams, much like a view. So which should you use? The answer depends on where you want the savings and who owns the decision.

QuestionView in the SDKProcessing in the Collector
Where does it run?Inside each applicationIn a separate shared program
Does it save network traffic?Yes, unwanted data is never sentNo, data has already reached the Collector
Does it save application memory?Yes, fewer series are heldNo, the application already paid
Can it change histogram buckets?Yes, boundaries are chosen at the sourceOnly by approximation, since original measurements are gone
Who controls it?The application ownerThe platform team
Is it easy to change fleet-wide?Needs a redeploy or configuration rolloutOne change to the Collector affects every sender
Can it fix bad data from a library you cannot change?Yes, for names, labels, and aggregationsYes, for names and labels, but not for raw distribution
flowchart TD
    Q["You want to reshape a metric"] --> A{"Do you want to save memory and network at the source?"}
    A -- "Yes" --> V["Use a view in the SDK"]
    A -- "No" --> B{"Does the change need to apply to many applications at once?"}
    B -- "Yes" --> C["Use Collector processing"]
    B -- "No" --> D{"Do you need different histogram buckets?"}
    D -- "Yes" --> V
    D -- "No" --> E["Either works; prefer the simpler place to maintain"]
Figure 5: A simple way to choose between a view and the Collector

Explaining Figure 5

The first question is about savings. If you want to avoid paying for memory and network use, the work must happen before the data leaves the application, so a view is the answer. If the goal is simply central control over many applications, the Collector is attractive, since one change reaches everyone. If you need different histogram buckets, only a view can do it properly, because once measurements have been sorted into buckets, the original values cannot be recovered. Otherwise, either tool works, and you should choose the one that your team can maintain most easily.

Everyday Analogy

Think of sorting your household rubbish. You can sort it at home, before it leaves the house, which makes every bin lighter and every trip cheaper. Or you can send everything to a central sorting plant that handles the whole neighbourhood. Home sorting saves effort along the way. The plant gives consistency and one place to change the rules. Many families do both.

A sensible partnership

Most mature setups use both. Views in each application handle the things only the source can do: right-sized histogram buckets, removing expensive labels early, and dropping metrics nobody needs. The Collector handles fleet-wide policy: adding environment details, standardising names, and masking sensitive values. This division gives you savings at the source and consistency in the middle.

i
A Good Default Split

Do shape-changing work, such as buckets and label removal, in views. Do policy work, such as company-wide names and masking, in the Collector. Each tool does what it does best.

A Practical Example of the Partnership

Suppose a company has two hundred services. The platform team wants every metric to carry the environment label, to follow company naming, and to hide an internal server label before sending data to an outside vendor. These are fleet-wide policies, so the Collector is the right home: one change reaches all two hundred services. Meanwhile, a single team wants better histogram buckets for its payment latency metric, and wants to drop twelve unused metrics from a library. These are application-specific, so views are the right home. Both tools are used, each for the job it suits.

11What a View Cannot Do

Knowing the limits prevents long, confusing afternoons of debugging.

Views are powerful but narrow. They shape streams. They do not rewrite history, do not invent data, and do not control everything about delivery. A short list of limits will save you from surprise.

You might expect…The realityWhat to do instead
A view changes what my code recordsCode still records every measurement; the view changes only the exported streamRemove the instrument from code if you want to avoid even the recording cost
A view converts unitsValues are never changedFix the instrumentation, or convert in the Collector
A view changes the instrument kindA counter stays a counterCreate the right kind of instrument in code
A view chooses cumulative or delta reportingThat choice belongs to the reader and exporterSet the temporality on the reader or exporter
A view can fix data already sentIt acts only on future streamsFix it in the backend, or accept the gap
A late view can reshape existing streamsStreams are fixed when instruments are createdRegister views before the first instrument is made
A view calculates a new metric from two othersA view works on one stream at a timeUse the backend’s query language or a Collector connector

Temporality in plain words

Two words appear in the table that deserve an explanation. Temporality describes whether a metric reports the running total since the program began, called cumulative, or only the change since the last report, called delta. Some backends prefer one style and some prefer the other. This choice is made by the reader or exporter, not by the view. Remember this when a colleague asks “Can I use a view to switch to delta?” The answer is no; look at the reader settings instead.

Everyday Analogy

Think of a car’s dashboard. The odometer shows the total distance since the car was built (cumulative). The trip meter shows the distance since you last reset it (delta). The label on the dial, such as “miles” or “kilometres,” is the view’s business. Which of the two meters you look at is the reader’s business.

i
A Quick Test

Before writing a view, ask: “Am I selecting, renaming, trimming, re-bucketing, or dropping?” If yes, a view is right. If you want to calculate, convert, or schedule, look elsewhere.

Why These Limits Are Actually Helpful

The limits of views may feel frustrating, but they protect you. Because a view cannot change values, you can trust that a number leaving your program is a faithful summary of what the code recorded. Because it cannot change the instrument kind, the meaning of each metric stays stable across every program that uses the same library. Because it acts only at creation, behaviour is predictable. A tool that could do anything would be much harder to reason about, and mistakes would be harder to find.

12Security and Privacy With Views

A view can be a quiet guardian of sensitive information, if you use it that way.

Labels are attractive places for developers to put useful facts: a customer identifier, an email address, a session token, a file path. In a trace, such details may be justified, but in a metric they are risky. Metric labels are copied into every series, stored for a long time, and often visible to many people. A view can act as a final filter that ensures no unexpected label ever leaves your program.

RiskExampleProtection
Personal data in labelsAn email address or user name attached to a counterUse an allow-list so that only reviewed labels are exported
Secrets in labelsA token or key accidentally recorded as a label valueAllow-list labels, and review changes whenever a library is upgraded
Internal structure revealedServer names and internal paths visible to an outside vendorRemove such labels before export, or mask them in a Collector
Denial of service by label explosionAn attacker sends requests with random values that become labelsKeep user-controlled values out of labels, and set a cardinality limit
Cost attacksRandom paths or headers inflating series countsGroup or normalise values before they become labels
Surprise exposure after upgradesA new library version adds a revealing labelAn allow-list ignores new labels until you approve them

Why user-controlled labels are dangerous

Imagine a web service that records the requested path as a label. Normal traffic produces perhaps fifty distinct paths. But a scanner, or a malicious visitor, can request thousands of random paths. Each one creates a new series. Memory climbs, bills rise, and in a serious case the service slows down. The fix is partly in code, by using the route template such as “/orders/{id}” instead of the raw path, and partly in views, by keeping the cardinality limit tight as a net.

Everyday Analogy

Think of a post office that stamps every parcel with a label listing everything about it. If a parcel’s label could include anything the sender writes, a prankster could cover the sorting machine with ten thousand different labels, and the machine would grind to a halt. A rule that says “only these four label types are allowed” keeps the machine safe.

A short privacy checklist

  • Ask what each label reveals. Could it identify a person, a secret, or an internal system?
  • Prefer allow-lists. Name the labels you want, so nothing unreviewed can leak.
  • Never use unbounded values as labels. Identifiers, timestamps, and raw paths belong in traces or logs, not metrics.
  • Review after upgrades. Compare the exported labels before and after updating instrumentation libraries.
  • Do not rely on views alone. Combine them with Collector masking and with access controls in the backend.
!
Metrics Live a Long Time

Metrics are often stored for months or years and shown on shared dashboards. Treat every label as if it will be read by a stranger long from now.

Allow-Lists as a Habit

Security specialists often say that a rule which says what is allowed is safer than a rule which says what is not allowed. The reason is simple: the world keeps inventing new things to forbid. For metric labels, the same logic holds. A new library version may add a label that you never reviewed. With an allow-list, that label is quietly removed until you decide it deserves to be sent. With a block-list, it flows out immediately, and you learn about it only after the data has been stored and shared.

Shared Responsibility

Views are one layer of protection among several. Developers are responsible for not putting secrets or personal data into labels in the first place. The application owner is responsible for the allow-lists that guard the exit. The platform team is responsible for Collector masking and for access controls in the backend. When each layer does its part, a single mistake in one layer is caught by the next, and sensitive information rarely reaches a place where it should not be.

13Monitoring and Checking Your Views

Views fail quietly. A wrong view does not crash anything; it just makes some numbers disappear or look strange.

If a view accidentally matches too much, a useful metric vanishes. If it matches too little, an expensive metric keeps flowing. Neither mistake raises an error. The only symptom is a chart that goes empty or a bill that does not shrink. Because the failure is silent, you must look for it on purpose.

What to checkWhat it tells youTypical action
Metrics present before and after a view changeWhether anything vanished by accidentCompare the list of exported metric names, and restore anything missing
Series count per metricWhether cardinality is under controlRemove or group labels on the largest metrics
Appearance of the overflow labelWhether a stream has reached its limitFind the label that exploded, and fix it at the source
Histogram bucket usageWhether all counts sit in one or two bucketsAdjust boundaries to fit the real range
SDK warnings about duplicate or conflicting instrumentsWhether views produce clashing namesFix the naming rules in the view
Data points per exportWhether exports are growing unexpectedlyLook for new labels or new instruments
Dashboard and alert healthWhether renamed metrics broke somethingUpdate queries, or restore the old names

Check after every change

1

List the metrics before the change

Save the names, units, and label sets that your program currently exports, so you have a baseline to compare against.

2

Apply the view in a test environment

Never try a new view first on production traffic.

3

Print the exported metrics

Use a console or debug exporter to see exactly what leaves the program.

4

Compare with the baseline

Look for missing metrics, changed names, removed labels, and altered buckets.

5

Watch a day of production

After rollout, check series counts, overflow markers, and dashboards for surprises.

Everyday Analogy

Think of a new filter on a water tap. You do not just fit it and walk away. You run the water, look at it, taste it, and check that the flow is still strong enough for the kettle. A new view deserves the same simple inspection.

i
Make It Automatic

Add a small test to your build that starts the program with its views and compares the exported metric names and labels with an approved list. A thirty-second test can prevent weeks of confusion.

Reading the Overflow Signal

The overflow label deserves a permanent place on your monitoring dashboard. When a stream reaches its limit, new label combinations are merged into a single series carrying a marker that identifies it as the overflow. If that series ever appears, treat it as an alert: some label has grown beyond expectation. Look at which metric produced it, list the labels, and ask which one has unbounded values. Fixing the cause is far better than raising the limit, which only postpones the cost.

Who Should Look at These Checks?

Give each check an owner. The platform team can watch overall series counts and overflow markers across the whole company, while each service team watches its own metrics and dashboards. When both sides know their role, problems are noticed while they are small, and a surprise bill or a flat chart becomes a small fix instead of a long investigation.

14Benefits, Drawbacks, and Trade-offs

Every design has a price. An honest view helps you decide how much to reshape.

Advantages

  • Savings at the source. Unwanted data is never stored, sent, or paid for.
  • No code changes. You can fix a library’s output without touching or forking it.
  • Right-sized histograms. Buckets that fit your real values make percentiles trustworthy.
  • Protection from label explosions. Allow-lists and limits keep memory and bills in check.
  • Cleaner names. Metrics can follow your company’s standards.
  • Privacy help. Only reviewed labels leave the program.

Disadvantages

  • Silent mistakes. A wrong match drops or distorts data without any error.
  • Per-application work. Each program needs its own configuration, unless a shared template supplies it.
  • Fixed at startup. Changing a view usually means a restart or redeploy.
  • Information is gone for good. Once a label is removed, nobody can split by it later.
  • Possible conflicts. Renames and overlaps can create duplicate or clashing streams.
  • Language differences. Each language’s SDK exposes slightly different options.

Common trade-offs in plain language

ChoiceWhat you gainWhat it costs
Keep many labelsRich slicing in dashboardsHigh cardinality and cost
Keep few labelsSmall, cheap, fast metricsLess detail when investigating
Allow-list of labelsSafety against surprisesNew useful labels must be added by hand
Block-list of labelsEasy to remove one bad labelNew labels leak through automatically
Explicit histogramSimple, widely supportedYou must guess the boundaries well
Exponential histogramAccurate over wide ranges with little setupNot understood by every backend yet
Many bucketsFiner percentile estimatesMore data per series
Rename in the viewStandard names from day oneOld dashboards break
Drop in the viewZero cost for unwanted metricsData cannot be recovered later
i
A Fair Rule of Thumb

Start with defaults. Add a view only when you can name the problem it solves: a bill that is too high, a histogram that is useless, a label that is risky, or a name that is wrong. Views without a reason become clutter.

When views are not enough

Views shape how existing instruments are summarised, but they cannot create better measurements. If a library measures the wrong thing, such as total time when you need time split into waiting and working, no view can recover the missing split. In that case the right fix is better instrumentation, either by adding your own instruments or by upgrading the library. Think of views as the finishing touch, not the foundation.

Counting the Savings Honestly

When you report the benefit of views to management, count honestly. Measure series, storage, and network use before and after, over the same period and under similar traffic. Remember that some of the saving comes from deleted detail, and say so plainly. A good report states what was removed, why it was safe to remove it, and what questions can no longer be answered from metrics, with a pointer to where those questions can still be answered, such as traces or logs.

15Good Habits and Design Patterns

Patterns are tried-and-true recipes. Habits are the small routines that keep your metrics clean, cheap, and useful.

Pattern

A shared starter set

Publish one standard set of views for the whole company, covering common buckets and approved labels, so every new service starts with sensible output.

Pattern

Allow-list on the busiest metrics

For the few metrics that carry most of your cost, name the exact labels that may leave the program. Everything else is trimmed automatically.

Pattern

Drop by exact name

Silence unwanted metrics one at a time, by name, after reviewing each one. Avoid broad patterns that might catch useful metrics.

Pattern

Buckets from the promise

Build histogram boundaries around the targets you have promised customers, so you can count precisely how often you kept the promise.

Pattern

Views from configuration

Load views from a configuration file managed by the platform team, so adjustments do not require editing application code.

Pattern

Split the work with the Collector

Shape and shrink in views, standardise and mask in the Collector, so each tool does what it does best.

Habits that pay off

  • Measure before you cut. Look at series counts per metric, and trim the biggest ones first.
  • Prefer allow-lists for costly metrics. They protect you against future surprises.
  • Set up views before instruments are created. Do it at the very start of the program.
  • Keep views small and readable. One view, one purpose, with a clear comment of why it exists.
  • Review after library upgrades. New versions can add metrics and labels you did not approve.
  • Test the exported output. Print it and compare it with an approved list.
  • Tell the dashboard owners. Any rename or dropped metric should be announced.
  • Document the standard. A one-page guide with examples makes the right way the easy way.

A gentle path to adopting views

1

Audit what is sent today

List every metric, its labels, and its series count. Find the five most expensive.

2

Drop what nobody uses

Check dashboards and alerts, and drop metrics that no one reads.

3

Trim the expensive labels

Apply allow-lists to the biggest metrics, removing identifiers and other unbounded values.

4

Fix the histograms

Replace default buckets with boundaries that fit the real range of values.

5

Share the result

Turn what worked into a shared starter set, and review it every quarter.

i
Make the Easy Path the Right Path

If a team can adopt the standard views by copying one block of configuration, they will. If it needs a long document and an approval meeting, they will invent their own.

Keeping the Standard Alive

Writing a standard is easy. Keeping it alive through years of change is harder. Teams reorganise, languages are added, and libraries are upgraded, and each change is a chance for someone to invent a private rule. Give the standard an owner, publish it where engineers actually look, and include a worked example. When it changes, update the shared configuration first, so that new releases pick up the change in the ordinary course of work, not through a long manual campaign.

16Common Mistakes, Anti-patterns, and Myths

Most view problems come from the same few mistakes. Knowing them in advance saves a lot of confusion.

AP-1The Greedy WildcardVery common

What happens: A view uses a broad name pattern to drop or change many instruments at once.

Why it hurts: Useful metrics disappear together with the noisy ones, and nobody notices until an alert stays silent.

Better approach: Match exact names for drops and renames, and compare the exported list before and after.

AP-2The Late ViewQuietly harmful

What happens: Views are registered after libraries have already created their instruments.

Why it hurts: Existing streams are already fixed, so the view appears to be ignored.

Better approach: Register all views at the very start, when the meter provider is built.

AP-3The Identifier LabelExpensive

What happens: A customer number, session code, or raw path is used as a metric label.

Why it hurts: Series multiply without limit, costs soar, and the overflow cap eventually merges the detail anyway.

Better approach: Remove such labels with an allow-list and keep the details in traces or logs.

AP-4The Silent RenameDisruptive

What happens: A metric is renamed in a view without warning anyone.

Why it hurts: Dashboards and alerts that use the old name go blank, and incidents can pass unnoticed.

Better approach: Announce renames, update dashboards first, and keep both names for a short overlap if possible.

Myths worth clearing up

MythReality
“A view creates a new metric.”A view reshapes an existing instrument’s output. It never invents measurements.
“Views change my code.”Code is untouched. Views live in the provider’s configuration.
“Removing a label loses my totals.”Totals are preserved for counters and histograms. Only the ability to split by that label is lost.
“A view can convert milliseconds to seconds.”Views never alter values or units.
“The Collector makes views unnecessary.”Only views can save memory and network at the source, and change histogram buckets properly.
“Views switch between cumulative and delta.”That choice belongs to the reader and exporter.
“The default limit protects me completely.”It protects memory, but beyond the cap your detail is merged into one overflow series.

A Review Checklist Before You Ship a View

  • Is the target narrow enough? Read the criteria aloud and confirm that they match only the instruments you intended.
  • Is the label list reviewed? Every kept label should be bounded, useful, and safe to share.
  • Are the names unique? No two streams should end up with one name and two meanings.
  • Do the buckets fit? Boundaries should cover the real range of values and include any promised target.
  • Is the backend ready? Confirm that the destination understands the chosen aggregation.
  • Is the owner of every dashboard informed? Renames and drops should never be a surprise.

A team that walks through these six questions before every change will avoid nearly all of the mistakes described above. The checklist takes five minutes, and it is far cheaper than an incident that begins with the words “the chart went blank.”

17A Worked Example: The Orders Service

Let us follow one imaginary service from a noisy, costly setup to a tidy, affordable one, using simple numbers.

The Orders service runs as 100 copies in the cloud. It uses a web framework library that creates 20 different metrics, each with about 50 series per copy. It also has its own request duration histogram, which records seconds, with the labels route (20 values), method (4), status (6), and customer identifier (up to 5,000).

Step 1: audit the cost

The library’s 20 metrics at 50 series each produce 20 × 50 = 1,000 series per copy. Across 100 copies that is 100,000 series. The team’s own histogram can in theory reach 20 × 4 × 6 × 5,000 = 2,400,000 series per copy, which is 240,000,000 across 100 copies. Real traffic reaches only a fraction of those combinations, but the trend is alarming, and the default cap of 2,000 combinations per stream is already being hit by some copies, producing overflow series.

100,000
Library series before views (20 metrics × 50 series × 100 copies)
15,000
Library series after dropping 17 of 20 metrics (3 × 50 × 100)
48,000
Histogram series after removing the customer label (480 × 100)

Step 2: drop what nobody reads

After checking dashboards and alerts, the team finds that only 3 of the library’s 20 metrics are used. They write views that drop the other 17, naming each one exactly. The library series fall from 100,000 to 3 × 50 × 100 = 15,000, a drop of 85 percent, and the application code is untouched.

Step 3: trim the expensive label

The customer identifier is the culprit in the histogram. The team writes a view with an allow-list that keeps route, method, and status. The theoretical maximum per copy falls from 2,400,000 to 20 × 4 × 6 = 480, and across 100 copies to 48,000. The overflow series disappears, and the data is complete again. Customer-level questions move to traces, where one customer’s request is easy to find.

Step 4: fix the buckets

The histogram records seconds, but it uses the default boundaries that begin at 0, 5, 10, and 25. Nearly every request falls in the first bucket, and the computed 99th percentile is meaningless. The team adds a view that sets the boundaries to 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, and 10. Immediately the dashboard shows a believable curve, with most requests around 0.1 to 0.25 seconds and a thin tail reaching one second.

Step 5: verify

The team starts one copy in a test environment with a console exporter, and compares the printed metrics with the baseline list. Three library metrics remain, the histogram has three labels and the new buckets, and no warnings about conflicts appear. Only then do they roll out to all 100 copies. A day later, series counts match the plan and the overflow label is gone.

Everyday Analogy

The team behaved like a gardener tidying an overgrown hedge. First they removed branches that bore no fruit (dropped metrics), then they pruned the one branch that was growing wild (the customer label), and finally they adjusted the trellis so the plant grew in a useful shape (the buckets). They did not replant the garden.

i
What This Example Teaches

Three small views cut the data by more than 99 percent in the worst case, and made the remaining data more accurate. None of the application’s business code changed.

What the Orders Team Learned Afterwards

Looking back, the team noticed that their most valuable decisions were also their simplest. They dropped what nobody read, removed the one label that caused most of the cost, and fixed the buckets so the data told the truth. They also learned to treat the first day after any change as a checking day, comparing the exported metrics with a saved baseline and watching for the overflow marker.

Finally, they wrote a one-page guide for new teams. It listed the approved labels, gave the standard bucket boundaries for latency, explained how to estimate cardinality with multiplication, and named a contact for questions. New services now begin with sensible views by default, which is the best sign that a standard is working.

18Real-World Scenarios

Three short stories show how views turn confusion into clarity.

Scenario 1: The surprise bill

A finance manager notices that the monitoring bill has doubled in a month. The platform team sorts metrics by series count and finds one counter responsible for most of the growth. A new release added the requesting user’s identifier as a label. A view with an allow-list removes the label without a new release of the application, and within a day the series count falls back to normal. The lesson: a view can be the fastest emergency brake.

Scenario 2: The flat latency chart

An engineer builds a latency dashboard and finds that every percentile reads the same suspicious value. The histogram uses default buckets designed for milliseconds, but the instrument records seconds. Almost every measurement lands in one bucket. A view with proper boundaries turns the flat line into a clear picture, and the team discovers that one route is much slower than the others.

Scenario 3: The noisy library

A database driver library emits thirty metrics, and the team uses four. Storage costs rise with every new service that adopts the library. The platform team publishes a shared view set that drops the unused metrics for every service by exact name. New services inherit the savings automatically, and nobody has to edit the library.

i
The Pattern Behind the Stories

In each story, the cure was applied at the source, without waiting for a library author or rewriting code. That is the practical gift of views: control belongs to the people who run the program.

Choosing Where to Begin

If your organisation is only starting out, you do not need to solve everything at once. Begin with the single most valuable step: find your most expensive metric and look at its labels. Remove the unbounded one. Next, find a histogram with default buckets and fit it to its real range. After that, drop metrics that nobody reads, and finally publish a shared starter set so that new services inherit the results. Each step is small, brings a clear benefit, and can be checked on its own.

This gradual path also builds goodwill. Teams see the savings and the clearer charts early, and they become willing partners in later, more demanding steps. Views are a humble feature, but used with care they give every future metric a sensible name, a fitting shape, and a fair price.

19Frequently Asked Questions

Q1What is a metric view in one sentence?
A view is a rule registered on the meter provider that selects instruments and customises their output stream, by changing the name, labels, aggregation, or by dropping them, without changing the code that records the measurements.
Q2Where do I configure views?
On the meter provider, at program startup, in code or in a declarative configuration file, depending on what your language and platform support.
Q3Do I need views to get metrics at all?
No. Without views, every instrument produces a stream using its default aggregation. Views are for customising that behaviour.
Q4Can a view change a counter into a gauge?
No. The instrument kind is fixed by the code. A view can choose among aggregations compatible with the kind, but it cannot change what the instrument means.
Q5Does removing a label lose my totals?
For counters and histograms, no. Merged series are added together, so totals remain correct. You simply can no longer split by the removed label. Take extra care with gauges, where merging is less meaningful.
Q6What are the default histogram boundaries?
The default explicit boundaries are 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1,000, 2,500, 5,000, 7,500, and 10,000. They suit milliseconds, so values recorded in seconds usually need a view with better boundaries.
Q7What is the cardinality limit?
A cap on the number of distinct label combinations a single stream may hold, by default 2,000. Beyond it, new combinations are merged into one overflow series, so the detail is lost.
Q8Can I use a view to drop a metric?
Yes. A view that matches the instrument and uses the Drop aggregation stops the stream from being exported at all.
Q9What happens if two views match the same instrument?
Each matching view creates its own stream. That can be useful for sending two shapes of the same measurement, but it may also create duplicate or conflicting names, so test the output.
Q10Should I use a view or a Collector processor?
Use a view when you want savings at the source or different histogram buckets. Use the Collector for fleet-wide policy and standardisation. Many teams use both.
Q11Can a view switch between cumulative and delta?
No. Temporality is a property of the reader and exporter, not of the view.
Q12Can I add a view after the program has started?
Not reliably. Streams are fixed when instruments are created, so register views before the first instrument appears, which means at the start of the program.
Q13Are the option names the same in every language?
The ideas are the same, but the details differ slightly between SDKs, such as how attribute filters are written. Always check your language’s current documentation before relying on a specific option.
Q14Do views affect traces or logs?
No. Views belong to the metrics part of the SDK. Traces and logs have their own, separate ways of being filtered and shaped.
Q15Is it safe to try a view in production first?
It is better not to. Try the view in a test environment with a console exporter, compare the output with a baseline, and then roll it out gradually. Because mistakes are silent, careful checking beats quick fixing.

20Summary and Key Takeaways

A view is a small rule with a large effect: it lets you decide how your measurements are reported.

We began with a cook who records everything and hands over a four-hundred-page notebook, and we ended with a tidy single sheet. We saw how a view selects instruments, reshapes their streams, and sometimes drops them completely. We looked at the defaults, the menu of aggregations, the arithmetic of cardinality, and the importance of histogram buckets that fit. We compared views with the Collector, learned what views cannot do, and examined their role in privacy and monitoring. The cure for nearly every metric problem is the same: measure what matters, label with care, and shape the output at the source.

Key Takeaways

  • A view reshapes output, not code. It selects instruments and changes their name, labels, aggregation, or presence, without touching the code that records measurements.
  • Register views early. Streams are fixed when instruments are created, so configure views on the meter provider at startup.
  • Cardinality is the cost driver. One unbounded label, such as a customer identifier, can multiply series from 480 to 2,400,000. Use allow-lists to keep only reviewed labels.
  • Fit your histogram buckets. Default boundaries suit milliseconds; durations in seconds need boundaries that match the real range, or percentiles are meaningless.
  • Know the limits. Views do not convert units, change instrument kinds, switch temporality, or calculate new metrics.
  • Use views and the Collector together. Shape and shrink at the source with views; standardise and mask centrally in the Collector.
  • Check after every change. Compare exported metrics before and after, and watch for vanished metrics, naming conflicts, and the overflow marker.

Keep one last idea in mind as you put this guide to work. Views are not about collecting less for its own sake. They are about collecting what you will actually use, in a shape that tells the truth, at a cost you can afford. Start small, measure the result, and let each view earn its place by solving a problem you can name.