open-telemetry / open-telemetry/opentelemetry-cpp

A Gauge is using the "last value aggregation", when using the async version, when the callback is called, we can provide a measurement value together with attributes.

Open
#3,742 5 comments 0 reactions 1 assignee View on GitHub

@ThomsonTan is already working on this.

Since Dec 1, 2025.

Stale triage/accepted
Dominant language
C++
Stars
1.4k
Forks
632
Avg merge
1d 13h
Merged PRs (30d)
75

Description

A Gauge is using the "last value aggregation", when using the async version, when the callback is called, we can provide a measurement value together with attributes.

We use the attributes for different purposes:

  • to just add an attribute carrying meta data (say a certain key:pair value we add to a "temperature metric", temperature as in instant temperature)
  • to give the same metric for multiple instances of something, where those multiple instances are dynamic, they may come and go, the attribute is for example "Name":"Instance15".

What we noticed is the moment an attribute changes (or a attribute gets added), the old situation (with the old attribute value and old measurement, or without the new attributed) keeps being reported, so we end up with an ever increasing set of datapoints, where the old ones are to be considered obsolete and should just die.

In the dynamic case, we will always report all of the existing instances, the fact we no longer mention a given instance means it is gone, it has passed on, it died ;-)

How can this be achieved ?

Originally posted by @killerbot242 in https://github.com/open-telemetry/opentelemetry-cpp/discussions/3688

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.