mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
Don't include endpoint label/value when collecting metrics internally
This commit is contained in:
parent
5c20d81a6a
commit
5c17e43a1d
4 changed files with 15 additions and 7 deletions
|
@ -143,8 +143,11 @@ public:
|
||||||
std::vector<RecordValPtr> records;
|
std::vector<RecordValPtr> records;
|
||||||
for ( const auto& ctr : counters ) {
|
for ( const auto& ctr : counters ) {
|
||||||
auto label_values_vec = make_intrusive<VectorVal>(string_vec_type);
|
auto label_values_vec = make_intrusive<VectorVal>(string_vec_type);
|
||||||
for ( const auto& [label_key, label] : ctr->Labels() )
|
for ( const auto& [label_key, label] : ctr->Labels() ) {
|
||||||
label_values_vec->Append(make_intrusive<StringVal>(label));
|
// We don't include the endpoint key/value unless it's a prometheus request
|
||||||
|
if ( label_key != "endpoint" )
|
||||||
|
label_values_vec->Append(make_intrusive<StringVal>(label));
|
||||||
|
}
|
||||||
|
|
||||||
auto r = make_intrusive<zeek::RecordVal>(metric_record_type);
|
auto r = make_intrusive<zeek::RecordVal>(metric_record_type);
|
||||||
r->Assign(labels_idx, label_values_vec);
|
r->Assign(labels_idx, label_values_vec);
|
||||||
|
|
|
@ -167,8 +167,11 @@ public:
|
||||||
std::vector<RecordValPtr> records;
|
std::vector<RecordValPtr> records;
|
||||||
for ( const auto& g : gauges ) {
|
for ( const auto& g : gauges ) {
|
||||||
auto label_values_vec = make_intrusive<VectorVal>(string_vec_type);
|
auto label_values_vec = make_intrusive<VectorVal>(string_vec_type);
|
||||||
for ( const auto& [label_key, label] : g->Labels() )
|
for ( const auto& [label_key, label] : g->Labels() ) {
|
||||||
label_values_vec->Append(make_intrusive<StringVal>(label));
|
// We don't include the endpoint key/value unless it's a prometheus request
|
||||||
|
if ( label_key != "endpoint" )
|
||||||
|
label_values_vec->Append(make_intrusive<StringVal>(label));
|
||||||
|
}
|
||||||
|
|
||||||
auto r = make_intrusive<zeek::RecordVal>(metric_record_type);
|
auto r = make_intrusive<zeek::RecordVal>(metric_record_type);
|
||||||
r->Assign(labels_idx, label_values_vec);
|
r->Assign(labels_idx, label_values_vec);
|
||||||
|
|
|
@ -144,8 +144,11 @@ public:
|
||||||
std::vector<RecordValPtr> records;
|
std::vector<RecordValPtr> records;
|
||||||
for ( const auto& h : histograms ) {
|
for ( const auto& h : histograms ) {
|
||||||
auto label_values_vec = make_intrusive<VectorVal>(string_vec_type);
|
auto label_values_vec = make_intrusive<VectorVal>(string_vec_type);
|
||||||
for ( const auto& [label_key, label] : h->Labels() )
|
for ( const auto& [label_key, label] : h->Labels() ) {
|
||||||
label_values_vec->Append(make_intrusive<StringVal>(label));
|
// We don't include the endpoint key/value unless it's a prometheus request
|
||||||
|
if ( label_key != "endpoint" )
|
||||||
|
label_values_vec->Append(make_intrusive<StringVal>(label));
|
||||||
|
}
|
||||||
|
|
||||||
auto r = make_intrusive<zeek::RecordVal>(histogram_metric_type);
|
auto r = make_intrusive<zeek::RecordVal>(histogram_metric_type);
|
||||||
r->Assign(labels_idx, label_values_vec);
|
r->Assign(labels_idx, label_values_vec);
|
||||||
|
|
|
@ -42,7 +42,6 @@ RecordValPtr MetricFamily::GetMetricOptsRecord() const {
|
||||||
record_val->Assign(is_total_idx, val_mgr->Bool(is_sum));
|
record_val->Assign(is_total_idx, val_mgr->Bool(is_sum));
|
||||||
|
|
||||||
auto label_names_vec = make_intrusive<zeek::VectorVal>(string_vec_type);
|
auto label_names_vec = make_intrusive<zeek::VectorVal>(string_vec_type);
|
||||||
label_names_vec->Append(make_intrusive<StringVal>("endpoint"));
|
|
||||||
for ( const auto& lbl : labels )
|
for ( const auto& lbl : labels )
|
||||||
label_names_vec->Append(make_intrusive<StringVal>(lbl));
|
label_names_vec->Append(make_intrusive<StringVal>(lbl));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue