moonchen commented on code in PR #13278:
URL: https://github.com/apache/trafficserver/pull/13278#discussion_r3416790844
##########
src/proxy/http/remap/PluginDso.cc:
##########
@@ -55,8 +61,42 @@ concat_error(std::string &error, const std::string &msg)
}
}
+// Derive a metric-safe token from a plugin path: the basename without
extension, with any character
+// outside [A-Za-z0-9_-] replaced by '_' (e.g. "/.../header_rewrite.so" ->
"header_rewrite").
+std::string
+plugin_metric_token(std::string_view name)
+{
+ if (auto slash = name.find_last_of('/'); slash != std::string_view::npos) {
+ name.remove_prefix(slash + 1);
+ }
+ if (auto dot = name.find_first_of('.'); dot != std::string_view::npos) {
+ name = name.substr(0, dot);
+ }
Review Comment:
Fixed with this and changing dots to underscores after.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]