diff --git a/esp/espcommon/espcommon.cpp b/esp/espcommon/espcommon.cpp index 24bdf7c6788..2599434910b 100644 --- a/esp/espcommon/espcommon.cpp +++ b/esp/espcommon/espcommon.cpp @@ -59,8 +59,13 @@ ESPCOMMON_API std::shared_ptr registerServic { std::string metricName(processName); metricName.append(".").append(serviceName).append(".").append(methodName); - auto no_ = std::remove(metricName.begin(), metricName.end(), '_'); - metricName.erase(no_, metricName.end()); + + // Remove unwanted characters from new metric name + constexpr char removeChars[] = "_-* "; + for (unsigned i=0; i