Interface Counter
Records a monotonically increasing value that is updated by invoking methods on the
Counter instance.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface Meter
Meter.BaseUnits, Meter.Id, Meter.Scope, Meter.TypeModifier and TypeInterfaceDescriptionstatic classCommon unit declarations (inspired by the list from MicroProfile metrics).static interfaceUnique idenfier for a meter.static classDeprecated, for removal: This API element is subject to removal in a future version.Core metrics ignores scope values, and this type will be removed.static enumType of meter. -
Method Summary
Modifier and TypeMethodDescriptionstatic Counter.BuilderDeprecated, for removal: This API element is subject to removal in a future version.this method uses service registry to get aMetricsFactoryinstance, which may be inefficient, useMetricsFactory.counterBuilder(String)insteadlongcount()Returns the cumulative count since this counter was registered.voidUpdates the counter by one.voidincrement(long amount) Updates the counter by the specified amount which should be non-negative.Methods inherited from interface Meter
baseUnit, description, id, scope, typeModifier and TypeMethodDescriptionbaseUnit()Returns the meter's base unit.Returns the meter's description.id()Returns the meter ID.scope()Deprecated, for removal: This API element is subject to removal in a future version.Core metrics does not assign scopes, and this method will be removed.type()Returns the meter type.
-
Method Details
-
builder
Deprecated, for removal: This API element is subject to removal in a future version.this method uses service registry to get aMetricsFactoryinstance, which may be inefficient, useMetricsFactory.counterBuilder(String)insteadCreates a new builder for a counter.- Parameters:
name- counter name- Returns:
- new builder
-
increment
void increment()Updates the counter by one. -
increment
void increment(long amount) Updates the counter by the specified amount which should be non-negative.- Parameters:
amount- amount to add to the counter.
-
count
long count()Returns the cumulative count since this counter was registered.- Returns:
- cumulative count since this counter was registered
-