Merge branch '2.6.x' into 2.7.x

Closes gh-30433
pull/30472/head
Andy Wilkinson 3 years ago
commit 64888b0deb

@ -33,7 +33,6 @@ import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.Timer;
import org.springframework.boot.actuate.metrics.AutoTimer;
import org.springframework.lang.Nullable;
/**
* Micrometer-based {@link SimpleInstrumentation}.
@ -117,7 +116,7 @@ public class GraphQlMetricsInstrumentation extends SimpleInstrumentation {
}
private void recordDataFetcherMetric(Timer.Sample sample, DataFetcher<?> dataFetcher,
InstrumentationFieldFetchParameters parameters, @Nullable Throwable throwable) {
InstrumentationFieldFetchParameters parameters, Throwable throwable) {
Timer.Builder timer = this.autoTimer.builder("graphql.datafetcher");
timer.tags(this.tagsProvider.getDataFetchingTags(dataFetcher, parameters, throwable));
sample.stop(timer.register(this.registry));

@ -27,7 +27,6 @@ import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchPar
import graphql.schema.GraphQLObjectType;
import io.micrometer.core.instrument.Tag;
import org.springframework.lang.Nullable;
import org.springframework.util.CollectionUtils;
/**
@ -48,7 +47,7 @@ public final class GraphQlTags {
}
public static Tag executionOutcome(ExecutionResult result, @Nullable Throwable exception) {
public static Tag executionOutcome(ExecutionResult result, Throwable exception) {
if (exception == null && result.getErrors().isEmpty()) {
return OUTCOME_SUCCESS;
}
@ -84,7 +83,7 @@ public final class GraphQlTags {
return Tag.of("errorPath", builder.toString());
}
public static Tag dataFetchingOutcome(@Nullable Throwable exception) {
public static Tag dataFetchingOutcome(Throwable exception) {
return (exception != null) ? OUTCOME_ERROR : OUTCOME_SUCCESS;
}

@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,8 +23,6 @@ import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchPar
import graphql.schema.DataFetcher;
import io.micrometer.core.instrument.Tag;
import org.springframework.lang.Nullable;
/**
* A contributor of {@link Tag Tags} for Spring GraphQL-based request handling. Typically,
* used by a {@link GraphQlTagsProvider} to provide tags in addition to its defaults.
@ -35,11 +33,11 @@ import org.springframework.lang.Nullable;
public interface GraphQlTagsContributor {
Iterable<Tag> getExecutionTags(InstrumentationExecutionParameters parameters, ExecutionResult result,
@Nullable Throwable exception);
Throwable exception);
Iterable<Tag> getErrorTags(InstrumentationExecutionParameters parameters, GraphQLError error);
Iterable<Tag> getDataFetchingTags(DataFetcher<?> dataFetcher, InstrumentationFieldFetchParameters parameters,
@Nullable Throwable exception);
Throwable exception);
}

@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,8 +23,6 @@ import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchPar
import graphql.schema.DataFetcher;
import io.micrometer.core.instrument.Tag;
import org.springframework.lang.Nullable;
/**
* Provides {@link Tag Tags} for Spring GraphQL-based request handling.
*
@ -34,11 +32,11 @@ import org.springframework.lang.Nullable;
public interface GraphQlTagsProvider {
Iterable<Tag> getExecutionTags(InstrumentationExecutionParameters parameters, ExecutionResult result,
@Nullable Throwable exception);
Throwable exception);
Iterable<Tag> getErrorTags(InstrumentationExecutionParameters parameters, GraphQLError error);
Iterable<Tag> getDataFetchingTags(DataFetcher<?> dataFetcher, InstrumentationFieldFetchParameters parameters,
@Nullable Throwable exception);
Throwable exception);
}

@ -27,8 +27,6 @@ import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.springframework.core.io.UrlResource;
import org.springframework.util.Assert;
@ -54,7 +52,6 @@ public final class ImportCandidates implements Iterable<String> {
this.candidates = Collections.unmodifiableList(candidates);
}
@NotNull
@Override
public Iterator<String> iterator() {
return this.candidates.iterator();

@ -13,7 +13,8 @@
name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck">
<property name="regexp" value="true" />
<property name="illegalPkgs"
value="^sun.*, ^org\.apache\.commons\.(?!compress|dbcp2|logging|pool2).*, ^com\.datastax\.oss\.driver\.shaded.*, ^com\.google\.common.*, ^io\.micrometer\.shaded.*, ^org\.testcontainers\.shaded.*" />
value="^sun.*, ^org\.apache\.commons\.(?!compress|dbcp2|logging|pool2).*, ^com\.datastax\.oss\.driver\.shaded.*, ^com\.google\.common.*, ^io\.micrometer\.shaded.*,
^org\.jetbrains\.annotations.*, ^org\.testcontainers\.shaded.*" />
<property name="illegalClasses"
value="^com\.hazelcast\.util\.Base64, ^org\.junit\.rules\.ExpectedException, ^org\.mockito\.InjectMocks, ^org\.slf4j\.LoggerFactory, ^org.springframework.context.annotation.ScannedGenericBeanDefinition, ^reactor\.core\.support\.Assert"/>
</module>

@ -2,6 +2,7 @@
<!DOCTYPE import-control PUBLIC "-//Checkstyle//DTD ImportControl Configuration 1.4//EN" "https://checkstyle.org/dtds/import_control_1_4.dtd">
<import-control pkg="org.springframework.boot">
<disallow pkg="io.micrometer" />
<disallow pkg="org.springframework.lang" />
<allow pkg=".*" regex="true" />
<subpackage name="autoconfigure">
<disallow class="org.springframework.boot.autoconfigure.jdbc.DataSourceProperties"/>
@ -45,6 +46,13 @@
<subpackage name="endpoint">
<disallow pkg="org.springframework.http" />
<disallow pkg="org.springframework.web" />
<subpackage name="invoke">
<subpackage name="reflect">
<file name="OperationMethodParameter">
<allow pkg="org.springframework.lang"/>
</file>
</subpackage>
</subpackage>
<subpackage name="web">
<allow pkg="org.springframework.http" />
<allow pkg="org.springframework.web" />
@ -56,6 +64,9 @@
</subpackage>
</subpackage>
</subpackage>
<file name=".*Endpoint(WebExtension)?" regex="true">
<allow pkg="org.springframework.lang"/>
</file>
</subpackage>
<subpackage name="docs">

Loading…
Cancel
Save