mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Move base types from telemetry framework to init-bare
This commit is contained in:
parent
d7b9924058
commit
17d09c657b
2 changed files with 118 additions and 101 deletions
|
@ -14,49 +14,6 @@ export {
|
||||||
## Alias for a vector of label values.
|
## Alias for a vector of label values.
|
||||||
type labels_vector: vector of string;
|
type labels_vector: vector of string;
|
||||||
|
|
||||||
## Type that captures options used to create metrics.
|
|
||||||
type MetricOpts: record {
|
|
||||||
## The prefix (namespace) of the metric.
|
|
||||||
prefix: string;
|
|
||||||
|
|
||||||
## The human-readable name of the metric.
|
|
||||||
name: string;
|
|
||||||
|
|
||||||
## The unit of the metric. Set to a blank string if this is a unit-less metric.
|
|
||||||
unit: string;
|
|
||||||
|
|
||||||
## Documentation for this metric.
|
|
||||||
help_text: string;
|
|
||||||
|
|
||||||
## The label names (also called dimensions) of the metric. When
|
|
||||||
## instantiating or working with concrete metrics, corresponding
|
|
||||||
## label values have to be provided.
|
|
||||||
labels: vector of string &default=vector();
|
|
||||||
|
|
||||||
## Whether the metric represents something that is accumulating.
|
|
||||||
## Defaults to ``T`` for counters and ``F`` for gauges and
|
|
||||||
## histograms.
|
|
||||||
is_total: bool &optional;
|
|
||||||
|
|
||||||
## When creating a :zeek:see:`Telemetry::HistogramFamily`,
|
|
||||||
## describes the number and bounds of the individual buckets.
|
|
||||||
bounds: vector of double &optional;
|
|
||||||
|
|
||||||
## The same meaning as *bounds*, but as :zeek:type:`count`.
|
|
||||||
## Only set in the return value of
|
|
||||||
## :zeek:see:`Telemetry::collect_histogram_metrics`.
|
|
||||||
## for histograms when the underlying type is ``int64_t``,
|
|
||||||
## otherwise ignored.
|
|
||||||
count_bounds: vector of count &optional;
|
|
||||||
|
|
||||||
## Describes the underlying metric type.
|
|
||||||
## Only set in the return value of
|
|
||||||
## :zeek:see:`Telemetry::collect_metrics` or
|
|
||||||
## :zeek:see:`Telemetry::collect_histogram_metrics`,
|
|
||||||
## otherwise ignored.
|
|
||||||
metric_type: MetricType &optional;
|
|
||||||
};
|
|
||||||
|
|
||||||
## Type representing a family of counters with uninitialized label values.
|
## Type representing a family of counters with uninitialized label values.
|
||||||
##
|
##
|
||||||
## To create concrete :zeek:see:`Telemetry::Counter` instances, use
|
## To create concrete :zeek:see:`Telemetry::Counter` instances, use
|
||||||
|
@ -306,64 +263,6 @@ export {
|
||||||
## Interval at which the :zeek:see:`Telemetry::sync` hook is invoked.
|
## Interval at which the :zeek:see:`Telemetry::sync` hook is invoked.
|
||||||
option sync_interval = 10sec;
|
option sync_interval = 10sec;
|
||||||
|
|
||||||
## Type of elements returned by the :zeek:see:`Telemetry::collect_metrics` function.
|
|
||||||
type Metric: record {
|
|
||||||
## A :zeek:see:`Telemetry::MetricOpts` record describing this metric.
|
|
||||||
opts: MetricOpts;
|
|
||||||
|
|
||||||
## The label values associated with this metric, if any.
|
|
||||||
labels: vector of string;
|
|
||||||
|
|
||||||
## The value of gauge or counter cast to a double
|
|
||||||
## independent of the underlying data type.
|
|
||||||
## This value is set for all counter and gauge metrics,
|
|
||||||
## it is unset for histograms.
|
|
||||||
value: double &optional;
|
|
||||||
|
|
||||||
## The value of the underlying gauge or counter as a double
|
|
||||||
## if the underlying metric type uses ``int64_t``.
|
|
||||||
## Only counters and gauges created with the C++ API may
|
|
||||||
## have this value set.
|
|
||||||
count_value: count &optional;
|
|
||||||
};
|
|
||||||
|
|
||||||
## Type of elements returned by the :zeek:see:`Telemetry::collect_histogram_metrics` function.
|
|
||||||
type HistogramMetric: record {
|
|
||||||
## A :zeek:see:`Telemetry::MetricOpts` record describing this histogram.
|
|
||||||
opts: MetricOpts;
|
|
||||||
|
|
||||||
## The label values associated with this histogram, if any.
|
|
||||||
labels: vector of string;
|
|
||||||
|
|
||||||
## Individual counters for each of the buckets as
|
|
||||||
## described by the *bounds* field in *opts*;
|
|
||||||
values: vector of double;
|
|
||||||
|
|
||||||
## If the underlying data type of the histogram is ``int64_t``,
|
|
||||||
## this vector will hold the values as counts, otherwise it
|
|
||||||
## is unset. Only histograms created with the C++ API have
|
|
||||||
## may have this value set.
|
|
||||||
count_values: vector of count &optional;
|
|
||||||
|
|
||||||
## The number of observations made for this histogram.
|
|
||||||
observations: double;
|
|
||||||
|
|
||||||
## The sum of all observations for this histogram.
|
|
||||||
sum: double;
|
|
||||||
|
|
||||||
## If the underlying data type of the histogram is ``int64_t``,
|
|
||||||
## the number of observations as :zeek:type:`count`, otherwise
|
|
||||||
## unset.
|
|
||||||
count_observations: count &optional;
|
|
||||||
|
|
||||||
## If the underlying data type of the histogram is ``int64_t``,
|
|
||||||
## the sum of all observations as :zeek:type:`count`, otherwise
|
|
||||||
## unset.
|
|
||||||
count_sum: count &optional;
|
|
||||||
};
|
|
||||||
|
|
||||||
type MetricVector : vector of Metric;
|
|
||||||
|
|
||||||
## Collect all counter and gauge metrics matching the given *name* and *prefix*.
|
## Collect all counter and gauge metrics matching the given *name* and *prefix*.
|
||||||
##
|
##
|
||||||
## For histogram metrics, use the :zeek:see:`Telemetry::collect_histogram_metrics`.
|
## For histogram metrics, use the :zeek:see:`Telemetry::collect_histogram_metrics`.
|
||||||
|
|
|
@ -5771,6 +5771,124 @@ export {
|
||||||
const flowbuffer_contract_threshold = 2 * 1024 * 1024 &redef;
|
const flowbuffer_contract_threshold = 2 * 1024 * 1024 &redef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module Telemetry;
|
||||||
|
export {
|
||||||
|
|
||||||
|
type MetricType: enum {
|
||||||
|
DOUBLE_COUNTER,
|
||||||
|
INT_COUNTER,
|
||||||
|
DOUBLE_GAUGE,
|
||||||
|
INT_GAUGE,
|
||||||
|
DOUBLE_HISTOGRAM,
|
||||||
|
INT_HISTOGRAM,
|
||||||
|
};
|
||||||
|
|
||||||
|
## Type that captures options used to create metrics.
|
||||||
|
type MetricOpts: record {
|
||||||
|
## The prefix (namespace) of the metric. Zeek uses the ``zeek``
|
||||||
|
## prefix for any internal metrics and the ``process`` prefix
|
||||||
|
## for any metrics involving process state (CPU, memory, etc).
|
||||||
|
prefix: string;
|
||||||
|
|
||||||
|
## The human-readable name of the metric.
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
## The unit of the metric. Set to a blank string if this is a unit-less metric.
|
||||||
|
unit: string;
|
||||||
|
|
||||||
|
## Documentation for this metric.
|
||||||
|
help_text: string &optional;
|
||||||
|
|
||||||
|
## The label names (also called dimensions) of the metric. When
|
||||||
|
## instantiating or working with concrete metrics, corresponding
|
||||||
|
## label values have to be provided. Examples of a label might
|
||||||
|
## be the protocol a general observation applies to, the
|
||||||
|
## directionality in a traffic flow, or protocol-specific
|
||||||
|
## context like a particular message type.
|
||||||
|
labels: vector of string &default=vector();
|
||||||
|
|
||||||
|
## Whether the metric represents something that is accumulating.
|
||||||
|
## Defaults to ``T`` for counters and ``F`` for gauges and
|
||||||
|
## histograms.
|
||||||
|
is_total: bool &optional;
|
||||||
|
|
||||||
|
## When creating a :zeek:see:`Telemetry::HistogramFamily`,
|
||||||
|
## describes the number and bounds of the individual buckets.
|
||||||
|
bounds: vector of double &optional;
|
||||||
|
|
||||||
|
## The same meaning as *bounds*, but as :zeek:type:`count`.
|
||||||
|
## Only set in the return value of
|
||||||
|
## :zeek:see:`Telemetry::collect_histogram_metrics`.
|
||||||
|
## for histograms when the underlying type is ``int64_t``,
|
||||||
|
## otherwise ignored.
|
||||||
|
count_bounds: vector of count &optional;
|
||||||
|
|
||||||
|
## Describes the underlying metric type.
|
||||||
|
## Only set in the return value of
|
||||||
|
## :zeek:see:`Telemetry::collect_metrics` or
|
||||||
|
## :zeek:see:`Telemetry::collect_histogram_metrics`,
|
||||||
|
## otherwise ignored.
|
||||||
|
metric_type: MetricType &optional;
|
||||||
|
};
|
||||||
|
|
||||||
|
## Metrics returned by the :zeek:see:`Telemetry::collect_metrics` function.
|
||||||
|
type Metric: record {
|
||||||
|
## A :zeek:see:`Telemetry::MetricOpts` record describing this metric.
|
||||||
|
opts: MetricOpts;
|
||||||
|
|
||||||
|
## The label values associated with this metric, if any.
|
||||||
|
labels: vector of string;
|
||||||
|
|
||||||
|
## The value of gauge or counter cast to a double
|
||||||
|
## independent of the underlying data type.
|
||||||
|
## This value is set for all counter and gauge metrics,
|
||||||
|
## it is unset for histograms.
|
||||||
|
value: double &optional;
|
||||||
|
|
||||||
|
## The integer value of underlying instrument if the metric type
|
||||||
|
## is INT_COUNTER or INT_GAUGE. This will be unset if the type
|
||||||
|
## is DOUBLE_COUNTER or DOUBLE_GAUGE.
|
||||||
|
count_value: count &optional;
|
||||||
|
};
|
||||||
|
|
||||||
|
## Histograms returned by the :zeek:see:`Telemetry::collect_histogram_metrics` function.
|
||||||
|
type HistogramMetric: record {
|
||||||
|
## A :zeek:see:`Telemetry::MetricOpts` record describing this histogram.
|
||||||
|
opts: MetricOpts;
|
||||||
|
|
||||||
|
## The label values associated with this histogram, if any.
|
||||||
|
labels: vector of string;
|
||||||
|
|
||||||
|
## Individual counters for each of the buckets as
|
||||||
|
## described by the *bounds* field in *opts*;
|
||||||
|
values: vector of double;
|
||||||
|
|
||||||
|
## Integer values for the individual counters for each of the
|
||||||
|
## bckets as described in the ``bounds`` field in ``opts``. This
|
||||||
|
## value will be unset if the metric type is DOUBLE_HISTOGRAM.
|
||||||
|
count_values: vector of count &optional;
|
||||||
|
|
||||||
|
## The number of observations made for this histogram.
|
||||||
|
observations: double;
|
||||||
|
|
||||||
|
## The sum of all observations for this histogram.
|
||||||
|
sum: double;
|
||||||
|
|
||||||
|
## The integer value of the number of observations made for this
|
||||||
|
## histogram. This value will be unset if the metric type is
|
||||||
|
## DOUBLE_HISTOGRAM.
|
||||||
|
count_observations: count &optional;
|
||||||
|
|
||||||
|
## The integer value of the sum of all observations for this
|
||||||
|
## histogram. This value will be unset if the metric type is
|
||||||
|
## DOUBLE_HISTOGRAM.
|
||||||
|
count_sum: count &optional;
|
||||||
|
};
|
||||||
|
|
||||||
|
type MetricVector : vector of Metric;
|
||||||
|
type HistogramMetricVector : vector of HistogramMetric;
|
||||||
|
}
|
||||||
|
|
||||||
module GLOBAL;
|
module GLOBAL;
|
||||||
|
|
||||||
## Seed for hashes computed internally for probabilistic data structures. Using
|
## Seed for hashes computed internally for probabilistic data structures. Using
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue