eclipse / microprofile-metrics

microprofile-metrics
Apache License 2.0
101 stars 66 forks source link

Gauged annotation #182

Open jGauravGupta opened 7 years ago

jGauravGupta commented 7 years ago

In the metrics api two class [org.eclipse.microprofile.metrics.Gauge & org.eclipse.microprofile.metrics.annotation.Gauge] exist with same name, so if possibly Gauge annotation should be renamed to Gauged because :

Perhaps, annotation named to Gauge so dropwizard user can easily migrate to MP-Metrics : http://metrics.dropwizard.io/3.1.0/apidocs/com/codahale/metrics/annotation/package-summary.html

pilhuhn commented 7 years ago

Gaurav, thank you for your suggestion. Aren't point 2 of your proposal and he last sentence mutually exclusive? In fact the current name is like in DWM.

jGauravGupta commented 7 years ago

You are right, but I would prefer standard naming convention for long term over DWM easier migration.

pilhuhn commented 7 years ago

I think we can add @Gauged for Metrics 1.1 and mark @Gauge as deprecated. Then with the release of MP-2.0 umbrella spec, we can also release MP-Metrics-2.0 and remove @Gauge.

astefanutti commented 7 years ago

Follow the similar naming convention, as other class have distinct name like [Timer & Timed], [Counter & Counted], [Meter & Metered] etc, so it should be [Gauge & Gauged].

It is very possible that the DWM team choose the @Gauge name on purpose as declaring a gauge is by nature different than declaring other metrics. For the former, the declaration is the gauge, while for the latter, the annotation declaration is the pointcut. The fact that it is possible to add the @Gauge annotation on a field follows that possibility.

donbourne commented 7 years ago

@astefanutti I see what you're saying -- @Timed and the other ones ending with 'd' are all method/constructor invocation counters where interceptors are going to add a Timer (or counter, or ...) for you. So saying something is Timed means you're not defining the Timer yourself, but that the method/ctor is timed. From that perspective, I think I understand how they came up with the annotation name for @Gauge since @Gauge is marking a method/field that is the gauge.

donbourne commented 7 years ago

... to say something is gauged is different from saying something is a gauge. On balance I think I would not want to change to @Gauged (particularly since that would add a cost to people that might migrate some code from pure dropwizard metrics).

astefanutti commented 7 years ago

@donbourne exactly.