- All Superinterfaces:
Wrapper
Manages the look-up and registration of meters.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceMeterRegistry.Builder<B extends MeterRegistry.Builder<B,R>, R extends MeterRegistry> Builder for creating a new meter registry. -
Method Summary
Modifier and TypeMethodDescriptionclock()Returns the defaultClockin use by the registry.voidclose()Closes the meter registry.Locates a previously-registered counter.Locates a previously-registered gauge.<B extends Meter.Builder<B,M>, M extends Meter>
MgetOrCreate(B builder) Locates a previously-registered meter using the name and tags in the provided builder or, if not found, registers a new one using the provided builder.booleanIndicates if the meter has been deleted.booleanReturns whether the specified meter is enabled or not, based on whether the meter registry as a whole is enabled and also whether the config settings for filtering include and exclude indicate the specific meter is enabled.Locates a previously-registered meter of the specified type, matching the name and tags.meters()Returns all previously-registered meters.Returns previously-registered meters which match one of the specified scopes.Returns previously-registered meters which match the specifiedPredicate.onMeterAdded(Consumer<Meter> onAddListener) Enroll a listener to be notified when aMeteris added.onMeterRemoved(Consumer<Meter> onRemoveListener) Enroll a listener to be notified when aMeteris removed.Removes a previously-registered meter.Removes a previously-registered meter with the specified ID.Removes a previously-registered meter with the specified ID and scope.Removes a previously-registered meter with the specified name and tags.Removes a previously-registered meter with the specified name, tags, and scope.scopes()Returns the scopes (if any) as represented by tags on meter IDs.default Optional<DistributionSummary> Locates a previously-registered distribution summary.Locates a previously-registered timer.
-
Method Details
-
meters
Returns all previously-registered meters.- Returns:
- registered meters
-
meters
Returns previously-registered meters which match the specifiedPredicate.- Parameters:
filter- the predicate with which to evaluate eachMeter- Returns:
- meters which match the predicate
-
meters
Returns previously-registered meters which match one of the specified scopes.- Parameters:
scopeSelection- scopes to match- Returns:
- matching meters
-
scopes
Returns the scopes (if any) as represented by tags on meter IDs.- Returns:
- scopes across all registered meters
-
close
void close()Closes the meter registry. -
isMeterEnabled
Returns whether the specified meter is enabled or not, based on whether the meter registry as a whole is enabled and also whether the config settings for filtering include and exclude indicate the specific meter is enabled.- Parameters:
name- name of the meter to checktags- tags of the meter to checkscope- scope, if present, of the meter to check- Returns:
- true if the meter (and its meter registry) are enabled; false otherwise
-
clock
Clock clock()Returns the defaultClockin use by the registry.- Returns:
- default clock
-
getOrCreate
Locates a previously-registered meter using the name and tags in the provided builder or, if not found, registers a new one using the provided builder.- Type Parameters:
B- builder for the meterM- type of the meter- Parameters:
builder- builder to use in finding or creating a meter- Returns:
- the previously-registered meter with the same name and tags or, if none, the newly-registered one
-
counter
Locates a previously-registered counter.- Parameters:
name- name to matchtags- tags to match- Returns:
Optionalof the previously-registered counter; empty if not found
-
summary
Locates a previously-registered distribution summary.- Parameters:
name- name to matchtags- tags to match- Returns:
Optionalof the previously-registered distribution summary; empty if not found
-
gauge
Locates a previously-registered gauge.- Parameters:
name- name to matchtags- tags to match- Returns:
Optionalof the previously-registered gauge; empty if not found
-
timer
Locates a previously-registered timer.- Parameters:
name- name to matchtags- tags to match- Returns:
Optionalof the previously-registered timer; empty if not found
-
meter
Locates a previously-registered meter of the specified type, matching the name and tags.The method throws an
ClassCastExceptionif a meter exists with the name and tags but is not type-compatible with the provided class.- Type Parameters:
M- type of the meter to find- Parameters:
mClass- type of the meter to findname- name to matchtags- tags to match- Returns:
Optionalof the previously-regsitered meter; empty if not found
-
remove
Removes a previously-registered meter.- Parameters:
meter- the meter to remove- Returns:
- the removed meter; empty if the meter is not currently registered
-
remove
Removes a previously-registered meter with the specified ID.- Parameters:
id- ID for the meter to remove- Returns:
- the removed meter; empty if the meter is not currently registered
-
remove
Removes a previously-registered meter with the specified ID and scope.- Parameters:
id- ID for the meter to removescope- scope of the meter to remove- Returns:
- the removed meter; empty if the specified ID and scope do not correspond to a registered meter
-
remove
Removes a previously-registered meter with the specified name and tags.- Parameters:
name- meter nametags- tags for further identifying the meter- Returns:
- the removed meter; empty if the specified name and tags do not correspond to a registered meter
-
remove
Removes a previously-registered meter with the specified name, tags, and scope.- Parameters:
name- meter nametags- tags for further identifying the meterscope- scope within which to locate the meter- Returns:
- the removed meter; empty if the specified name, tags, and scope do not correspond to a registered meter
-
isDeleted
Indicates if the meter has been deleted.- Parameters:
meter-Meterto check- Returns:
- true if the meter has been deleted; false if it is still active
-
onMeterAdded
Enroll a listener to be notified when aMeteris added.- Parameters:
onAddListener- listener to invoke upon each meter registration- Returns:
- the meter registry
-
onMeterRemoved
Enroll a listener to be notified when aMeteris removed.- Parameters:
onRemoveListener- listener to invoke upon each meter removal- Returns:
- the meter registry
-