diff options
| author | fumingwei <[email protected]> | 2023-05-29 14:04:57 +0800 |
|---|---|---|
| committer | fumingwei <[email protected]> | 2023-06-02 10:41:12 +0800 |
| commit | 2b6a1bfd1a6c41fb71b59dd50f62d2c3f4688fa8 (patch) | |
| tree | a4bc90b8a752dee1f42bfda1b313cb824d1ed0ff /src/fieldstat_dynamic.cpp | |
| parent | d5389fb9f1cf48f413eb6cd7baad27a57efe2274 (diff) | |
bugfix:新增historgam和summary line protocol输出
Diffstat (limited to 'src/fieldstat_dynamic.cpp')
| -rw-r--r-- | src/fieldstat_dynamic.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/fieldstat_dynamic.cpp b/src/fieldstat_dynamic.cpp index c10dc56..597ee3b 100644 --- a/src/fieldstat_dynamic.cpp +++ b/src/fieldstat_dynamic.cpp @@ -208,6 +208,10 @@ int fieldstat_register_dynamic_table(struct fieldstat_dynamic_instance *instance { return -1; } + if(column_type[i] != FIELD_TYPE_GAUGE && column_type[i] != FIELD_TYPE_COUNTER) + { + return -1; + } } if(n_column <= 0 || n_column > TABLE_COLUMN_SIZE) @@ -402,6 +406,12 @@ int fieldstat_dynamic_metric_value_incrby(struct fieldstat_dynamic_instance *ins { return -1; } + + if(type != FIELD_TYPE_GAUGE && type != FIELD_TYPE_COUNTER) + { + return -1; + } + ret = fieldstat_dynamic_metric_value_operate(instance, FS_OP_ADD, type, field_name, value, tags, n_tags, thread_id); return ret; } @@ -417,6 +427,10 @@ int fieldstat_dynamic_metric_value_set(struct fieldstat_dynamic_instance *instan { return -1; } + if(type != FIELD_TYPE_GAUGE && type != FIELD_TYPE_COUNTER) + { + return -1; + } ret = fieldstat_dynamic_metric_value_operate(instance, FS_OP_SET, type, field_name, value, tags, n_tags, thread_id); return ret; @@ -434,6 +448,11 @@ int fieldstat_dynamic_metric_value_decrby(struct fieldstat_dynamic_instance *ins return -1; } + if(type != FIELD_TYPE_GAUGE && type != FIELD_TYPE_COUNTER) + { + return -1; + } + ret = fieldstat_dynamic_metric_value_operate(instance, FS_OP_SUB, type, field_name, value, tags, n_tags, thread_id); return ret; } |
