base/frameworks/telemetry/main.zeek
- Telemetry
Module for recording and querying metrics. This modules wraps the lower-level telemetry.bif functions.
Metrics will be exposed through a Prometheus HTTP endpoint when
enabled by setting Telemetry::metrics_port.
- Namespace:
Telemetry
- Imports:
base/bif/telemetry_functions.bif.zeek, base/misc/version.zeek
Summary
Types
Type representing a counter metric with initialized label values. |
|
Type representing a family of counters with uninitialized label values. |
|
Type representing a gauge metric with initialized label values. |
|
Type representing a family of gauges with uninitialized label values. |
|
Type representing a histogram metric with initialized label values. |
|
Type representing a family of histograms with uninitialized label values. |
|
Alias for a vector of label values. |
Functions
Collect all histograms and their observations matching the given prefix and name. |
|
Collect all counter and gauge metrics matching the given name and prefix. |
|
Increment a |
|
Set a |
|
Increment a |
|
Helper to set a |
|
Get a |
|
Decrement a |
|
Decrement a |
|
Increment a |
|
Set a |
|
Increment a |
|
Helper to set a |
|
Get a |
|
Observe a measurement for a |
|
Observe a measurement for a |
|
Get a |
|
Register a counter family. |
|
Register a gauge family. |
|
Register a histogram family. |
Detailed Interface
Types
- Telemetry::Counter
-
Type representing a counter metric with initialized label values.
Counter metrics only ever go up and reset when the process restarts. Use
Telemetry::counter_incorTelemetry::counter_setto modify counters. An example for a counter is the number of log writes perLog::Streamor number connections broken down by protocol and service.
- Telemetry::CounterFamily
-
Type representing a family of counters with uninitialized label values.
To create concrete
Telemetry::Counterinstances, useTelemetry::counter_with. To modify counters directly useTelemetry::counter_family_inc.
- Telemetry::Gauge
-
Type representing a gauge metric with initialized label values.
Use
Telemetry::gauge_inc,Telemetry::gauge_dec, orTelemetry::gauge_setto modify the gauge. Example for gauges are process memory usage, table sizes or footprints of long-lived values as determined byval_footprint.
- Telemetry::GaugeFamily
-
Type representing a family of gauges with uninitialized label values.
Create concrete
Telemetry::Gaugeinstances withTelemetry::gauge_with, or useTelemetry::gauge_family_incorTelemetry::gauge_family_setdirectly.
- Telemetry::Histogram
-
Type representing a histogram metric with initialized label values. Use
Telemetry::histogram_observeto make observations.
- Telemetry::HistogramFamily
-
Type representing a family of histograms with uninitialized label values. Create concrete
Telemetry::Histograminstances withTelemetry::histogram_withor useTelemetry::histogram_family_observedirectly.
- Telemetry::labels_vector
-
Alias for a vector of label values.
Functions
- Telemetry::collect_histogram_metrics
- Type:
function(prefix:string&default="*"&optional, name:string&default="*"&optional) :vectorofTelemetry::HistogramMetric
Collect all histograms and their observations matching the given prefix and name.
The prefix and name parameters support globbing. By default, all histogram metrics are returned.
- Telemetry::collect_metrics
- Type:
function(prefix:string&default="*"&optional, name:string&default="*"&optional) :vectorofTelemetry::Metric
Collect all counter and gauge metrics matching the given name and prefix.
For histogram metrics, use the
Telemetry::collect_histogram_metrics.The prefix and name parameters support globbing. By default, all counters and gauges are returned.
- Telemetry::counter_family_inc
- Type:
function(cf:Telemetry::CounterFamily, label_values:Telemetry::labels_vector&default=[]&optional, amount:double&default=1.0&optional) :bool
Increment a
Telemetry::Counterthrough theTelemetry::CounterFamily. This is a short-cut forTelemetry::counter_inc. Using a negative amount is an error.- Parameters:
cf – The counter family to use.
label_values – The label values to use for the counter.
amount – The amount by which to increment the counter.
- Returns:
True if the counter was incremented successfully.
- Telemetry::counter_family_set
- Type:
function(cf:Telemetry::CounterFamily, label_values:Telemetry::labels_vector, value:double) :bool
Set a
Telemetry::Counterthrough theTelemetry::CounterFamily. This is a short-cut forTelemetry::counter_set. Setting a value that is less than the current value of the metric is an error and will be ignored.- Parameters:
cf – The counter family to use.
label_values – The label values to use for the counter.
value – The value to set the counter to.
- Returns:
True if the counter value was set successfully.
- Telemetry::counter_inc
-
Increment a
Telemetry::Counterbyamount. Using a negativeamountis an error.- Parameters:
c – The counter instance.
amount – The amount by which to increment the counter.
- Returns:
True if the counter was incremented successfully.
- Telemetry::counter_set
- Type:
function(c:Telemetry::Counter, value:double) :bool
Helper to set a
Telemetry::Counterto the givenvalue. This can be useful for mirroring counter metrics in anTelemetry::synchook implementation. Setting a value that is less than the current value of the metric is an error and will be ignored.- Parameters:
c – The counter instance.
value – The value to set the counter to.
- Returns:
True if the counter value was set successfully.
- Telemetry::counter_with
- Type:
function(cf:Telemetry::CounterFamily, label_values:Telemetry::labels_vector&default=[]&optional) :Telemetry::Counter
Get a
Telemetry::Counterinstance given family and label values.
- Telemetry::gauge_dec
-
Decrement a
Telemetry::Gaugebyamount.- Parameters:
g – The gauge instance.
amount – The amount by which to decrement the gauge.
- Returns:
True if the gauge was incremented successfully.
- Telemetry::gauge_family_dec
- Type:
function(gf:Telemetry::GaugeFamily, label_values:Telemetry::labels_vector&default=[]&optional, value:double&default=1.0&optional) :bool
Decrement a
Telemetry::Gaugeby the givenamountthrough theTelemetry::GaugeFamily. This is a short-cut forTelemetry::gauge_dec.- Parameters:
gf – The gauge family to use.
label_values – The label values to use for the gauge.
amount – The amount by which to increment the gauge.
- Returns:
True if the gauge was incremented successfully.
- Telemetry::gauge_family_inc
- Type:
function(gf:Telemetry::GaugeFamily, label_values:Telemetry::labels_vector&default=[]&optional, value:double&default=1.0&optional) :bool
Increment a
Telemetry::Gaugeby the givenamountthrough theTelemetry::GaugeFamily. This is a short-cut forTelemetry::gauge_inc. Using a negative amount is an error.- Parameters:
gf – The gauge family to use.
label_values – The label values to use for the gauge.
amount – The amount by which to increment the gauge.
- Returns:
True if the gauge was incremented successfully.
- Telemetry::gauge_family_set
- Type:
function(gf:Telemetry::GaugeFamily, label_values:Telemetry::labels_vector, value:double) :bool
Set a
Telemetry::Gaugeto the givenvaluethrough theTelemetry::GaugeFamily. This is a short-cut forTelemetry::gauge_set.- Parameters:
gf – The gauge family to use.
label_values – The label values to use for the gauge.
value – The value to set the gauge to.
- Returns:
True if the gauge value was set successfully.
- Telemetry::gauge_inc
-
Increment a
Telemetry::Gaugebyamount.- Parameters:
g – The gauge instance.
amount – The amount by which to increment the gauge.
- Returns:
True if the gauge was incremented successfully.
- Telemetry::gauge_set
- Type:
function(g:Telemetry::Gauge, value:double) :bool
Helper to set a
Telemetry::Gaugeto the givenvalue.- Parameters:
g – The gauge instance.
value – The value to set the gauge to.
- Returns:
True if the gauge value was set successfully.
- Telemetry::gauge_with
- Type:
function(gf:Telemetry::GaugeFamily, label_values:Telemetry::labels_vector&default=[]&optional) :Telemetry::Gauge
Get a
Telemetry::Gaugeinstance given family and label values.
- Telemetry::histogram_family_observe
- Type:
function(hf:Telemetry::HistogramFamily, label_values:Telemetry::labels_vector, measurement:double) :bool
Observe a measurement for a
Telemetry::Histogramthrough theTelemetry::HistogramFamily. This is a short-cut forTelemetry::histogram_observe.- Parameters:
hf – The histogram family to use.
label_values – The label values to use for the histogram.
measurement – The value for this observations.
- Returns:
True if measurement was observed successfully.
- Telemetry::histogram_observe
- Type:
function(h:Telemetry::Histogram, measurement:double) :bool
Observe a measurement for a
Telemetry::Histogram.- Parameters:
h – The histogram instance.
measurement – The value for this observations.
- Returns:
True if measurement was observed successfully.
- Telemetry::histogram_with
- Type:
function(hf:Telemetry::HistogramFamily, label_values:Telemetry::labels_vector&default=[]&optional) :Telemetry::Histogram
Get a
Telemetry::Histograminstance given family and label values.
- Telemetry::register_counter_family
- Type:
function(opts:Telemetry::MetricOpts) :Telemetry::CounterFamily
Register a counter family.
- Telemetry::register_gauge_family
- Type:
function(opts:Telemetry::MetricOpts) :Telemetry::GaugeFamily
Register a gauge family.
- Telemetry::register_histogram_family
- Type:
function(opts:Telemetry::MetricOpts) :Telemetry::HistogramFamily
Register a histogram family.