Skip to content

Commit

Permalink
[MONIT-40287] Ignore Prefix for Internal SDK metrics (#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
joannatk authored Sep 21, 2023
1 parent 34d7c1e commit 4ecb52e
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ public ReportPointAddPrefixTransformer(@Nullable final String prefix) {
@Override
public ReportPoint apply(@Nullable ReportPoint reportPoint) {
if (reportPoint == null) return null;
if (prefix != null && !prefix.isEmpty()) {
reportPoint.setMetric(prefix + "." + reportPoint.getMetric());
String metric = reportPoint.getMetric();
boolean isTildaPrefixed = metric.charAt(0) == 126;
boolean isDeltaPrefixed = (metric.charAt(0) == 0x2206) || (metric.charAt(0) == 0x0394);
boolean isDeltaTildaPrefixed = isDeltaPrefixed && metric.charAt(1) == 126;
// only append prefix if metric does not begin with tilda, delta or delta tilda prefix
if (prefix != null
&& !prefix.isEmpty()
&& !(isTildaPrefixed || isDeltaTildaPrefixed || isDeltaPrefixed)) {
reportPoint.setMetric(prefix + "." + metric);
}
return reportPoint;
}
Expand Down

0 comments on commit 4ecb52e

Please sign in to comment.