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 @@ -39,39 +39,7 @@ public static PrometheusMetricReaderBuilder builder() {
return new PrometheusMetricReaderBuilder();
}

/**
* Deprecated. Use {@link #builder()}.
*
* @deprecated use {@link #builder()}.
*/
@Deprecated
@SuppressWarnings({"unused", "InconsistentOverloads"})
public PrometheusMetricReader(
boolean otelScopeEnabled, @Nullable Predicate<String> allowedResourceAttributesFilter) {
// otelScopeEnabled parameter was used to control the scope info metric, not scope labels.
this(
allowedResourceAttributesFilter,
/* otelScopeLabelsEnabled= */ true,
/* targetInfoMetricEnabled= */ true,
TranslationStrategy.UNDERSCORE_ESCAPING_WITH_SUFFIXES);
}

/**
* Deprecated. Use {@link #builder()}.
*
* @deprecated use {@link #builder()}.
*/
@Deprecated
public PrometheusMetricReader(@Nullable Predicate<String> allowedResourceAttributesFilter) {
this(
allowedResourceAttributesFilter,
/* otelScopeLabelsEnabled= */ true,
/* targetInfoMetricEnabled= */ true,
TranslationStrategy.UNDERSCORE_ESCAPING_WITH_SUFFIXES);
}

// Package-private constructor used by builder
@SuppressWarnings("InconsistentOverloads")
PrometheusMetricReader(
@Nullable Predicate<String> allowedResourceAttributesFilter,
boolean otelScopeLabelsEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1066,25 +1066,6 @@ void addResourceAttributesWorks() throws IOException {
assertThat(toOpenMetrics(reader.collect())).isEqualTo(expected);
}

@SuppressWarnings("deprecation") // test deprecated constructor
@Test
void deprecatedConstructor() {
// The 2-arg deprecated constructor should behave the same as the 1-arg constructor
// when otelScopeLabelsEnabled=true (which is also the default for the builder)
assertThat(new PrometheusMetricReader(/* otelScopeEnabled= */ false, null))
.usingRecursiveComparison()
.isEqualTo(new PrometheusMetricReader(null));
// The 4-arg constructor should behave the same as the 2-arg deprecated constructor
assertThat(
new PrometheusMetricReader(
null,
/* otelScopeLabelsEnabled= */ true,
/* targetInfoMetricEnabled */ true,
TranslationStrategy.UNDERSCORE_ESCAPING_WITH_SUFFIXES))
.usingRecursiveComparison()
.isEqualTo(new PrometheusMetricReader(null));
}

/**
* Unfortunately there is no easy way to use {@link TestClock} for Exemplar timestamps. Test if
* {@code expected} equals {@code actual} but {@code <timestamp>} matches arbitrary timestamps.
Expand Down
Loading