Skip to content

Commit

Permalink
refactor(store): optimize stream metrics' name
Browse files Browse the repository at this point in the history
1. optimize stream metrics' name

Signed-off-by: TheR1sing3un <[email protected]>
  • Loading branch information
TheR1sing3un committed Oct 31, 2023
1 parent bb1b5fd commit fffba12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ protected AttributesBuilder newAttributesBuilder() {
}

protected String metricsName(String type, String name) {
name = name.replace(type, "");
name = name.toLowerCase();
type = type.toLowerCase();
return STREAM_METRICS_PREFIX + type + "_" + name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
import java.util.function.Supplier;

public class StreamMetricsCounter extends BaseStreamMetrics implements Counter {
private static final String STREAM_METRICS_COUNTER_SUFFIX = "_total";
private final LongCounter counter;

public StreamMetricsCounter(String type, String name, Map<String, String> tags,
Meter meter, Supplier<AttributesBuilder> attributesBuilderSupplier) {
super(type, name, tags, meter, attributesBuilderSupplier);
this.counter = this.meter.counterBuilder(this.metricsName)
this.counter = this.meter.counterBuilder(this.metricsName + STREAM_METRICS_COUNTER_SUFFIX)
.build();
}

Expand Down

0 comments on commit fffba12

Please sign in to comment.