File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
collector/src/main/java/io/prometheus/jmx Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1019,19 +1019,26 @@ public MetricSnapshots collect() {
10191019 jmxMBeanPropertyCache );
10201020
10211021 long start = System .nanoTime ();
1022- double error = 0 ;
1022+ double error = 1 ;
1023+ String errorMsg = "" ;
10231024
10241025 if ((config .startDelaySeconds > 0 )
10251026 && ((start - createTimeNanoSecs ) / 1000000000L < config .startDelaySeconds )) {
10261027 throw new IllegalStateException ("JMXCollector waiting for startDelaySeconds" );
10271028 }
10281029 try {
10291030 scraper .doScrape ();
1031+ error = 0 ;
1032+ } catch (java .io .IOException | java .lang .SecurityException e ) {
1033+ errorMsg = e .getMessage ();
10301034 } catch (Exception e ) {
1031- error = 1 ;
10321035 StringWriter sw = new StringWriter ();
10331036 e .printStackTrace (new PrintWriter (sw ));
1034- LOGGER .error ("JMX scrape failed: %s" , sw );
1037+ errorMsg = sw .toString ();
1038+ }
1039+
1040+ if (error == 1 ) {
1041+ LOGGER .error ("JMX scrape failed: %s" , errorMsg );
10351042 }
10361043
10371044 if (config .rulesCache != null ) {
You can’t perform that action at this time.
0 commit comments