MCPcopy Create free account
hub / github.com/Icinga/icinga2 / EscapeMetricLabel

Method EscapeMetricLabel

lib/perfdata/graphitewriter.cpp:442–453  ·  view source on GitHub ↗

* Escape metric label * * Dots are allowed - users can create trees from perfdata labels * * @param str Metric label name * @return Escaped string */

Source from the content-addressed store, hash-verified

440 * @return Escaped string
441 */
442String GraphiteWriter::EscapeMetricLabel(const String& str)
443{
444 String result = str;
445
446 //allow to pass '.' in perfdata labels
447 boost::replace_all(result, " ", "_");
448 boost::replace_all(result, "\\", "_");
449 boost::replace_all(result, "/", "_");
450 boost::replace_all(result, "::", ".");
451
452 return result;
453}
454
455/**
456 * Escape macro metrics found via host/service name templates

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected