private String readInstrumentationKeyFromConfiguration ( ) { try ( final InputStream inputStream = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( CONFIGURATION_FILE ) ) { final String configuration = IOUtils . toString ( inputStream ) ; final Matcher matcher = INSTRUMENTATION_KEY_PATTERN . matcher ( configuration ) ; if ( matcher . find ( ) ) { return matcher . group ( 1 ) ; } else { return StringUtils . EMPTY ; } } catch ( IOException exception ) { return StringUtils . EMPTY ; } }
Get instrumentation key from ApplicationInsights . xml