mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
telemetry: Remove singleton BIFs and the C++ pieces
The low-level singleton Telemetry BIFs have been removed with the that there haven't been any users. Singleton metrics can be instantiated by providing an empty label vector instead and aren't in any way a special concept. Closes #2262.
This commit is contained in:
parent
686e740bbe
commit
acacc6b6c2
7 changed files with 16 additions and 357 deletions
|
@ -4,20 +4,22 @@
|
|||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
global cnt1 = Telemetry::__int_counter_family("cnt1", "bar", vector("dim1", "dim2"));
|
||||
global cnt2_bar = Telemetry::__int_counter_singleton("cnt2", "bar");
|
||||
global cnt2 = Telemetry::__int_counter_family("cnt2", "bar", vector());
|
||||
global cnt3 = Telemetry::__dbl_counter_family("cnt3", "bar", vector("dim1", "dim2"));
|
||||
global cnt4_bar = Telemetry::__dbl_counter_singleton("cnt4", "bar");
|
||||
global cnt4 = Telemetry::__dbl_counter_family("cnt4", "bar", vector());
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local cnt1_bar = Telemetry::__int_counter_metric_get_or_add(cnt1, table(["dim1"] = "val1", ["dim2"] = "val2"));
|
||||
Telemetry::__int_counter_inc(cnt1_bar);
|
||||
local cnt2_bar = Telemetry::__int_counter_metric_get_or_add(cnt2, table());
|
||||
Telemetry::__int_counter_inc(cnt2_bar);
|
||||
Telemetry::__int_counter_inc(cnt2_bar, 41);
|
||||
print fmt("cnt1_bar: %d", Telemetry::__int_counter_value(cnt1_bar));
|
||||
print fmt("cnt2_bar: %d", Telemetry::__int_counter_value(cnt2_bar));
|
||||
local cnt3_bar = Telemetry::__dbl_counter_metric_get_or_add(cnt3, table(["dim1"] = "val1", ["dim2"] = "val2"));
|
||||
Telemetry::__dbl_counter_inc(cnt3_bar);
|
||||
local cnt4_bar = Telemetry::__dbl_counter_metric_get_or_add(cnt4, table());
|
||||
Telemetry::__dbl_counter_inc(cnt4_bar);
|
||||
Telemetry::__dbl_counter_inc(cnt4_bar, 41.0);
|
||||
print fmt("cnt3_bar: %f", Telemetry::__dbl_counter_value(cnt3_bar));
|
||||
|
|
|
@ -4,14 +4,15 @@
|
|||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
global gg1 = Telemetry::__int_gauge_family("gg1", "bar", vector("dim1", "dim2"));
|
||||
global gg2_bar = Telemetry::__int_gauge_singleton("gg2", "bar");
|
||||
global gg2 = Telemetry::__int_gauge_family("gg2", "bar", vector());
|
||||
global gg3 = Telemetry::__dbl_gauge_family("gg3", "bar", vector("dim1", "dim2"));
|
||||
global gg4_bar = Telemetry::__dbl_gauge_singleton("gg4", "bar");
|
||||
global gg4 = Telemetry::__dbl_gauge_family("gg4", "bar", vector());
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local gg1_bar = Telemetry::__int_gauge_metric_get_or_add(gg1, table(["dim1"] = "val1", ["dim2"] = "val2"));
|
||||
Telemetry::__int_gauge_inc(gg1_bar);
|
||||
local gg2_bar = Telemetry::__int_gauge_metric_get_or_add(gg2, table());
|
||||
Telemetry::__int_gauge_inc(gg2_bar);
|
||||
Telemetry::__int_gauge_inc(gg2_bar, 41);
|
||||
Telemetry::__int_gauge_dec(gg2_bar);
|
||||
|
@ -20,6 +21,7 @@ event zeek_init()
|
|||
print fmt("gg2_bar: %d", Telemetry::__int_gauge_value(gg2_bar));
|
||||
local gg3_bar = Telemetry::__dbl_gauge_metric_get_or_add(gg3, table(["dim1"] = "val1", ["dim2"] = "val2"));
|
||||
Telemetry::__dbl_gauge_inc(gg3_bar);
|
||||
local gg4_bar = Telemetry::__dbl_gauge_metric_get_or_add(gg4, table());
|
||||
Telemetry::__dbl_gauge_inc(gg4_bar);
|
||||
Telemetry::__dbl_gauge_inc(gg4_bar, 41.0);
|
||||
Telemetry::__dbl_gauge_dec(gg4_bar);
|
||||
|
|
|
@ -7,21 +7,23 @@ const int_bounds = vector(+10, +20);
|
|||
const dbl_bounds = vector(10.0, 20.0);
|
||||
|
||||
global hst1 = Telemetry::__int_histogram_family("hst1", "bar", vector("dim1", "dim2"), int_bounds);
|
||||
global hst2_bar = Telemetry::__int_histogram_singleton("hst2", "bar", int_bounds);
|
||||
global hst2 = Telemetry::__int_histogram_family("hst2", "bar", vector(), int_bounds);
|
||||
global hst3 = Telemetry::__dbl_histogram_family("hst3", "bar", vector("dim1", "dim2"), dbl_bounds);
|
||||
global hst4_bar = Telemetry::__dbl_histogram_singleton("hst4", "bar", dbl_bounds);
|
||||
global hst4 = Telemetry::__dbl_histogram_family("hst4", "bar", vector(), dbl_bounds);
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local hst1_bar = Telemetry::__int_histogram_metric_get_or_add(hst1, table(["dim1"] = "val1", ["dim2"] = "val2"));
|
||||
Telemetry::__int_histogram_observe(hst1_bar, 1);
|
||||
Telemetry::__int_histogram_observe(hst1_bar, 11);
|
||||
local hst2_bar = Telemetry::__int_histogram_metric_get_or_add(hst2, table());
|
||||
Telemetry::__int_histogram_observe(hst2_bar, 31337);
|
||||
print fmt("hst1_bar: %d", Telemetry::__int_histogram_sum(hst1_bar));
|
||||
print fmt("hst2_bar: %d", Telemetry::__int_histogram_sum(hst2_bar));
|
||||
local hst3_bar = Telemetry::__dbl_histogram_metric_get_or_add(hst3, table(["dim1"] = "val1", ["dim2"] = "val2"));
|
||||
Telemetry::__dbl_histogram_observe(hst3_bar, 2.0);
|
||||
Telemetry::__dbl_histogram_observe(hst3_bar, 4.0);
|
||||
local hst4_bar = Telemetry::__dbl_histogram_metric_get_or_add(hst4, table());
|
||||
Telemetry::__dbl_histogram_observe(hst4_bar, 64.0);
|
||||
print fmt("hst3_bar: %f", Telemetry::__dbl_histogram_sum(hst3_bar));
|
||||
print fmt("hst4_bar: %f", Telemetry::__dbl_histogram_sum(hst4_bar));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue