adutra commented on code in PR #2887:
URL: https://github.com/apache/polaris/pull/2887#discussion_r2490775312
##########
runtime/service/src/main/java/org/apache/polaris/service/config/ServiceProducers.java:
##########
@@ -405,4 +407,11 @@ public PolarisCredentialManager polarisCredentialManager(
public void closeTaskExecutor(@Disposes @Identifier("task-executor")
ManagedExecutor executor) {
executor.close();
}
+
+ @Produces
+ @RequestScoped
+ public MetricsReporter metricsReporter(
+ MetricsReportingConfiguration config, @Any Instance<MetricsReporter>
reporters) {
+ return reporters.select(Identifier.Literal.of(config.type())).get();
Review Comment:
> Actually, given this producer method, I do not think
DefaultMetricsReporter needs a scope annotation at all. It is always created
via this method.
Yes and no :-) It doesn't need the annotation but 1) all other beans in the
same situation are annotated and 2) annotating the bean allows for direct
injection, e.g. in a test:
```java
@Inject @Identifier("default") MetricsReporter defaultMetricsReporter;
```
So, I'm rather in favor of anotating both places, even if I understand that
this can cause some confusion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]