private static GroupName nameFromObjectName ( ObjectName obj_name , NamedResolverMap resolvedMap ) { String name = obj_name . getKeyProperty ( "name" ) ; String type = obj_name . getKeyProperty ( "type" ) ; String domain = obj_name . getDomain ( ) ; Map < String , MetricValue > tags = obj_name . getKeyPropertyList ( ) . entrySet ( ) . stream ( ) . filter ( ( entry ) - > ! entry . getKey ( ) . equals ( "name" ) ) . filter ( ( entry ) - > ! entry . getKey ( ) . equals ( "type" ) ) . map ( Tag :: valueOf ) . collect ( Collectors . toMap ( ( Tag t ) -> t . getName ( ) , ( Tag t ) -> t . getValue ( ) ) ) ; final List < String > path = new ArrayList <> ( ) ; if ( name != null ) { path . addAll ( Arrays . asList ( name . split ( "\\." ) ) ) ; } else if ( type != null ) { path . addAll ( Arrays . asList ( domain . split ( "\\." ) ) ) ; path . add ( type ) ; } else { path . addAll ( Arrays . asList ( domain . split ( "\\." ) ) ) ; } return resolvedMap . getGroupName ( path , tags ) ; }
Extract a metric group name from a JMX ObjectName .