Browse Source

MT#55283 use escaped command strings for Graphite

Graphite isn't able to deal with spaces in the metric names delivered to
it. Introduce special version of the command strings with spaces
replaced by underscores.

closes #1780

Change-Id: Ie8bcec5ca4f2d427e92901f6fa76b985df6e459e
(cherry picked from commit c6a5b53912)
pull/1887/head
Richard Fuchs 2 years ago
parent
commit
4f1ba66b21
4 changed files with 801 additions and 791 deletions
  1. +9
    -0
      daemon/control_ng.c
  2. +7
    -7
      daemon/graphite.c
  3. +1
    -0
      include/control_ng.h
  4. +784
    -784
      t/test-stats.c

+ 9
- 0
daemon/control_ng.c View File

@ -44,6 +44,15 @@ const char *ng_command_strings[NGC_COUNT] = {
"publish", "subscribe request",
"subscribe answer", "unsubscribe",
};
const char *ng_command_strings_esc[NGC_COUNT] = {
"ping", "offer", "answer", "delete", "query", "list",
"start_recording", "stop_recording", "pause_recording",
"start_forwarding", "stop_forwarding", "block_DTMF",
"unblock_DTMF", "block_media", "unblock_media", "play_media", "stop_media",
"play_DTMF", "statistics", "silence_media", "unsilence_media",
"publish", "subscribe_request",
"subscribe_answer", "unsubscribe",
};
const char *ng_command_strings_short[NGC_COUNT] = {
"Ping", "Offer", "Answer", "Delete", "Query", "List",
"StartRec", "StopRec", "PauseRec",


+ 7
- 7
daemon/graphite.c View File

@ -117,16 +117,16 @@ GString *print_graphite_data(void) {
g_string_append_printf(graph_str, fmt " %llu\n", ##__VA_ARGS__, (unsigned long long)rtpe_now.tv_sec)
for (int i = 0; i < NGC_COUNT; i++) {
GPF("%s_time_min %.6f", ng_command_strings[i],
GPF("%s_time_min %.6f", ng_command_strings_esc[i],
(double) atomic64_get(&rtpe_sampled_graphite_min_max_sampled.min.ng_command_times[i]) / 1000000.0);
GPF("%s_time_max %.6f", ng_command_strings[i],
GPF("%s_time_max %.6f", ng_command_strings_esc[i],
(double) atomic64_get(&rtpe_sampled_graphite_min_max_sampled.max.ng_command_times[i]) / 1000000.0);
GPF("%s_time_avg %.6f", ng_command_strings[i],
GPF("%s_time_avg %.6f", ng_command_strings_esc[i],
(double) atomic64_get(&rtpe_sampled_graphite_avg.avg.ng_command_times[i]) / 1000000.0);
GPF("%ss_ps_min " UINT64F, ng_command_strings[i], atomic64_get(&rtpe_rate_graphite_min_max_avg_sampled.min.ng_commands[i]));
GPF("%ss_ps_max " UINT64F, ng_command_strings[i], atomic64_get(&rtpe_rate_graphite_min_max_avg_sampled.max.ng_commands[i]));
GPF("%ss_ps_avg " UINT64F, ng_command_strings[i], atomic64_get(&rtpe_rate_graphite_min_max_avg_sampled.avg.ng_commands[i]));
GPF("%ss_ps_min " UINT64F, ng_command_strings_esc[i], atomic64_get(&rtpe_rate_graphite_min_max_avg_sampled.min.ng_commands[i]));
GPF("%ss_ps_max " UINT64F, ng_command_strings_esc[i], atomic64_get(&rtpe_rate_graphite_min_max_avg_sampled.max.ng_commands[i]));
GPF("%ss_ps_avg " UINT64F, ng_command_strings_esc[i], atomic64_get(&rtpe_rate_graphite_min_max_avg_sampled.avg.ng_commands[i]));
ilog(LOG_DEBUG, "Min/Max/Avg %s processing delay: %.6f/%.6f/%.6f sec",
ng_command_strings[i],
@ -134,7 +134,7 @@ GString *print_graphite_data(void) {
(double) atomic64_get(&rtpe_sampled_graphite_min_max_sampled.max.ng_command_times[i]) / 1000000.0,
(double) atomic64_get(&rtpe_sampled_graphite_avg.avg.ng_command_times[i]) / 1000000.0);
GPF("%s_count %" PRIu64, ng_command_strings[i], atomic64_get(&rtpe_stats.ng_commands[i]));
GPF("%s_count %" PRIu64, ng_command_strings_esc[i], atomic64_get(&rtpe_stats.ng_commands[i]));
}
GPF("call_dur %.6f", (double) atomic64_get_na(&rtpe_stats_graphite_diff.total_calls_duration_intv) / 1000000.0);


+ 1
- 0
include/control_ng.h View File

@ -63,6 +63,7 @@ struct ng_buffer {
};
extern const char *ng_command_strings[NGC_COUNT];
extern const char *ng_command_strings_esc[NGC_COUNT];
extern const char *ng_command_strings_short[NGC_COUNT];
struct control_ng *control_ng_new(const endpoint_t *);


+ 784
- 784
t/test-stats.c
File diff suppressed because it is too large
View File


Loading…
Cancel
Save