Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Remove the Metric Gauge instrument, recommend use of other instruments #80

Merged
merged 4 commits into from
Jan 29, 2020

Conversation

jmacd
Copy link
Contributor

@jmacd jmacd commented Jan 22, 2020

This was discussed in the 1/16 Metrics SIG meeting. This was first filed as open-telemetry/opentelemetry-specification#412

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reduction of API surface in this change is counterbalanced by requiring more work from the user, which makes migration to OTel more difficult. I would not be in favor of removing support for sync calls.

However, I notice that you're not extending the argument to Measure instrument. As discussed offline, I'm not clear on the difference between Measure and Gauge, and I would actually prefer to see Measure removed as more ambiguous. Gauge simply captures an observation as raw number. Traditional last-write-wins behavior can be an aggregation option.

@jmacd
Copy link
Contributor Author

jmacd commented Jan 22, 2020

@yurishkuro Thank you. I rewrote large parts of this document to address some of the points you raised. I have tried to argue that one of the other three instrument kinds is always appropriate.

If I understand your position on Gauge vs. Measure, I think it's overly reductive to say that Measure could be replaced by Gauge, but I agree that Gauge can be replaced by measure in some cases and that there's not an additional burden for migration in all but the rarest cases. These rare cases are cases where Observer instruments are truly the right choice and Counter and Measure would not apply, but that the performance impact of a callback approach is not acceptable.

In the new text, I've tried to clarify the distinction between Observer and the other kinds of instrument, that of there being a "current set of measured values" across multiple label sets without reference to an interval of time.

@jmacd jmacd changed the title Remove the Metric Gauge instrument, recommend exclusive use of Observer instrument Remove the Metric Gauge instrument, recommend use of other instruments Jan 22, 2020
Copy link
Member

@c24t c24t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and the examples are very helpful.

@jmacd
Copy link
Contributor Author

jmacd commented Jan 22, 2020

I can still be convinced not to go with this proposal, but I'm definitely leaning towards it now. Thinking about how to implement the Gauge Set helper introduced as a mitigation strategy, it occurs to me that a special instance of the default SDK could be configured to support the Gauge Set by translating Gauge.Set to Measure.Record in the special-purpose SDK. An Observer instrument would be registered to export the contents of the special-purpose SDK via observations. I.e., When the observer callback is called, the set of last-values is collected from the underlying Measure instruments of the special-purpose SDK.

@tsloughter
Copy link
Member

I would actually prefer to see Measure removed as more ambiguous.

Measure is absolutely needed. Measure, through attaching aggregations, can cover Counter and Gauge, but not the other way around.

I still see Counter and Gauge (Observable or not) as optimizations, which I like. OpenCensus there was only record and aggregation done in views. If you have something that is for sure for counting, or observing as a gauge, having these as high level concepts helps with both readability and optimizing the code path, doing the aggregation in-process.

But I'm +1 on removing the Gauge instrument. Easy to add it it back if needed.

@MrAlias
Copy link
Contributor

MrAlias commented Jan 22, 2020

This OTEP does a good job highlighting why it is advantageous to remove gauges from the developer perspective. However, one of the things that is really important in building out an API is to consider the user of the API and the APIs lifecycle. As @bogdandrutu pointed out in open-telemetry/opentelemetry-specification#412:

Apply the rule of minimal API surface: because there are some unknowns with the Gauge implementation and because we don't have very good use-cases for these type of instruments it is better to avoid adding them in the API for the moment. In case of a clear use-case determined later we should re-evaluate if adding the Gauge instrument back is the right decision or we do have different other solutions.

I think this is an understated point, but one that should be central to this discussion. Including Gauges in the API to only later in the lifecycle determine their meaning needs to change (how they support complex aggregations), or they need to be removed, is a bad design decision and one that will reflect poorly on the OpenTelemetry project overall.

@yurishkuro does bring up a valid point in questioning whether the lack of Gauges would result in a loss of functionality to the final user, but I think @jmacd and @tsloughter are correct in providing reasons as to why this is not the case.

I'm in favor of removing the Gauge from the API if we cannot come up with any valid use-cases for them. @jmacd do you think adding a bit about the API design choice to the motivation a needed part of the OTEP?

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the examples, I think they are sorely missing in general in the Spec for metrics.

@bogdandrutu
Copy link
Member

@open-telemetry/specs-approvers please review, we need couple more reviews to merge this

@jmacd jmacd deleted the jmacd/remove_metric_gauge branch May 6, 2020 18:48
carlosalberto pushed a commit to carlosalberto/oteps that referenced this pull request Oct 23, 2024
open-telemetry#80)

* Remove the Metric Gauge instrument, recommend exclusive use of Observer instrument

* Typos

* More text

Co-authored-by: Bogdan Drutu <lazy@splunk.com>
carlosalberto pushed a commit to carlosalberto/oteps that referenced this pull request Oct 23, 2024
open-telemetry#80)

* Remove the Metric Gauge instrument, recommend exclusive use of Observer instrument

* Typos

* More text

Co-authored-by: Bogdan Drutu <lazy@splunk.com>
carlosalberto pushed a commit to carlosalberto/oteps that referenced this pull request Oct 30, 2024
open-telemetry#80)

* Remove the Metric Gauge instrument, recommend exclusive use of Observer instrument

* Typos

* More text

Co-authored-by: Bogdan Drutu <lazy@splunk.com>
carlosalberto pushed a commit to open-telemetry/opentelemetry-specification that referenced this pull request Nov 8, 2024
open-telemetry/oteps#80)

* Remove the Metric Gauge instrument, recommend exclusive use of Observer instrument

* Typos

* More text

Co-authored-by: Bogdan Drutu <lazy@splunk.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants