Package org.elasticsearch.telemetry
Class MetricRecorder<I>
java.lang.Object
org.elasticsearch.telemetry.MetricRecorder<I>
- Type Parameters:
I- The supertype of the registered instrument.
Container for registered Instruments (either
Instrument or Otel's versions).
Records invocations of the Instruments as Measurements.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRecord a call made to the registered instrument represented by theInstrumentTypeenum.voidRecord a call made to a registered ElasticsearchInstrument.voidcollect()getInstrument(InstrumentType instrumentType, String name) Fetch the instrument instance given the type and registered name.getMeasurements(InstrumentType instrumentType, String name) getMeasurements(Instrument instrument) Get theMeasurements for each call of the given registered ElasticsearchInstrument.getRegisteredMetrics(InstrumentType instrumentType) getRegistration(Instrument instrument) Get theRegistrationfor a given elasticsearchInstrument.voidRegister an instrument.void
-
Constructor Details
-
MetricRecorder
public MetricRecorder()
-
-
Method Details
-
register
public void register(I instrument, InstrumentType instrumentType, String name, String description, String unit) Register an instrument. Instruments must be registered before they are used. -
call
Record a call made to a registered ElasticsearchInstrument. -
call
public void call(InstrumentType instrumentType, String name, Number value, Map<String, Object> attributes) Record a call made to the registered instrument represented by theInstrumentTypeenum. -
getMeasurements
Get theMeasurements for each call of the given registered ElasticsearchInstrument. -
getMeasurements
-
getRegisteredMetrics
-
getRegistration
Get theRegistrationfor a given elasticsearchInstrument. -
getInstrument
Fetch the instrument instance given the type and registered name. -
resetCalls
public void resetCalls() -
collect
public void collect()
-