Skip to content

[Issue #7419] [WIP] Enable pulsar component to send their metrics to topics#7433

Closed
KannarFr wants to merge 18 commits intoapache:masterfrom
CleverCloud:metrics
Closed

[Issue #7419] [WIP] Enable pulsar component to send their metrics to topics#7433
KannarFr wants to merge 18 commits intoapache:masterfrom
CleverCloud:metrics

Conversation

@KannarFr
Copy link
Contributor

@KannarFr KannarFr commented Jul 2, 2020

Fixes #7419

Motivation

Enable pulsar components to send their metrics to defined topics in a dedicated tenant.

Modifications

Create a MetricsSender interface and fill it with PulsarMetricsSender as the "to pulsar" sender.

Verifying this change

This change added tests and can be verified as follows:

  • tests are/will be defined in PulsarMetricsSenderTest

Does this pull request potentially affect one of the following parts:

  • configuration points to define interval & tenant to send.

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? docs
  • If a feature is not applicable for documentation, explain why? WIP

Comment on lines 72 to 253
public void start() {
final int interval = this.conf.intervalInSeconds;
log.info("Scheduling a thread to send metrics after [{}] seconds in background", interval);
this.metricsSenderExecutor.scheduleAtFixedRate(safeRun(this::getAndSendMetrics), interval, interval, TimeUnit.SECONDS);
getAndSendMetrics();
}

@Override
public void getAndSendMetrics() {
List<Metrics> metricsToSend = this.pulsar.getBrokerService().getTopicMetrics();

metricsToSend.forEach(metrics -> {
try {
log.info("Sending metrics [{}]", metrics.toString());
this.producer.send(metrics.toString());
} catch (PulsarClientException e) {
e.printStackTrace();
}
});
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we embed a retry with backoff stuff?

@KannarFr KannarFr changed the title [WIP] Enable pulsar component to send their metrics to topics [Issue #7419] [WIP] Enable pulsar component to send their metrics to topics Jul 2, 2020
@KannarFr KannarFr force-pushed the metrics branch 3 times, most recently from 3230d71 to 900c7ec Compare August 12, 2020 18:34
Copy link
Member

@sijie sijie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why know just write an agent to collect the stats and write the stats to a Pulsar topic? It doesn't have to write such code at the broker side.

@KannarFr
Copy link
Contributor Author

KannarFr commented Sep 4, 2020

@sijie pull-based collection requires a more complex infra, but also for the monitored system to buffer data during polling. So when it's under load, you'll choose between eating memory or losing data. While in push, the data is out ASAP and the collector makes that decision. So push scales much better than poll particularly in the broker case where monitoring data increases with topics number.

WDYT?

@sijie
Copy link
Member

sijie commented Jan 13, 2021

@KannarFr You can install a local agent per bookie to scrap the metrics from the local endpoint and push it to your metrics system. How is that different from adding a sender in Pulsar?

@KannarFr KannarFr closed this Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose pulsar's metrics in topics

2 participants

Comments