mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Restore label_names field in MetricOpts record
This commit is contained in:
parent
1cdca7c1d0
commit
99e64aa113
6 changed files with 55 additions and 46 deletions
|
@ -36,8 +36,7 @@ export {
|
|||
};
|
||||
|
||||
## Register a counter family.
|
||||
global register_counter_family: function(opts: MetricOpts,
|
||||
label_names: labels_vector &default=vector()): CounterFamily;
|
||||
global register_counter_family: function(opts: MetricOpts): CounterFamily;
|
||||
|
||||
## Get a :zeek:see:`Telemetry::Counter` instance given family and label values.
|
||||
global counter_with: function(cf: CounterFamily,
|
||||
|
@ -120,8 +119,7 @@ export {
|
|||
};
|
||||
|
||||
## Register a gauge family.
|
||||
global register_gauge_family: function(opts: MetricOpts,
|
||||
label_names: labels_vector &default=vector()): GaugeFamily;
|
||||
global register_gauge_family: function(opts: MetricOpts): GaugeFamily;
|
||||
|
||||
|
||||
## Get a :zeek:see:`Telemetry::Gauge` instance given family and label values.
|
||||
|
@ -217,8 +215,7 @@ export {
|
|||
};
|
||||
|
||||
## Register a histogram family.
|
||||
global register_histogram_family: function(opts: MetricOpts,
|
||||
label_names: labels_vector &default=vector()): HistogramFamily;
|
||||
global register_histogram_family: function(opts: MetricOpts): HistogramFamily;
|
||||
|
||||
## Get a :zeek:see:`Telemetry::Histogram` instance given family and label values.
|
||||
global histogram_with: function(hf: HistogramFamily,
|
||||
|
@ -293,16 +290,16 @@ function make_labels(keys: vector of string, values: labels_vector): table[strin
|
|||
return labels;
|
||||
}
|
||||
|
||||
function register_counter_family(opts: MetricOpts, label_names: labels_vector): CounterFamily
|
||||
function register_counter_family(opts: MetricOpts): CounterFamily
|
||||
{
|
||||
local f = Telemetry::__counter_family(
|
||||
opts$prefix,
|
||||
opts$name,
|
||||
label_names,
|
||||
opts$label_names,
|
||||
opts$help_text,
|
||||
opts$unit
|
||||
);
|
||||
return CounterFamily($__family=f, $__labels=label_names);
|
||||
return CounterFamily($__family=f, $__labels=opts$label_names);
|
||||
}
|
||||
|
||||
# Fallback Counter returned when there are issues with the labels.
|
||||
|
@ -352,16 +349,16 @@ function counter_family_set(cf: CounterFamily, label_values: labels_vector, valu
|
|||
return counter_set(counter_with(cf, label_values), value);
|
||||
}
|
||||
|
||||
function register_gauge_family(opts: MetricOpts, label_names: labels_vector): GaugeFamily
|
||||
function register_gauge_family(opts: MetricOpts): GaugeFamily
|
||||
{
|
||||
local f = Telemetry::__gauge_family(
|
||||
opts$prefix,
|
||||
opts$name,
|
||||
label_names,
|
||||
opts$label_names,
|
||||
opts$help_text,
|
||||
opts$unit
|
||||
);
|
||||
return GaugeFamily($__family=f, $__labels=label_names);
|
||||
return GaugeFamily($__family=f, $__labels=opts$label_names);
|
||||
}
|
||||
|
||||
# Fallback Gauge returned when there are issues with the label usage.
|
||||
|
@ -420,17 +417,17 @@ function gauge_family_set(gf: GaugeFamily, label_values: labels_vector, value: d
|
|||
return gauge_set(gauge_with(gf, label_values), value);
|
||||
}
|
||||
|
||||
function register_histogram_family(opts: MetricOpts, label_names: labels_vector): HistogramFamily
|
||||
function register_histogram_family(opts: MetricOpts): HistogramFamily
|
||||
{
|
||||
local f = Telemetry::__histogram_family(
|
||||
opts$prefix,
|
||||
opts$name,
|
||||
label_names,
|
||||
opts$label_names,
|
||||
opts$bounds,
|
||||
opts$help_text,
|
||||
opts$unit
|
||||
);
|
||||
return HistogramFamily($__family=f, $__labels=label_names);
|
||||
return HistogramFamily($__family=f, $__labels=opts$label_names);
|
||||
}
|
||||
|
||||
# Fallback Histogram when there are issues with the labels.
|
||||
|
@ -486,10 +483,10 @@ global version_gauge_family = Telemetry::register_gauge_family([
|
|||
$prefix="zeek",
|
||||
$name="version_info",
|
||||
$unit="",
|
||||
$help_text="The Zeek version"],
|
||||
vector("version_number", "major", "minor", "patch", "commit",
|
||||
"beta", "debug","version_string")
|
||||
);
|
||||
$help_text="The Zeek version",
|
||||
$label_names=vector("version_number", "major", "minor", "patch", "commit",
|
||||
"beta", "debug","version_string")
|
||||
]);
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
|
|
|
@ -5802,6 +5802,18 @@ export {
|
|||
## 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. This field is only
|
||||
## used in the construction of new metrics and will not be
|
||||
## filled in when returned from
|
||||
## :zeek:see:`Telemetry::collect_metrics` or
|
||||
## :zeek:see:`Telemetry::collect_histogram_metrics`,
|
||||
label_names: vector of string &default=vector();
|
||||
|
||||
## Whether the metric represents something that is accumulating.
|
||||
## Defaults to ``T`` for counters and ``F`` for gauges and
|
||||
## histograms.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue