Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
bclozel committed Sep 30, 2022
1 parent 7f7ecdc commit 5b092f5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public static class ClientRequest {
*/
private String metricName = "http.client.requests";

@Deprecated
@DeprecatedConfigurationProperty(replacement = "management.observations.http.client.requests.name")
public String getMetricName() {
return this.metricName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
import org.springframework.boot.actuate.autoconfigure.metrics.OnlyOnceLoggingDenyMeterFilter;
import org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.observation.ObservationProperties;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
Expand Down Expand Up @@ -61,11 +62,15 @@ class MeterFilterConfiguration {

@Bean
@Order(0)
MeterFilter metricsHttpClientUriTagFilter(MetricsProperties properties) {
String metricName = properties.getWeb().getClient().getRequest().getMetricName();
MeterFilter denyFilter = new OnlyOnceLoggingDenyMeterFilter(() -> String.format(
"Reached the maximum number of URI tags for '%s'. Are you using 'uriVariables'?", metricName));
return MeterFilter.maximumAllowableTags(metricName, "uri", properties.getWeb().getClient().getMaxUriTags(),
@SuppressWarnings("deprecation")
MeterFilter metricsHttpClientUriTagFilter(ObservationProperties observationProperties,
MetricsProperties metricsProperties) {
String metricName = metricsProperties.getWeb().getClient().getRequest().getMetricName();
String observationName = observationProperties.getHttp().getClient().getRequests().getName();
String name = (observationName != null) ? observationName : metricName;
MeterFilter denyFilter = new OnlyOnceLoggingDenyMeterFilter(() -> String
.format("Reached the maximum number of URI tags for '%s'. Are you using 'uriVariables'?", name));
return MeterFilter.maximumAllowableTags(name, "uri", metricsProperties.getWeb().getClient().getMaxUriTags(),
denyFilter);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* @author Brian Clozel
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({ "deprecation", "removal" })
class ClientObservationConventionAdapterTests {

private static final String TEST_METRIC_NAME = "test.metric.name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* @author Stephane Nicoll
*/
@ExtendWith(OutputCaptureExtension.class)
@SuppressWarnings("deprecation")
@SuppressWarnings({ "deprecation", "removal" })
class WebClientObservationConfigurationTests {

private final ApplicationContextRunner contextRunner = new ApplicationContextRunner().with(MetricsRun.simple())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
* @deprecated since 3.0.0 for removal in 3.2.0 in favor of
* {@link org.springframework.web.reactive.function.client.DefaultClientObservationConvention}
*/
@Deprecated
@Deprecated(since = "3.0.0", forRemoval = true)
@SuppressWarnings({ "deprecation", "removal" })
public class DefaultWebClientExchangeTagsProvider implements WebClientExchangeTagsProvider {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @author Brian Clozel
* @author Nishant Raut
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({ "deprecation", "removal" })
class DefaultWebClientExchangeTagsProviderTests {

private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @author Brian Clozel
* @author Nishant Raut
*/
@SuppressWarnings({"deprecation", "removal"})
@SuppressWarnings({ "deprecation", "removal" })
class WebClientExchangeTagsTests {

private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate";
Expand Down

0 comments on commit 5b092f5

Please sign in to comment.