title: Storm Metricstore layout: documentation documentation: true

A metric store (MetricStore) interface was added to Nimbus to allow storing metric information (Metric) to a database. The default implementation (RocksDbStore) is using RocksDB, a key-value store.

As metrics are stored in RocksDB, their string values (for topology ID and executor ID, etc.) are converted to unique integer IDs, and these strings are also stored to the database as metadata indexed by the integer ID. When a metric is stored, it is also aggregated with any existing metric within the same 1, 10, and 60 minute timeframe.

The FilterOptions class provides an interface to select which options can be used to scan the metrics.

Configuration

The following configuation options exist:

storm.metricstore.class: "org.apache.storm.metricstore.rocksdb.RocksDbStore"
storm.metricprocessor.class: "org.apache.storm.metricstore.NimbusMetricProcessor"
storm.metricstore.rocksdb.location: "storm_rocks"
storm.metricstore.rocksdb.create_if_missing: true
storm.metricstore.rocksdb.metadata_string_cache_capacity: 4000
storm.metricstore.rocksdb.retention_hours: 240
  • storm.metricstore.class is the class that implements the (MetricStore).
  • storm.metricprocessor.class is the class that implements the (WorkerMetricsProcessor).
  • storm.metricstore.rocksdb.location provides to location of the RocksDB database on Nimbus
  • storm.metricstore.rocksdb.create_if_missing permits creating a RocksDB database if missing
  • storm.metricstore.rocksdb.metadata_string_cache_capacity controls the number of metadata strings cached in memory.
  • storm.metricstore.rocksdb.retention_hours sets the length of time metrics will remain active.

RocksDB Schema

The RocksDB Key (represented by RocksDbKey) fields are as follows:

FieldSizeOffsetDescription
Type10The type maps to the KeyType enum, specifying a metric or various types of metadata strings
Aggregation Level11The aggregation level for a metric (see AggLevel enum). Set to 0 for metadata.
Topology Id42The metadata string Id representing a topologyId for a metric, or the unique string Id for a metadata string
Timestamp86The timestamp for a metric, unused for metadata
Metric Id414The metadata string Id for the metric name
Component Id418The metadata string Id for the component Id
Executor Id422The metadata string Id for the executor Id
Host Id426The metadata string Id for the host Id
Port430The port number
Stream Id434The metadata string Id for the stream Id

The RocksDB Value fields for metadata strings (represented by RocksDbValue) are as follows:

FieldSizeOffsetDescription
Version10The current metadata version - allows migrating if the format changes in the future
Timestamp81The time when the metadata was last used by a metric. Allows deleting of old metadata.
Metadata Stringany9The metadata string

RocksDB Value fields for metric data are as follows:

FieldSizeOffsetDescription
Version10The current metric version - allows migrating if the format changes in the future
Value81The metric value
Count89The metric count
Min817The minimum metric value
Max825The maximum metric value
Sum833The sum of the metric values