Skip to content

Commit

Permalink
Log number of seconds it takes the broker to bootstrap. (apache#10819)
Browse files Browse the repository at this point in the history
Use TimeUnit for the conversion, changed bootstrap_second log format.
  • Loading branch information
ciaocloud committed Oct 16, 2021
1 parent e19fd1a commit 84f8035
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -568,6 +568,8 @@ public void start() throws PulsarServerException {
PulsarVersion.getBuildHost(),
PulsarVersion.getBuildTime());

long startTimestamp = System.currentTimeMillis(); // start time mills

mutex.lock();
try {
if (state != State.Init) {
Expand Down Expand Up @@ -802,13 +804,15 @@ config, localMetadataStore, getZkClient(), bkClientFactory, ioEventLoopGroup
this.resourceUsageTransportManager = (ResourceUsageTransportManager) object;
}

long currentTimestamp = System.currentTimeMillis();
final long bootstrapTimeSeconds = TimeUnit.MILLISECONDS.toSeconds(currentTimestamp - startTimestamp);

final String bootstrapMessage = "bootstrap service "
+ (config.getWebServicePort().isPresent() ? "port = " + config.getWebServicePort().get() : "")
+ (config.getWebServicePortTls().isPresent() ? ", tls-port = " + config.getWebServicePortTls() : "")
+ (config.getBrokerServicePort().isPresent() ? ", broker url= " + brokerServiceUrl : "")
+ (config.getBrokerServicePortTls().isPresent() ? ", broker tls url= " + brokerServiceUrlTls : "");
LOG.info("messaging service is ready");

LOG.info("messaging service is ready, bootstrap_seconds={}", bootstrapTimeSeconds);
LOG.info("messaging service is ready, {}, cluster={}, configs={}", bootstrapMessage,
config.getClusterName(), ReflectionToStringBuilder.toString(config));

Expand Down

0 comments on commit 84f8035

Please sign in to comment.