public AgentConfiguration()

in aws-xray-agent/src/main/java/com/amazonaws/xray/agent/runtime/config/AgentConfiguration.java [66:162]


    public AgentConfiguration(@Nullable Map<String, String> properties) {
        String serviceName = DEFAULT_SERVICE_NAME,
                contextMissingStrategy = "LOG_ERROR",
                daemonAddress = "127.0.0.1:2000",
                samplingStrategy = "CENTRAL",
                traceIdInjectionPrefix = "",
                samplingRulesManifest = null,
                awsServiceHandlerManifest = null;
        int maxStackTraceLength = 50,
                streamingThreshold = 100,
                awsSdkVersion = 2;
        boolean pluginsEnabled = true,
                tracingEnabled = true,
                collectSqlQueries = false,
                traceIdInjection = true,
                contextPropagation = true,
                traceIncomingRequests = true;

        if (properties != null) {
            try {
                for (Map.Entry<String, String> entry : properties.entrySet()) {
                    switch (entry.getKey()) {
                        case "serviceName":
                            serviceName = entry.getValue();
                            break;
                        case "contextMissingStrategy":
                            contextMissingStrategy = entry.getValue();
                            break;
                        case "daemonAddress":
                            daemonAddress = entry.getValue();
                            break;
                        case "samplingStrategy":
                            samplingStrategy = entry.getValue();
                            break;
                        case "traceIdInjectionPrefix":
                            traceIdInjectionPrefix = entry.getValue();
                            break;
                        case "maxStackTraceLength":
                            maxStackTraceLength = Integer.parseInt(entry.getValue());
                            break;
                        case "streamingThreshold":
                            streamingThreshold = Integer.parseInt(entry.getValue());
                            break;
                        case "samplingRulesManifest":
                            samplingRulesManifest = entry.getValue();
                            break;
                        case "awsSdkVersion":
                            awsSdkVersion = Integer.parseInt(entry.getValue());
                            break;
                        case "awsServiceHandlerManifest":
                            awsServiceHandlerManifest = entry.getValue();
                            break;
                        case "pluginsEnabled":
                            pluginsEnabled = Boolean.parseBoolean(entry.getValue());
                            break;
                        case "tracingEnabled":
                            tracingEnabled = Boolean.parseBoolean(entry.getValue());
                            break;
                        case "collectSqlQueries":
                            collectSqlQueries = Boolean.parseBoolean(entry.getValue());
                            break;
                        case "traceIdInjection":
                            traceIdInjection = Boolean.parseBoolean(entry.getValue());
                            break;
                        case "contextPropagation":
                            contextPropagation = Boolean.parseBoolean(entry.getValue());
                            break;
                        case "traceIncomingRequests":
                            traceIncomingRequests = Boolean.parseBoolean(entry.getValue());
                            break;
                        default:
                            log.warn("Encountered unknown property " + entry.getKey() + " in X-Ray agent configuration. Ignoring.");
                            break;
                    }
                }
            } catch (Exception e) {
                throw new InvalidAgentConfigException("Invalid type given in X-Ray Agent configuration file", e);
            }
        }

        this.serviceName = serviceName;
        this.contextMissingStrategy = contextMissingStrategy;
        this.daemonAddress = daemonAddress;
        this.samplingStrategy = samplingStrategy;
        this.traceIdInjectionPrefix = traceIdInjectionPrefix;
        this.maxStackTraceLength = maxStackTraceLength;
        this.streamingThreshold = streamingThreshold;
        this.samplingRulesManifest = samplingRulesManifest;
        this.awsSdkVersion = awsSdkVersion;
        this.awsServiceHandlerManifest = awsServiceHandlerManifest;
        this.pluginsEnabled = pluginsEnabled;
        this.tracingEnabled = tracingEnabled;
        this.collectSqlQueries = collectSqlQueries;
        this.traceIdInjection = traceIdInjection;
        this.contextPropagation = contextPropagation;
        this.traceIncomingRequests = traceIncomingRequests;
    }