Expand description

Query Engine Metrics This crate is responsible for capturing and recording metrics in the Query Engine. Metrics is broken into two parts, MetricsRecorder and MetricsRegistry, and uses our tracing framework to communicate. An example best explains this system. When the engine boots up, the MetricRegistry is added to our tracing as a layer and The MetricRecorder is set as the global metric recorder. When a metric value is recorded gauge_increment!("my_gauge", 1.0) is called. The Metric Recorder is called with register_gauge and returns a MetricHandle. The MetricHandle will convert ``gauge_increment!(“my_gauge”, 1.0)into atrace!` message.

The trace message is received by the MetricRegistry and converted into a MetricVisitor with all the information required to record the metric and the value. The MetricVisitor is then processed and the metric value added to the Registry.

To view the recorded metrics we create a Snapshot of our metrics and then return it in json format. A few things to note:

  • We have an ACCEPT_LIST and those are the only metrics we capture. We don’t want to accidentally record other metrics recorded by external libraries that could leak more information than we want to expose.
  • The Histogram we use is a Cumulative Histogram. Meaning that a value is added to each bucket that the sample is smaller than. This seems to be the way Prometheus expects it
  • At the moment, with the Histogram we only support one type of bucket which is a bucket for timings in milliseconds.

Re-exports

Macros

Structs

Enums

Constants

Functions