Class ActuatorOptions.Builder
- Enclosing class:
ActuatorOptions
-
Method Summary
Modifier and TypeMethodDescriptionapplication(String name, String version) What the application calls itself, reported by/acemq-info.attachToGlobalRegistry(boolean attachToGlobalRegistry) Whether a registry the actuator creates is added to Micrometer's global registry.bindAddress(String bindAddress) The interface to listen on.build()connection(AceMq connection) The connection/acemq-healthreports on and/acemq-infodescribes.healthPath(String healthPath) metricsPath(String metricsPath) Where the metrics are served.port(int port) The port to listen on.registry(io.micrometer.prometheusmetrics.PrometheusMeterRegistry registry) A registry to scrape instead of one the actuator creates.
-
Method Details
-
connection
The connection/acemq-healthreports on and/acemq-infodescribes.Optional. Without it the actuator still serves metrics, because a process may want its numbers scraped before it has connected to anything, and health then answers
UNKNOWNrather than inventing a verdict.- Parameters:
connection- the connection to report on- Returns:
- this builder
-
bindAddress
The interface to listen on. Loopback by default.These endpoints are unauthenticated. They name queues, report broker state and show traffic rates, which is more than an anonymous caller on the network should learn about a service. Binding to
0.0.0.0publishes all of it to anything that can reach the port.Leave it on loopback and let the scraper reach it from the same host, the same pod, or a sidecar; where it genuinely has to be reachable from elsewhere, put something in front that authenticates. This library will not do that for you, and says so rather than implying otherwise by shipping a token check nobody configures.
- Parameters:
bindAddress- the address to bind- Returns:
- this builder
-
port
The port to listen on.- Parameters:
port- the port, or 0 to take an ephemeral one -- which is what a test wants, because a fixed port makes two tests that both bind it fail depending on order- Returns:
- this builder
-
metricsPath
Where the metrics are served.Namespaced by default so it cannot collide with an application's own
/metrics. Change it if you like, but the scrape configuration has to change with it: a Prometheus job pointed at the old path reports the target as down rather than as misconfigured, and those read very differently at three in the morning.- Parameters:
metricsPath- the path, starting with a slash- Returns:
- this builder
-
healthPath
- Parameters:
healthPath- where the health report is served, starting with a slash- Returns:
- this builder
-
infoPath
- Parameters:
infoPath- where the library and transport information is served- Returns:
- this builder
-
application
What the application calls itself, reported by/acemq-info.So a running instance can say what it is without anybody having to ask the deployment that started it.
- Parameters:
name- the application's nameversion- the application's version- Returns:
- this builder
-
registry
public ActuatorOptions.Builder registry(io.micrometer.prometheusmetrics.PrometheusMeterRegistry registry) A registry to scrape instead of one the actuator creates.For the explicit wiring the observability guide prefers: build the registry, hand it to
MicrometerSupport.telemetry(registry, transport)when connecting, and pass the same one here. Nothing then depends on Micrometer's global registry, which is process-wide mutable state that two connections cannot report into separately.A registry supplied this way is never added to the global registry and is never closed by
AceMqActuator.close(): the actuator did not create it and has no business deciding when it ends.- Parameters:
registry- the registry to serve- Returns:
- this builder
-
attachToGlobalRegistry
Whether a registry the actuator creates is added to Micrometer's global registry.True by default, and that default is what makes
AceMqActuator.start(mq)work with no other wiring:AceMq.connect(url)with no telemetry argument detects Micrometer and records into the global registry, so attaching to it is what connects the numbers the library is already producing to the endpoint serving them.Start the actuator before the traffic. Micrometer replays the meters that already exist into a registry added later, but only their registration, not their accumulated values: anything counted before the actuator started is counted nowhere this endpoint can see. Nothing breaks visibly -- the series appears, the scrape parses, the number is simply low -- which is why it is said here rather than left to be discovered. Wire
registry(PrometheusMeterRegistry)explicitly if the ordering cannot be arranged.Turn it off to keep this endpoint to the meters you route here yourself. It has no effect on a registry passed to
registry(PrometheusMeterRegistry), which is never attached.- Parameters:
attachToGlobalRegistry- whether to attach- Returns:
- this builder
-
build
- Returns:
- the options
-