Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,16 @@ public void incrementMetric(@NonNull String metricName, long incrementBy) {
// thread-safer
Counter counter = obtainOrCreateCounterByName(metricName.trim());
counter.increment(incrementBy);
logger.debug(
"Incrementing metric '%s' to %d on trace '%s'", metricName, counter.getCount(), name);
if (logger.isLogcatEnabled()) {
logger.debug(
"Incrementing metric '"
+ metricName
+ "' to "
+ counter.getCount()
+ " on trace '"
+ name
+ "'");
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public abstract class PerfMetricValidator {
private static final Pattern ATTRIBUTE_KEY_PATTERN =
Pattern.compile("^(?!(firebase_|google_|ga_))[A-Za-z][A-Za-z_0-9]*");

private static final Constants.CounterNames[] validCounterNames = Constants.CounterNames.values();

/**
* Creates a list of PerfMetricValidator classes based on the contents of PerfMetric
*
Expand Down Expand Up @@ -126,7 +128,6 @@ public static String validateMetricName(@Nullable String str) {
return String.format(
Locale.US, "Metric name must not exceed %d characters", Constants.MAX_COUNTER_ID_LENGTH);
} else if (str.startsWith("_")) {
Constants.CounterNames[] validCounterNames = Constants.CounterNames.values();
for (Constants.CounterNames counterName : validCounterNames) {
if (counterName.toString().equals(str)) {
return null;
Expand Down
Loading