Skip to content

Commit

Permalink
Provide a flag to disable managed ledger metrics (apache#10885)
Browse files Browse the repository at this point in the history
  • Loading branch information
sijie authored Jun 10, 2021
1 parent 18f2f4a commit 3de089c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions conf/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,12 @@ exposeConsumerLevelMetricsInPrometheus=false
# Enable producer level metrics. default is false
exposeProducerLevelMetricsInPrometheus=false

# Enable managed ledger metrics (aggregated by namespace). default is false
exposeManagedLedgerMetricsInPrometheus=true

# Enable cursor level metrics. default is false
exposeManagedCursorMetricsInPrometheus=false

# Classname of Pluggable JVM GC metrics logger that can log GC specific metrics
# jvmGCMetricsLoggerClassName=

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,11 @@ public class ServiceConfiguration implements PulsarConfiguration {
doc = "If true, export producer level metrics otherwise namespace level"
)
private boolean exposeProducerLevelMetricsInPrometheus = false;
@FieldContext(
category = CATEGORY_METRICS,
doc = "If true, export managed ledger metrics (aggregated by namespace)"
)
private boolean exposeManagedLedgerMetricsInPrometheus = true;
@FieldContext(
category = CATEGORY_METRICS,
doc = "If true, export managed cursor metrics"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,16 @@ private static void generateBrokerBasicMetrics(PulsarService pulsar, SimpleTextO
parseMetricsToPrometheusMetrics(new ManagedLedgerCacheMetrics(pulsar).generate(),
clusterName, Collector.Type.GAUGE, stream);

// generate managedLedger metrics
parseMetricsToPrometheusMetrics(new ManagedLedgerMetrics(pulsar).generate(),
if (pulsar.getConfiguration().isExposeManagedLedgerMetricsInPrometheus()) {
// generate managedLedger metrics
parseMetricsToPrometheusMetrics(new ManagedLedgerMetrics(pulsar).generate(),
clusterName, Collector.Type.GAUGE, stream);
}

if (pulsar.getConfiguration().isExposeManagedCursorMetricsInPrometheus()) {
// generate managedCursor metrics
parseMetricsToPrometheusMetrics(new ManagedCursorMetrics(pulsar).generate(),
clusterName, Collector.Type.GAUGE, stream);
clusterName, Collector.Type.GAUGE, stream);
}

parseMetricsToPrometheusMetrics(Collections.singletonList(pulsar.getBrokerService()
Expand Down

0 comments on commit 3de089c

Please sign in to comment.