Skip to content

Commit

Permalink
:fix: fix metrics names composer and optimize code
Browse files Browse the repository at this point in the history
Signed-off-by: riccardomodanese <[email protected]>
  • Loading branch information
riccardomodanese committed Apr 16, 2024
1 parent 3d082ec commit d38f05a
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public class MetricsServiceImpl implements MetricsService {

private static final Logger logger = LoggerFactory.getLogger(MetricsServiceImpl.class);

public static final String METRICS_NAME_FORMAT = "{0}.{1}.{2}";
public static final String METRICS_SHORT_NAME_FORMAT = "{0}.{1}";
public static final String METRICS_NAME_FORMAT = "{0}.{1}";
private static final char SEPARATOR = '.';

private MetricRegistry metricRegistry;
Expand Down Expand Up @@ -127,13 +126,8 @@ private String getMetricName(String module, String component, String... metricsN
*/
private String convertToDotNotation(String... metricsName) {
StringBuilder builder = new StringBuilder();
boolean firstMetricName = true;
for (String s : metricsName) {
if (!firstMetricName) {
builder.append(SEPARATOR);
}
firstMetricName = false;
builder.append(s);
builder.append(SEPARATOR).append(s);
}
return builder.toString();
}
Expand Down

0 comments on commit d38f05a

Please sign in to comment.