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)
mr12.1.1
Richard Fuchs 2 years ago
parent 7abc7b2e56
commit 5dd167eb45

@ -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",

@ -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);

@ -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 *);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save