jbonofre commented on code in PR #2887:
URL: https://github.com/apache/polaris/pull/2887#discussion_r2485461539


##########
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:
   A factory is `ApplicationScoped`(or `Singleton`), but a bean can be 
`ApplicationScoped` or `RequestScoped`:
   
   * Should the bean exist only during the lifespan of a request? If so, use 
[@RequestScoped](http://docs.oracle.com/javaee/7/api/javax/enterprise/context/RequestScoped.html).
   * Should the bean exist during the lifespan of the application and should 
the state of the bean be shared between all the requests? If so, use 
[@ApplicationScoped](http://docs.oracle.com/javaee/7/api/javax/enterprise/context/ApplicationScoped.html).
   
   So, to use `ApplicationScoped` here, a factory is probably clearer.



-- 
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]

Reply via email to