Skip to content

Commit 1bc1d78

Browse files
committed
process only when needed
1 parent f831572 commit 1bc1d78

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/state/AsynchronousMetricStorage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ void setEpochInformation(long startEpochNanos, long epochNanos) {
164164
}
165165

166166
private Attributes validateAndProcessAttributes(Attributes attributes) {
167-
Context context = Context.current();
168-
attributes = attributesProcessor.process(attributes, context);
169-
170167
if (aggregatorHandles.size() >= maxCardinality) {
171168
throttlingLogger.log(
172169
Level.WARNING,
@@ -177,6 +174,9 @@ private Attributes validateAndProcessAttributes(Attributes attributes) {
177174
+ ").");
178175
return MetricStorage.CARDINALITY_OVERFLOW;
179176
}
177+
178+
Context context = Context.current();
179+
attributes = attributesProcessor.process(attributes, context);
180180
return attributes;
181181
}
182182

0 commit comments

Comments
 (0)