Move telmetry label names out of opts records, into main metric records

This commit is contained in:
Tim Wojtulewicz 2024-06-02 19:46:50 -07:00
parent b1578d4ded
commit 433c257886
10 changed files with 114 additions and 150 deletions

View file

@ -14,42 +14,42 @@ global btest_a_cf = Telemetry::register_counter_family([
$prefix="btest",
$name="a_test",
$unit="",
$help_text="A btest metric",
$labels=vector("x", "y")
]);
$help_text="A btest metric"],
vector("x", "y")
);
global btest_b_cf = Telemetry::register_counter_family([
$prefix="btest",
$name="b_test",
$unit="",
$help_text="Another btest metric",
$labels=vector("x", "y")
]);
$help_text="Another btest metric"],
vector("x", "y")
);
global btest_c_cf = Telemetry::register_counter_family([
$prefix="btest",
$name="c_test",
$unit="",
$help_text="The last btest metric",
$labels=vector("x", "y")
]);
$help_text="The last btest metric"],
vector("x", "y")
);
global system_sensor_temp_gf = Telemetry::register_gauge_family([
$prefix="system",
$name="sensor_temperature",
$unit="celsius",
$help_text="Temperatures reported by sensors in the system",
$labels=vector("name")
]);
$help_text="Temperatures reported by sensors in the system"],
vector("name")
);
global btest_sample_histogram_hf = Telemetry::register_histogram_family([
$prefix="btest",
$name="sample_histogram",
$unit="",
$help_text="A sample histogram that is not returned by Telemetry::collect_metrics",
$bounds=vector(1.0, 2.0, 3.0, 4.0, 5.0),
$labels=vector("dim")
]);
$bounds=vector(1.0, 2.0, 3.0, 4.0, 5.0)],
vector("dim")
);
function print_metrics(what: string, metrics: vector of Telemetry::Metric)
{
@ -57,7 +57,7 @@ function print_metrics(what: string, metrics: vector of Telemetry::Metric)
for (i in metrics)
{
local m = metrics[i];
print m$opts$metric_type, m$opts$prefix, m$opts$name, m$opts$labels, m$labels, m$value;
print m$opts$metric_type, m$opts$prefix, m$opts$name, m$label_names, m$label_values, m$value;
}
}
@ -67,7 +67,7 @@ function print_histogram_metrics(what: string, metrics: vector of Telemetry::His
for (i in metrics)
{
local m = metrics[i];
print m$opts$metric_type, m$opts$prefix, m$opts$name, m$opts$bounds, m$opts$labels, m$labels, m$values, m$sum, m$observations;
print m$opts$metric_type, m$opts$prefix, m$opts$name, m$opts$bounds, m$label_names, m$label_values, m$values, m$sum, m$observations;
}
}