@Contract
public interface MetricsService
MetricRegistry
s within an multi-application environment.
The main purpose of this API is to cleanly decouple the users from the service provider and to avoid API pollution
with methods that might be added to test or integrate the implementation but should not be called anywhere else.Modifier and Type | Interface and Description |
---|---|
static interface |
MetricsService.MetricsContext
Each deployed application has its own
MetricsService.MetricsContext . |
Modifier and Type | Method and Description |
---|---|
MetricsService.MetricsContext |
getContext(boolean createIfNotExists)
Access current application metric context.
|
MetricsService.MetricsContext |
getContext(String name)
Access the context by name.
|
Set<String> |
getContextNames() |
boolean |
isEnabled()
When metrics are disabled no
MetricsService.MetricsContext exists, both getContext(boolean) and
getContext(String) will return null. |
void |
refresh()
Triggers update of internal state usually used after configuration changes that can have the effect that metrics
appear or disappear in a way that is detected by the registry.
|
boolean isEnabled()
MetricsService.MetricsContext
exists, both getContext(boolean)
and
getContext(String)
will return null.void refresh()
Set<String> getContextNames()
MetricsService.MetricsContext
that currently exist. When applications are undeployed their
MetricsService.MetricsContext
equally are removed which means a name from the set of names returned may indeed
no longer exists when using getContext(boolean)
.MetricsService.MetricsContext getContext(boolean createIfNotExists)
createIfNotExists
- true to create the requested context in case it did not exist, false to instead return
null in that caseisEnabled()
MetricsService.MetricsContext getContext(String name)
MetricsService.MetricsContext.SERVER_CONTEXT_NAME
if needed but no
other context that does not exist yet or no more.name
- the name of the MetricsService.MetricsContext
to provide, this assumes it does existisEnabled()
no context exists. Otherwise when asking for the
MetricsService.MetricsContext.SERVER_CONTEXT_NAME
the context is created should it not exist yet.Copyright © 2021. All rights reserved.