Stefan Grimm created SLING-11429:
------------------------------------

             Summary: OSGi configs on same resource type cause IAE
                 Key: SLING-11429
                 URL: https://issues.apache.org/jira/browse/SLING-11429
             Project: Sling
          Issue Type: Improvement
          Components: GraphQL
    Affects Versions: GraphQL Core 0.0.12
            Reporter: Stefan Grimm


Currently, if we have more than one OSGi configuration for {{GraphQLServlet}} 
registered on the same resource type, the {{activate}} method throws an 
{{InvalidArgumentException}}.

Stacktrace is:

{noformat}
org.apache.sling.graphql.core.servlet.GraphQLServlet bundle 
org.apache.sling.graphql.core:0.0.12 
(528)[org.apache.sling.graphql.core.servlet.GraphQLServlet(3271)] : The 
activate method has thrown an exception (java.lang.IllegalArgumentException: A 
metric named 
org.apache.sling.graphql.core.servlet.GraphQLServlet.rt:graphql/sites/components/endpoint.m:GET_POST.e:json.cache_hit_rate
 already exists)
java.lang.IllegalArgumentException: A metric named 
org.apache.sling.graphql.core.servlet.GraphQLServlet.rt:graphql/sites/components/endpoint.m:GET_POST.e:json.cache_hit_rate
 already exists
        at com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:91)
        at 
org.apache.sling.graphql.core.servlet.GraphQLServlet.activate(GraphQLServlet.java:199)
{noformat}

Probably some additional data should be used on top of the resource type to 
create the name for the metric(s). If that's not possible, it would at least be 
great to handle this more gracefully (log a proper error message instead of 
throwing an {{IllegalArgumentException}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to