Skip to content

Commit

Permalink
Add data fetcher references in schema provider for @DgsEntityFetcher …
Browse files Browse the repository at this point in the history
…methods
  • Loading branch information
paulbakker committed Jan 24, 2025
1 parent d3ef3a1 commit 0465e5e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -611,12 +611,17 @@ class DgsSchemaProvider
.forEach { method ->
val dgsEntityFetcherAnnotation = method.getAnnotation(DgsEntityFetcher::class.java)

val entityFetcherTypeName = dgsEntityFetcherAnnotation.name
val coordinateName = "_entities.$entityFetcherTypeName"

val mergedAnnotations = MergedAnnotations
.from(method, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
dataFetcherInfo.dataFetchers += DataFetcherReference(dgsComponent.instance, method, mergedAnnotations, "Query", coordinateName)

val enableInstrumentation =
method.getAnnotation(DgsEnableDataFetcherInstrumentation::class.java)?.value
?: false
val entityFetcherTypeName = dgsEntityFetcherAnnotation.name
if (enableInstrumentation) {
val coordinateName = "__entities.$entityFetcherTypeName"
dataFetcherInfo.tracingEnabled += coordinateName
dataFetcherInfo.metricsEnabled += coordinateName
}
Expand Down

0 comments on commit 0465e5e

Please sign in to comment.