From 6708499e4c930f7733894e6076b925fb151d9251 Mon Sep 17 00:00:00 2001 From: Maxim Muzafarov Date: Mon, 11 Sep 2023 20:14:40 +0200 Subject: [PATCH] Remove metrics-reporter-config dependency patch by Maxim Muzafarov; reviewed by Ekaterina Dimitrova and Brandon Williams for CASSANDRA-18743 --- .build/build-rat.xml | 1 - CHANGES.txt | 1 + NEWS.txt | 2 + conf/jvm-server.options | 3 -- conf/metrics-reporter-config-sample.yaml | 41 ------------------- .../pages/getting-started/configuring.adoc | 4 +- .../configuration/cass_env_sh_file.adoc | 5 --- .../pages/managing/operating/metrics.adoc | 10 ----- .../config/CassandraRelevantProperties.java | 1 - .../cassandra/service/CassandraDaemon.java | 37 ----------------- 10 files changed, 4 insertions(+), 101 deletions(-) delete mode 100644 conf/metrics-reporter-config-sample.yaml diff --git a/.build/build-rat.xml b/.build/build-rat.xml index 330a256f09..2aaf9ad35c 100644 --- a/.build/build-rat.xml +++ b/.build/build-rat.xml @@ -43,7 +43,6 @@ - diff --git a/CHANGES.txt b/CHANGES.txt index 0622021b79..e8abddb227 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 5.0-alpha2 + * Remove metrics-reporter-config dependency (CASSANDRA-18743) * Fix SAI's SegmentMetadata min and max primary keys (CASSANDRA-18734) * Remove commons-codec dependency (CASSANDRA-18772) Merged from 4.1: diff --git a/NEWS.txt b/NEWS.txt index 6e986522a7..8cbbf63871 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -223,6 +223,8 @@ Upgrading You need to explicitly add this section to the old yaml if it does not contain it yet to enable Amazon Corretto Crypto Provider for such node. New deployments have `crypto_provider` uncommented with DefaultCryptoProvider hence Corretto provider will be installed automatically for corresponding architecture. - `commitlog_sync_batch_window_in_ms` configuration property in cassandra.yaml was removed. Please ensure your configuration is not using this property. + - The pluggable metrics reporter called metrics-reporter-config is removed. The way that metrics can be exported is + fully covered by the dropwizard metrics library itself, using e.g. CsvReporter. See CASSANDRA-18743 for more details. Deprecation diff --git a/conf/jvm-server.options b/conf/jvm-server.options index 88650bcb4d..227d1cf182 100644 --- a/conf/jvm-server.options +++ b/conf/jvm-server.options @@ -53,9 +53,6 @@ # information in cassandra.yaml (such as listen_address). #-Dcassandra.load_ring_state=true|false -# Enable pluggable metrics reporter. See Pluggable metrics reporting in Cassandra 2.0.2. -#-Dcassandra.metricsReporterConfigFile=file - # Set the port on which the CQL native transport listens for clients. (Default: 9042) #-Dcassandra.native_transport_port=port diff --git a/conf/metrics-reporter-config-sample.yaml b/conf/metrics-reporter-config-sample.yaml deleted file mode 100644 index 54f265770d..0000000000 --- a/conf/metrics-reporter-config-sample.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# For details see: -# * http://wiki.apache.org/cassandra/Metrics -# * https://github.com/addthis/metrics-reporter-config - -# This is an example file for configuring which metrics should go -# where. The sample sends everything to a flat file for humans to -# poke at. metrics-ganglia or metrics-graphite are more likely to -# operationally useful. - -# Some metrics are global for a node (KeyCache capacity) while others -# are broken down by column family or even IP. The sample list -# includes all of the global metrics via a while list. To include -# metrics for the system column family for example add -# "^org.apache.cassandra.metrics.ColumnFamily.system.+". - - -# Start Cassandra with -# -Dcassandra.metricsReporterConfigFile=metrics-reporter-config.yaml -# for this file to be used. If you are using metrics-ganglia, -# metrics-graphite, or a custom reporter you will also have to add those -# jars to the lib directory. Nothing in this file can affect -# jmx metrics. - - -console: - - - outfile: '/tmp/metrics.out' - period: 10 - timeunit: 'SECONDS' - predicate: - color: "white" - useQualifiedName: true - patterns: - - "^org.apache.cassandra.metrics.Cache.+" - - "^org.apache.cassandra.metrics.ClientRequest.+" # includes ClientRequestMetrics - - "^org.apache.cassandra.metrics.CommitLog.+" - - "^org.apache.cassandra.metrics.Compaction.+" - - "^org.apache.cassandra.metrics.DroppedMessage.+" - - "^org.apache.cassandra.metrics.ReadRepair.+" - - "^org.apache.cassandra.metrics.Storage.+" - - "^org.apache.cassandra.metrics.ThreadPools.+" diff --git a/doc/modules/cassandra/pages/getting-started/configuring.adoc b/doc/modules/cassandra/pages/getting-started/configuring.adoc index ba72f97917..00712d6132 100644 --- a/doc/modules/cassandra/pages/getting-started/configuring.adoc +++ b/doc/modules/cassandra/pages/getting-started/configuring.adoc @@ -24,10 +24,8 @@ clients * `commitlog_archiving.properties`: set archiving parameters for the `commitlog` -Two sample configuration files can also be found in `./conf`: +The sample configuration files can also be found in `./conf`: -* `metrics-reporter-config-sample.yaml`: configuring what the -metrics-report will collect * `cqlshrc.sample`: how the CQL shell, cqlsh, can be configured == Main runtime properties diff --git a/doc/modules/cassandra/pages/managing/configuration/cass_env_sh_file.adoc b/doc/modules/cassandra/pages/managing/configuration/cass_env_sh_file.adoc index d895186246..309b15b17d 100644 --- a/doc/modules/cassandra/pages/managing/configuration/cass_env_sh_file.adoc +++ b/doc/modules/cassandra/pages/managing/configuration/cass_env_sh_file.adoc @@ -71,11 +71,6 @@ Set to false to clear all gossip state for the node on restart. *Default:* true -== `cassandra.metricsReporterConfigFile=` - -Enable pluggable metrics reporter. Explore pluggable metrics reporting -for more information. - == `cassandra.partitioner=` Set the partitioner. diff --git a/doc/modules/cassandra/pages/managing/operating/metrics.adoc b/doc/modules/cassandra/pages/managing/operating/metrics.adoc index 29dd4617be..eb23cb7209 100644 --- a/doc/modules/cassandra/pages/managing/operating/metrics.adoc +++ b/doc/modules/cassandra/pages/managing/operating/metrics.adoc @@ -1080,13 +1080,3 @@ metrics can be exported to a number of monitoring system a number of http://metrics.dropwizard.io/3.1.0/getting-started/#other-reporting[built in] and http://metrics.dropwizard.io/3.1.0/manual/third-party/[third party] reporter plugins. - -The configuration of these plugins is managed by the -https://github.com/addthis/metrics-reporter-config[metrics reporter -config project]. There is a sample configuration file located at -`conf/metrics-reporter-config-sample.yaml`. - -Once configured, you simply start cassandra with the flag -`-Dcassandra.metricsReporterConfigFile=metrics-reporter-config.yaml`. -The specified .yaml file plus any 3rd party reporter jars must all be in -Cassandra's classpath. diff --git a/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java b/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java index 4e2956da94..a8b22994ad 100644 --- a/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java +++ b/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java @@ -347,7 +347,6 @@ public enum CassandraRelevantProperties MEMTABLE_OVERHEAD_SIZE("cassandra.memtable.row_overhead_size", "-1"), MEMTABLE_SHARD_COUNT("cassandra.memtable.shard.count"), MEMTABLE_TRIE_SIZE_LIMIT("cassandra.trie_size_limit_mb"), - METRICS_REPORTER_CONFIG_FILE("cassandra.metricsReporterConfigFile"), MIGRATION_DELAY("cassandra.migration_delay_ms", "60000"), /** Defines the maximum number of unique timed out queries that will be reported in the logs. Use a negative number to remove any limit. */ MONITORING_MAX_OPERATIONS("cassandra.monitoring_max_operations", "50"), diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java index 61320f823b..2407dea8d0 100644 --- a/src/java/org/apache/cassandra/service/CassandraDaemon.java +++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.lang.management.ManagementFactory; import java.lang.management.MemoryPoolMXBean; import java.net.InetAddress; -import java.net.URL; import java.net.UnknownHostException; import java.nio.file.Files; import java.nio.file.Path; @@ -40,14 +39,9 @@ import com.google.common.collect.ImmutableList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.addthis.metrics3.reporter.config.ReporterConfig; import com.codahale.metrics.Meter; import com.codahale.metrics.MetricRegistryListener; import com.codahale.metrics.SharedMetricRegistries; -import com.codahale.metrics.jvm.BufferPoolMetricSet; -import com.codahale.metrics.jvm.FileDescriptorRatioGauge; -import com.codahale.metrics.jvm.GarbageCollectorMetricSet; -import com.codahale.metrics.jvm.MemoryUsageGaugeSet; import org.apache.cassandra.audit.AuditLogManager; import org.apache.cassandra.auth.AuthCacheService; @@ -99,7 +93,6 @@ import static org.apache.cassandra.config.CassandraRelevantProperties.JAVA_CLASS import static org.apache.cassandra.config.CassandraRelevantProperties.JAVA_RMI_SERVER_RANDOM_ID; import static org.apache.cassandra.config.CassandraRelevantProperties.JAVA_VERSION; import static org.apache.cassandra.config.CassandraRelevantProperties.JAVA_VM_NAME; -import static org.apache.cassandra.config.CassandraRelevantProperties.METRICS_REPORTER_CONFIG_FILE; import static org.apache.cassandra.config.CassandraRelevantProperties.SIZE_RECORDER_INTERVAL; import static org.apache.cassandra.config.CassandraRelevantProperties.START_NATIVE_TRANSPORT; @@ -380,36 +373,6 @@ public class CassandraDaemon // Prepared statements QueryProcessor.instance.preloadPreparedStatements(); - // Metrics - String metricsReporterConfigFile = METRICS_REPORTER_CONFIG_FILE.getString(); - if (metricsReporterConfigFile != null) - { - logger.info("Trying to load metrics-reporter-config from file: {}", metricsReporterConfigFile); - try - { - // enable metrics provided by metrics-jvm.jar - CassandraMetricsRegistry.Metrics.register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); - CassandraMetricsRegistry.Metrics.register("jvm.gc", new GarbageCollectorMetricSet()); - CassandraMetricsRegistry.Metrics.register("jvm.memory", new MemoryUsageGaugeSet()); - CassandraMetricsRegistry.Metrics.register("jvm.fd.usage", new FileDescriptorRatioGauge()); - // initialize metrics-reporter-config from yaml file - URL resource = CassandraDaemon.class.getClassLoader().getResource(metricsReporterConfigFile); - if (resource == null) - { - logger.warn("Failed to load metrics-reporter-config, file does not exist: {}", metricsReporterConfigFile); - } - else - { - String reportFileLocation = resource.getFile(); - ReporterConfig.loadFromFile(reportFileLocation).enableAll(CassandraMetricsRegistry.Metrics); - } - } - catch (Exception e) - { - logger.warn("Failed to load metrics-reporter-config, metric sinks will not be activated", e); - } - } - // start server internals StorageService.instance.registerDaemon(this); try