Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share cumulative histogram counts variant for Timer #2082

Open
wants to merge 1 commit into
base: 1.5.x
Choose a base branch
from

Conversation

izeye
Copy link
Contributor

@izeye izeye commented May 10, 2020

This PR is similar to #2076, but for the Timer implementations.

* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.core.instrument.internal;
Copy link
Contributor

Choose a reason for hiding this comment

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

HistogramFlavor is referred to in PrometheusConfig, so probably can't be internal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jkschneider Actually, I wanted to make this be referred in PrometheusConfig, but I couldn't do so due to backward compatibility. I created this for internal use instead. That's why I was hesitating to do this change as mentioned in #2076 (comment).

Alternatively, we could rename it to something like HistogramType or HistogramStyle and move it to io.micrometer.core.instrument or io.micrometer.core.instrument.config for deprecation and ultimate removal of io.micrometer.prometheus.HistogramFlavor and io.micrometer.opentsdb.OpenTSDBFlavor. Let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

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

OpenTSDBFlavor is kind of reserved for a different purpose, more expansive than just histogram formatting. Since OpenTSDB is so wide-open on format (kind of like Influx), there are other conventions that may eventually become known to us, and for which we would add an option to OpenTSDBFlavor.

HistogramFlavor on the other I think will always apply only to Prometheus. It's because VictoriaMetrics reads a variant of Prometheus' exposition format with a particular expectation around histogram formatting that this option exists.

Copy link
Contributor Author

@izeye izeye May 11, 2020

Choose a reason for hiding this comment

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

@jkschneider Thanks for the explanation! I didn't know the intention. So are you okay with as-is? Or replacing only io.micrometer.prometheus.HistogramFlavor by renaming? Or any other better way you have in mind?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure. Here's what I'm thinking: the commonality between these two timers isn't as much about the cumulative nature of the stats as it is about support for VictoriaMetrics format. And VictoriaMetrics isn't probably going to support some other cumulative monitoring system.

For example, we could be adding a cumulative mode to the Datadog implementation now that it has rate functions (and distributions which conceptually map to Micrometer histograms). So it would seem awkward if Datadog couldn't use the CumulativeHistogramTimer?

Is it better then to keep the code as it is with some duplication to show that this Victoria format is unique to these two registries than to eliminate duplication and try to explain why the construct isn't generalizable to other cumulative registries?

Copy link
Contributor

Choose a reason for hiding this comment

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

Lastly, I'm a bit embarrassed about the capitalization miss on HistogramFlavor in 1.4.0. Sorry about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jkschneider Thanks for the quick feedback! How about PrometheusTimer instead of CumulativeHistogramTimer? If it is still inappropriate, feel free to close this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm on the fence on this. What do you think @shakuzen? This comes down to a tradeoff of duplication vs. implementation-specific types in core.

I did add FixedBoundaryVictoriaMetricsHistogram to core, judging that its inherent complexity tipped the scales in favor of deduplication.

* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.core.instrument.internal;
Copy link
Contributor

Choose a reason for hiding this comment

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

OpenTSDBFlavor is kind of reserved for a different purpose, more expansive than just histogram formatting. Since OpenTSDB is so wide-open on format (kind of like Influx), there are other conventions that may eventually become known to us, and for which we would add an option to OpenTSDBFlavor.

HistogramFlavor on the other I think will always apply only to Prometheus. It's because VictoriaMetrics reads a variant of Prometheus' exposition format with a particular expectation around histogram formatting that this option exists.

@shakuzen shakuzen added the release notes Noteworthy change to call out in the release notes label May 11, 2020
@shakuzen
Copy link
Member

A couple things have changed since this was last reviewed that might make a different direction more favorable. PrometheusMeterRegistry now supports exemplars, and CumulativeTimer has been updated so it has a protected constructor that takes a Histogram. Extending CumulativeTimer could probably reduce the duplication in PrometheusTimer and OpenTSDBTimer enough that we don't need something else. CumulativeTimer is now used in the OtlpMeterRegistry. What do you think @izeye?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes Noteworthy change to call out in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants