adutra commented on code in PR #1662:
URL: https://github.com/apache/polaris/pull/1662#discussion_r2104641693


##########
quarkus/service/src/main/java/org/apache/polaris/service/quarkus/metrics/QuarkusValueExpressionResolver.java:
##########
@@ -22,17 +22,23 @@
 import io.micrometer.common.lang.Nullable;
 import jakarta.annotation.Nonnull;
 import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
 import org.apache.polaris.core.context.RealmContext;
 
 @ApplicationScoped
 public class QuarkusValueExpressionResolver implements ValueExpressionResolver 
{
 
+  @Inject QuarkusMetricsConfiguration metricsConfiguration;
+
   @Override
   public String resolve(@Nonnull String expression, @Nullable Object 
parameter) {
     // TODO maybe replace with CEL of some expression engine and make this 
more generic
-    if (parameter instanceof RealmContext realmContext && 
expression.equals("realmIdentifier")) {
+    if (metricsConfiguration.realmIdTag().apiMetricsEnabled()
+        && parameter instanceof RealmContext realmContext
+        && expression.equals("realmIdentifier")) {
       return realmContext.getRealmIdentifier();
     }
-    return null;
+    // FIXME cannot return null here, see 
https://github.com/quarkusio/quarkus/issues/47891
+    return "";

Review Comment:
   Not sure. I wasn't able to 100% verify this, but it seems that the empty 
string in a tag value is treated as no tag at all. Also the `???` is going to 
go away soon (fix coming in Quarkus 3.24).



-- 
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: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to