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

STORM-3186: Customizable configuration for metric reporting interval #3132

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions conf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ pacemaker.thrift.message.size.max: 10485760
#default storm daemon metrics reporter plugins
storm.daemon.metrics.reporter.plugins:
- "org.apache.storm.daemon.metrics.reporters.JmxPreparableReporter"
storm.daemon.metrics.reporter.interval.secs: 10

storm.metricstore.class: "org.apache.storm.metricstore.rocksdb.RocksDbStore"
storm.metricprocessor.class: "org.apache.storm.metricstore.NimbusMetricProcessor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public class DaemonConfig implements Validated {
@IsString
public static final String STORM_DAEMON_METRICS_REPORTER_PLUGIN_DOMAIN = "storm.daemon.metrics.reporter.plugin.domain";

/**
* We report the metrics with this interval period.
*/
@IsInteger
public static final String STORM_DAEMON_METRICS_REPORTER_INTERVAL_SECS = "storm.daemon.metrics.reporter.interval.secs";

/**
* Specify the csv reporter directory for CvsPreparableReporter daemon metrics reporter.
*/
Expand Down Expand Up @@ -339,7 +345,7 @@ public class DaemonConfig implements Validated {
@IsInteger
@IsPositiveNumber
public static final String UI_PORT = "ui.port";

/**
* Storm UI's title.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.apache.storm.DaemonConfig;
import org.apache.storm.daemon.metrics.MetricsUtils;
import org.apache.storm.utils.ObjectReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ConsolePreparableReporter implements PreparableReporter {
private static final Logger LOG = LoggerFactory.getLogger(ConsolePreparableReporter.class);
ConsoleReporter reporter = null;
Integer reportingIntervalSecs = null;

@Override
public void prepare(MetricRegistry metricsRegistry, Map<String, Object> daemonConf) {
Expand All @@ -46,13 +50,14 @@ public void prepare(MetricRegistry metricsRegistry, Map<String, Object> daemonCo
builder.convertDurationsTo(durationUnit);
}
reporter = builder.build();
reportingIntervalSecs = ObjectReader.getInt(daemonConf.get(DaemonConfig.STORM_DAEMON_METRICS_REPORTER_INTERVAL_SECS), 10);
}

@Override
public void start() {
if (reporter != null) {
LOG.debug("Starting...");
reporter.start(10, TimeUnit.SECONDS);
reporter.start(reportingIntervalSecs, TimeUnit.SECONDS);
} else {
throw new IllegalStateException("Attempt to start without preparing " + getClass().getSimpleName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.apache.storm.DaemonConfig;
import org.apache.storm.daemon.metrics.MetricsUtils;
import org.apache.storm.utils.ObjectReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CsvPreparableReporter implements PreparableReporter {
private static final Logger LOG = LoggerFactory.getLogger(CsvPreparableReporter.class);
CsvReporter reporter = null;
Integer reportingIntervalSecs = null;

@Override
public void prepare(MetricRegistry metricsRegistry, Map<String, Object> daemonConf) {
Expand All @@ -48,13 +52,14 @@ public void prepare(MetricRegistry metricsRegistry, Map<String, Object> daemonCo

File csvMetricsDir = MetricsUtils.getCsvLogDir(daemonConf);
reporter = builder.build(csvMetricsDir);
reportingIntervalSecs = ObjectReader.getInt(daemonConf.get(DaemonConfig.STORM_DAEMON_METRICS_REPORTER_INTERVAL_SECS), 10);
}

@Override
public void start() {
if (reporter != null) {
LOG.debug("Starting...");
reporter.start(10, TimeUnit.SECONDS);
reporter.start(reportingIntervalSecs, TimeUnit.SECONDS);
} else {
throw new IllegalStateException("Attempt to start without preparing " + getClass().getSimpleName());
}
Expand Down