public static MetricsLogger getMetricsLogger ( final String dimensions ) { if ( MetricsManager . instance != null ) { final Map < String , String > dimensionsMap = DimensionsUtils . parseDimensions ( dimensions ) ; if ( ! dimensionsMap . isEmpty ( ) ) { dimensionsMap . put ( "service" , MetricsManager . instance . serviceName ) ; if ( MetricsManager . instance . env . length ( ) > 0 ) { dimensionsMap . put ( "env" , MetricsManager . instance . env ) ; } return MetricsManager . instance . metricsLoggers . computeIfAbsent ( DimensionsUtils . serializeDimensionsToString ( dimensionsMap ) , key -> new MetricsLogger ( dimensionsMap ) ) ; } else { throw new IllegalArgumentException ( "Dimensions must be valid and non-empty" ) ; } } return dummyLogger ; }
Get MetricsLogger to start collecting metrics . MetricsLogger can be used to collect Counter Timer or Recorder