Skip to content

Commit

Permalink
Merge pull request #2109 from Netflix/feature/_entities-datafetchers
Browse files Browse the repository at this point in the history
Add data fetcher references in schema provider for @DgsEntityFetcher methods
  • Loading branch information
paulbakker authored Jan 24, 2025
2 parents d3ef3a1 + c2e10ab commit b0aab8a
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -611,12 +611,19 @@ 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 b0aab8a

Please sign in to comment.