Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing start log message in PushMeterRegistry implementations #4848

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ public void start(ThreadFactory threadFactory) {
stop();

if (config.enabled()) {
logger.info("publishing metrics for " + getClass().getSimpleName() + " every "
+ TimeUtils.format(config.step()));
logger.info(startMessage());

scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(threadFactory);
long stepMillis = config.step().toMillis();
Expand All @@ -118,6 +117,17 @@ public void start(ThreadFactory threadFactory) {
}
}

/**
* Message that will be logged when the registry is {@link #start(ThreadFactory)
* started}. This can be overridden to customize the message with info specific to the
* registry implementation that may be helpful in troubleshooting. By default, the
* registry class name and step interval are included.
* @return message to log on registry start
*/
protected String startMessage() {
return "publishing metrics for " + getClass().getSimpleName() + " every " + TimeUtils.format(config.step());
}

public void stop() {
if (scheduledExecutorService != null) {
scheduledExecutorService.shutdown();
Expand Down