diff options
| author | liuchang <[email protected]> | 2023-04-04 03:45:06 +0000 |
|---|---|---|
| committer | liuchang <[email protected]> | 2023-04-04 03:45:06 +0000 |
| commit | c423f1dfc4c55bc0ba91b7bc43c06fc41755d4ce (patch) | |
| tree | 20cb7d46657953e62a9b276e6be2a2b297637556 /shaping/src/shaper_global_stat.cpp | |
| parent | 1d5f1ee74ea47593c586cfa709aea971eb478853 (diff) | |
add global metric local output
Diffstat (limited to 'shaping/src/shaper_global_stat.cpp')
| -rw-r--r-- | shaping/src/shaper_global_stat.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/shaping/src/shaper_global_stat.cpp b/shaping/src/shaper_global_stat.cpp index caf7718..d3577d2 100644 --- a/shaping/src/shaper_global_stat.cpp +++ b/shaping/src/shaper_global_stat.cpp @@ -64,11 +64,23 @@ struct shaping_global_stat* shaper_global_stat_init() if (conf.enable_backgroud_thread == 0) { fieldstat_disable_background_thread(stat->instance); - fieldstat_set_local_output(stat->instance, "shaping_global_metric", "json"); } + fieldstat_set_local_output(stat->instance, "shaping_global_metric", "json"); - fieldstat_global_enable_prometheus_endpoint(9007, NULL); - fieldstat_enable_prometheus_output(stat->instance); + if (fieldstat_set_output_interval(stat->instance, conf.output_interval_ms) != 0) { + LOG_ERROR("%s: shaping global set fieldstat output interval failed", LOG_TAG_STAT); + goto ERROR; + } + + if (fieldstat_global_enable_prometheus_endpoint(9007, NULL) != 0) { + LOG_ERROR("%s: shaping global fieldstat enable prometheus endpoint failed", LOG_TAG_STAT); + goto ERROR; + } + + if (fieldstat_enable_prometheus_output(stat->instance) != 0) { + LOG_ERROR("%s: shaping global fieldstat enable prometheus output failed", LOG_TAG_STAT); + goto ERROR; + } fieldstat_instance_start(stat->instance); |
