-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
This is an implementation detail of #18107, which will provide a ratio metric to track the bytes-in vs bytes-out of PQ compression.
As a: developer who needs to expose metrics via the Logstash HTTP API,
I want: a method for defining my own metric
So that: I can provide api-private metric implementations without wiring each new implementation through the public API
To this end:
Add a method to the public-api co.elastic.logstash.api.NamespacedMetric
:
<U extends UserMetric<?>> U register(String metric, UserMetric.Factory<U> userMetricFactory);
Where UserMetric
and UserMetric.Factory
are defined as:
public interface UserMetric<T extends Serializable> {
T getValue();
interface Factory<U extends UserMetric<?>> {
U create(String name);
Class<U> getType();
U nullImplementation();
}
}
And wire it through to the underlying metric collector.
NOTE:
- naming TBD
- We may need a
co.elastic.logstash.api.MetricType
(which would be a super-interface for the existing enumorg.logstash.instrument.metrics.MetricType
) so that we can construct aorg.logstash.instrument.metrics.Metric<?>
-- although theMetricType
is only actually used for gauge-type metrics.
Metadata
Metadata
Assignees
Labels
No labels