static void checkMetricAndTags ( final String metric , final Map < String , String > tags ) { if ( tags . size ( ) <= 0 ) { throw new IllegalArgumentException ( "Need at least one tag (metric=" + metric + ", tags=" + tags + ' ' ) ; } else if ( tags . size ( ) > Const . MAX_NUM_TAGS ( ) ) { throw new IllegalArgumentException ( "Too many tags: " + tags . size ( ) + " maximum allowed: " + Const . MAX_NUM_TAGS ( ) + ", tags: " + tags ) ; } Tags . validateString ( "metric name" , metric ) ; for ( final Map . Entry < String , String > tag : tags . entrySet ( ) ) { Tags . validateString ( "tag name with value [" + tag . getValue ( ) + "]" , tag . getKey ( ) ) ; Tags . validateString ( "tag value with key [" + tag . getKey ( ) + "]" , tag . getValue ( ) ) ; } }
Validates the given metric and tags .