public List < MetricBean > listCounterMetrics ( String tenantId ) { try { URL endpoint = serverUrl . toURI ( ) . resolve ( "counters" ) . toURL ( ) ; //$NON-NLS-1$ Request request = new Request . Builder ( ) . url ( endpoint ) . header ( "Accept" , "application/json" ) //$NON-NLS-1$ //$NON-NLS-2$ . header ( "Hawkular-Tenant" , tenantId ) //$NON-NLS-1$ . build ( ) ; Response response = httpClient . newCall ( request ) . execute ( ) ; if ( response . code ( ) >= 400 ) { throw hawkularMetricsError ( response ) ; } if ( response . code ( ) == 204 ) { return Collections . EMPTY_LIST ; } String responseBody = response . body ( ) . string ( ) ; return readMapper . reader ( new TypeReference < List < MetricBean > > ( ) { } ) . readValue ( responseBody ) ; } catch ( URISyntaxException | IOException e ) { throw new RuntimeException ( e ) ; } }
Get a list of all counter metrics for a given tenant .