Skip to content

Commit

Permalink
ExemplarFilter is going to be removed from public API, so don't expos…
Browse files Browse the repository at this point in the history
…e it
  • Loading branch information
zeitlinger committed Feb 19, 2024
1 parent 8341061 commit 5c9e395
Showing 1 changed file with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
Expand All @@ -34,25 +33,20 @@ static void configureMeterProvider(
metricExporterCustomizer,
List<Closeable> closeables) {

Optional<ExemplarFilter> spiExemplarFilter = spiHelper.loadOptional(ExemplarFilter.class);
if (spiExemplarFilter.isPresent()) {
SdkMeterProviderUtil.setExemplarFilter(meterProviderBuilder, spiExemplarFilter.get());
} else {
// Configure default exemplar filters.
String exemplarFilter =
config.getString("otel.metrics.exemplar.filter", "trace_based").toLowerCase(Locale.ROOT);
switch (exemplarFilter) {
case "always_off":
SdkMeterProviderUtil.setExemplarFilter(meterProviderBuilder, ExemplarFilter.alwaysOff());
break;
case "always_on":
SdkMeterProviderUtil.setExemplarFilter(meterProviderBuilder, ExemplarFilter.alwaysOn());
break;
case "trace_based":
default:
SdkMeterProviderUtil.setExemplarFilter(meterProviderBuilder, ExemplarFilter.traceBased());
break;
}
// Configure default exemplar filters.
String exemplarFilter =
config.getString("otel.metrics.exemplar.filter", "trace_based").toLowerCase(Locale.ROOT);
switch (exemplarFilter) {
case "always_off":
SdkMeterProviderUtil.setExemplarFilter(meterProviderBuilder, ExemplarFilter.alwaysOff());
break;
case "always_on":
SdkMeterProviderUtil.setExemplarFilter(meterProviderBuilder, ExemplarFilter.alwaysOn());
break;
case "trace_based":
default:
SdkMeterProviderUtil.setExemplarFilter(meterProviderBuilder, ExemplarFilter.traceBased());
break;
}

int cardinalityLimit =
Expand Down

0 comments on commit 5c9e395

Please sign in to comment.