public DTInterceptor()

in opbeans/src/main/java/co/elastic/apm/opbeans/controllers/DTInterceptor.java [36:64]


    public DTInterceptor(Environment env) {

        hostList = env.getProperty("OPBEANS_SERVICES", "").split(",");
        hostList = Arrays.stream(hostList).filter(s -> !s.equals("")).toArray(String[]::new);
        try {
            dtProb = Float.parseFloat(env.getProperty("OPBEANS_DT_PROBABILITY", "0.5"));
        } catch (NumberFormatException ex) {
            dtProb = 0.5f;
        }

        // Disable DT if we don't have any hosts
        if (hostList.length == 0) {
            dtProb = 0f;
        } else {
            // pre-process urls for simplicity
            for (int i = 0; i < hostList.length; i++) {
                if (!hostList[i].startsWith("http")) { //make sure we have a protocol
                    hostList[i] = "http://" + hostList[i]+":3000";
                }
                if (hostList[i].endsWith("/")) { // remove trailing /
                    hostList[i] = hostList[i].substring(0, hostList[i].length()-1);
                }
            }
        }
        restTemplate = new RestTemplate();
        restTemplate.setErrorHandler(new RestTemplateResponseErrorHandler());
        log.debug("DT Probability: {}",dtProb);
        log.debug("DT Services: {}",Arrays.toString(hostList));
    }