未验证 提交 96788609 编写于 作者: Y yswdqz 提交者: GitHub

Change scapedMetricsNameCache method to support `/` (#10349)

上级 60b061f5
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
* Remove handler scan in otel receiver, manual initialization instead * Remove handler scan in otel receiver, manual initialization instead
* Add aws-firehose-receiver to support collecting AWS CloudWatch metric(OpenTelemetry format) * Add aws-firehose-receiver to support collecting AWS CloudWatch metric(OpenTelemetry format)
* Avoid Antlr dependencies' versions might be different in compile time and runtime. * Avoid Antlr dependencies' versions might be different in compile time and runtime.
* Now `PrometheusMetricConverter#escapedName` also support converting `/` to `_`.
#### UI #### UI
......
...@@ -71,7 +71,7 @@ public class PrometheusMetricConverter { ...@@ -71,7 +71,7 @@ public class PrometheusMetricConverter {
public PrometheusMetricConverter(Rule rule, MeterSystem service) { public PrometheusMetricConverter(Rule rule, MeterSystem service) {
this.convert = new MetricConvert(rule, service); this.convert = new MetricConvert(rule, service);
this.metricsNameEscapePattern = Pattern.compile("\\."); this.metricsNameEscapePattern = Pattern.compile("[/.]");
} }
/** /**
...@@ -160,7 +160,7 @@ public class PrometheusMetricConverter { ...@@ -160,7 +160,7 @@ public class PrometheusMetricConverter {
return Optional.of(Tuple.of(escapedName(metric.getName()), SampleFamilyBuilder.newBuilder(ss).build())); return Optional.of(Tuple.of(escapedName(metric.getName()), SampleFamilyBuilder.newBuilder(ss).build()));
} }
// Returns the escaped name of the given one, with "." replaced by "_" // Returns the escaped name of the given one, with "." and "/" replaced by "_"
protected String escapedName(final String name) { protected String escapedName(final String name) {
try { try {
return escapedMetricsNameCache.get(name); return escapedMetricsNameCache.get(name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册