Skip to content

Commit

Permalink
Fix the ordering of instrumentation classes to be run.
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasankavitha committed Feb 21, 2025
1 parent b2dc0cc commit 70c84af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegi
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration
import org.springframework.boot.actuate.autoconfigure.metrics.PropertiesAutoTimer
import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.AutoConfigureAfter
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.cache.CacheManager
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.Ordered
import org.springframework.core.annotation.Order
import java.util.Optional

/**
Expand All @@ -39,6 +40,7 @@ open class DgsGraphQLMicrometerAutoConfiguration {
}

@Bean
@Order(Ordered.LOWEST_PRECEDENCE)
@ConditionalOnProperty(
prefix = "$AUTO_CONF_PREFIX.instrumentation",
name = ["enabled"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import org.springframework.context.ApplicationContext
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.DefaultParameterNameDiscoverer
import org.springframework.core.Ordered
import org.springframework.core.PriorityOrdered
import org.springframework.core.ReactiveAdapterRegistry
import org.springframework.core.annotation.Order
Expand Down Expand Up @@ -171,7 +172,9 @@ open class DgsSpringGraphQLAutoConfiguration(
graphQLContextContributors: ObjectProvider<GraphQLContextContributor>,
): Instrumentation = GraphQLContextContributorInstrumentation(graphQLContextContributors.orderedStream().toList())

// This instrumentation needs to run before MetricsInstrumentation
@Bean
@Order(Ordered.LOWEST_PRECEDENCE - 1)
@ConditionalOnProperty(
prefix = "${AUTO_CONF_PREFIX}.errors.classification",
name = ["enabled"],
Expand Down

0 comments on commit 70c84af

Please sign in to comment.