@cryptotaxi247 / netdata-1 / commits / 6086e2477

Respect dimension hidden option when executing a query and building the dimension list from the database (#12570)

Stelios Fragkakis committed Mar 31, 2022 at 22:03 UTC 6086e2477608441fe11ec7d4fee124cbf31fa6d7
1 file changed +6 -2
database/sqlite/sqlite_functions.c
+6 -2
@@ -1453,12 +1453,14 @@ static RRDDIM *create_rrdim_entry(RRDSET *st, char *id, char *name, uuid_t *metr
1453 }
1454 #endif
1455
1456 -#define SELECT_CHART_CONTEXT "select d.dim_id, d.id, d.name, c.id, c.type, c.name, c.update_every, c.chart_id from chart c, " \
1456 +#define SELECT_CHART_CONTEXT "select d.dim_id, d.id, d.name, c.id, c.type, c.name, c.update_every, c.chart_id, " \
1457 + "c.context, CASE WHEN d.options = 'hidden' THEN 1 else 0 END from chart c, " \
1458 "dimension d, host h " \
1459 "where d.chart_id = c.chart_id and c.host_id = h.host_id and c.host_id = @host_id and c.context = @context " \
1460 "order by c.chart_id asc, c.type||c.id desc;"
1461
1461 -#define SELECT_CHART_SINGLE "select d.dim_id, d.id, d.name, c.id, c.type, c.name, c.update_every, c.chart_id, c.context from chart c, " \
1462 +#define SELECT_CHART_SINGLE "select d.dim_id, d.id, d.name, c.id, c.type, c.name, c.update_every, c.chart_id, " \
1463 + "c.context, CASE WHEN d.options = 'hidden' THEN 1 else 0 END from chart c, " \
1464 "dimension d, host h " \
1465 "where d.chart_id = c.chart_id and c.host_id = h.host_id and c.host_id = @host_id and c.type||'.'||c.id = @chart " \
1466 "order by c.chart_id asc, c.type||'.'||c.id desc;"
@@ -1552,6 +1554,8 @@ void sql_build_context_param_list(struct context_param **param_list, RRDHOST *ho
1554 st->last_entry_t = MAX(st->last_entry_t, (*param_list)->last_entry_t);
1555
1556 RRDDIM *rd = create_rrdim_entry(st, (char *)sqlite3_column_text(res, 1), (char *)sqlite3_column_text(res, 2), &rrdeng_uuid);
1557 + if (sqlite3_column_int(res, 9) == 1)
1558 + rrddim_flag_set(rd, RRDDIM_FLAG_HIDDEN);
1559 rd->next = (*param_list)->rd;
1560 (*param_list)->rd = rd;
1561 }