- As a user, it is somewhat complex and quite puzzling using the API
- There are a lot of components
- The components are doing different things as I would expect based on their names
- I think it would worth a review and refactor to make it more usable.
GlobalMetricsProvider
- Based on its name, it should provide
Metrics
instances - In fact, it provides two things neither of them are
Metrics
get
returns aMeterProvider
getMeter
returns aMeter
- Based on its name, it should provide
MeterProvider
- Based on its name, it should provide
Meter
instances - Its get method does return a
Meter
instance - But
getDefault
(means "get the defaultMeter
") returns aMeterProvider
- Should not
getDefault
begetDefaultInstance
?
- Based on its name, it should provide
Meter
- Its javadoc says: "Meter is a simple, interface that allows users to record measurements (metrics)."
- In fact,
Meter
gives you builders - Isn't Meter something that you use to measure something?
- Like a "thermometer" measures temperature a "barometer" measures pressure, etc.
Instrument
- To me, this seems to be the component that should be called
Meter
- Its javadoc is a little confusing too: "Base interface for all metrics defined in this package."
- To me, this seems to be the component that should be called
LongCounterSdk
- Based on its name, it is a special type of
SDK
not a specialLongCounter
- Based on its name, it is a special type of
MetricProducer
- It has one method:
Collection<MetricData> collectAllMetrics();
- Based on this, shouldn't it be called
MetricCollector
?
- It has one method:
GlobalMetricsProvider
andMetricProducer
seems confusing next to each other- There are “missed” opportunities to use Java functional interfaces like
Supplier
for theProducer
/Provider
classes