Merge branch '2.6.x' into 2.7.x
Closes gh-30433
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user