Netflix / dgs-framework

GraphQL for Java with Spring Boot made easy.
https://netflix.github.io/dgs
Apache License 2.0
3.06k stars 295 forks source link

Fix DgsDataLoaderRegistryConsumer when wrapped with Micrometer #1859

Closed prokop7 closed 5 months ago

prokop7 commented 6 months ago

Pull request checklist

Pull Request type

Changes in this PR

When DgsDataLoader is declared as DgsDataLoaderRegistryConsumer and micrometer wrapper is on. Then batchLoader is DgsDataLoaderRegistryConsumer condition willl not work beacuse MappedBatchLoaderWithContextInstrumentationDriver is not DgsDataLoaderRegistryConsumer

Alternatives considered:

I see two viable solutions, first - the one that is in this pull request. This solution isn't the most beautiful but it works Second - make interface DataLoaderProxy with one method fun getOriginal(): DataLoader. With that we can always get the original dataloader within DgsDataLoaderProvider and setup Registry there

prokop7 commented 5 months ago

Sure, done