- 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
Metricsinstances - In fact, it provides two things neither of them are
Metricsgetreturns aMeterProvidergetMeterreturns aMeter
- Based on its name, it should provide
MeterProvider- Based on its name, it should provide
Meterinstances - Its get method does return a
Meterinstance - But
getDefault(means "get the defaultMeter") returns aMeterProvider - Should not
getDefaultbegetDefaultInstance?
- 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,
Metergives 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
SDKnot 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:
GlobalMetricsProviderandMetricProducerseems confusing next to each other- There are “missed” opportunities to use Java functional interfaces like
Supplierfor theProducer/Providerclasses