diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2022-10-25 01:17:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 01:17:34 +0300 |
commit | 8958da110e5aad5e518770fceb6e56f2d6ade450 (patch) | |
tree | 5b3bf6be0a8673e039446155f2447273597c527f /database | |
parent | 2d8b5d104b689b6faf28b0e6fc6663b37dc3605f (diff) |
Store hidden status when creating / updating dimension metadata (#13869)
Diffstat (limited to 'database')
-rw-r--r-- | database/sqlite/sqlite_metadata.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/database/sqlite/sqlite_metadata.c b/database/sqlite/sqlite_metadata.c index bf4e33644b..b7f84f3925 100644 --- a/database/sqlite/sqlite_metadata.c +++ b/database/sqlite/sqlite_metadata.c @@ -34,8 +34,8 @@ extern DICTIONARY *rrdhost_root_index; "name, family, context, title, unit, plugin, module, priority, update_every , chart_type , memory_mode , " \ "history_entries) values (?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12,?13,?14,?15,?16);" -#define SQL_STORE_DIMENSION "INSERT OR REPLACE INTO dimension (dim_id, chart_id, id, name, multiplier, divisor , algorithm) " \ - "VALUES (@dim_id, @chart_id, @id, @name, @multiplier, @divisor, @algorithm);" +#define SQL_STORE_DIMENSION "INSERT OR REPLACE INTO dimension (dim_id, chart_id, id, name, multiplier, divisor , algorithm, options) " \ + "VALUES (@dim_id, @chart_id, @id, @name, @multiplier, @divisor, @algorithm, @options);" #define SELECT_DIMENSION_LIST "SELECT dim_id, rowid FROM dimension WHERE rowid > @row_id" @@ -595,7 +595,7 @@ bind_fail: */ static int sql_store_dimension( uuid_t *dim_uuid, uuid_t *chart_uuid, const char *id, const char *name, collected_number multiplier, - collected_number divisor, int algorithm) + collected_number divisor, int algorithm, bool hidden) { static __thread sqlite3_stmt *res = NULL; int rc, param = 0; @@ -643,6 +643,13 @@ static int sql_store_dimension( if (unlikely(rc != SQLITE_OK)) goto bind_fail; + if (hidden) + rc = sqlite3_bind_text(res, ++param, "hidden", -1, SQLITE_STATIC); + else + rc = sqlite3_bind_null(res, ++param); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + rc = execute_insert(res); if (unlikely(rc != SQLITE_DONE)) error_report("Failed to store dimension, rc = %d", rc); @@ -967,7 +974,8 @@ static bool metadata_scan_host(RRDHOST *host, uint32_t max_count) { string2str(rd->name), rd->multiplier, rd->divisor, - rd->algorithm); + rd->algorithm, + rrddim_option_check(rd, RRDDIM_OPTION_HIDDEN)); if (unlikely(rc)) error_report("METADATA: Failed to store dimension %s", string2str(rd->id)); @@ -1165,7 +1173,8 @@ static void metadata_event_loop(void *arg) string2str(rd->name), rd->multiplier, rd->divisor, - rd->algorithm); + rd->algorithm, + rrddim_option_check(rd, RRDDIM_OPTION_HIDDEN)); if (unlikely(rc)) error_report("Failed to store dimension %s", rrddim_id(rd)); |