<commit_before>package com.microsoft.applicationinsights.library.config;

import com.microsoft.applicationinsights.library.ApplicationInsights;

public class ApplicationInsightsConfig implements ISenderConfig, ISessionConfig, IQueueConfig {

    // Default values for queue config
    private static final int DEBUG_MAX_BATCH_COUNT = 5;
    private static final int DEBUG_MAX_BATCH_INTERVAL_MS = 3 * 1000;
    private static final int DEFAULT_MAX_BATCH_COUNT = 100;
    private static final int DEFAULT_MAX_BATCH_INTERVAL_MS = 15 * 1000;

    // Default values for sender config
    private static final String DEFAULT_ENDPOINT_URL = "https://dc.services.visualstudio.com/v2/track";
    private static final int DEFAULT_SENDER_READ_TIMEOUT = 10 * 1000;
    private static final int DEFAULTSENDER_CONNECT_TIMEOUT = 15 * 1000;

    // Default values for session config
    protected static final int DEFAULT_SESSION_INTERVAL = 20 * 1000; // 20 seconds
    
    /**
     * Lock object to ensure thread safety of the configuration
     */
    protected final Object lock;

    /**
     * The maximum size of a batch in bytes
     */
    private int maxBatchCount;

    /**
     * The maximum interval allowed between calls to batchInvoke
     */
    private int maxBatchIntervalMs;

    /**
     * The url to which payloads will be sent
     */
    private String endpointUrl;

    /**
     * The timeout for reading the response from the data collector endpoint
     */

    private int senderReadTimeoutMs;

    /**
     * The timeout for connecting to the data collector endpoint
     */
    private int senderConnectTimeoutMs;

    /**
     * The interval at which sessions are renewed
     */
    private long sessionIntervalMs;

    /**
     * Constructs a new INSTANCE of a config
     */
    public ApplicationInsightsConfig() {
        this.lock = new Object();

        // Initialize default values for queue config
        this.maxBatchCount = (ApplicationInsights.isDeveloperMode()) ? DEBUG_MAX_BATCH_COUNT : DEFAULT_MAX_BATCH_COUNT;
        this.maxBatchIntervalMs = (ApplicationInsights.isDeveloperMode()) ? DEBUG_MAX_BATCH_INTERVAL_MS : DEFAULT_MAX_BATCH_INTERVAL_MS;

        // Initialize default values for sender config
        this.endpointUrl = DEFAULT_ENDPOINT_URL;
        this.senderReadTimeoutMs = DEFAULT_SENDER_READ_TIMEOUT;
        this.senderConnectTimeoutMs = DEFAULTSENDER_CONNECT_TIMEOUT;

        // Initialize default values for session config
        this.sessionIntervalMs = DEFAULT_SESSION_INTERVAL;
    }

    /**
     * Gets the maximum size of a batch in bytes
     * @return the max batch count until we send a bundle of data to the server
     */
    public int getMaxBatchCount() {
        return this.maxBatchCount;
    }

    /**
     * Sets the maximum size of a batch in bytes<commit_msg>Add todo: config default values<commit_after>package com.microsoft.applicationinsights.library.config;

import com.microsoft.applicationinsights.library.ApplicationInsights;

public class ApplicationInsightsConfig implements ISenderConfig, ISessionConfig, IQueueConfig {

    // Default values for queue config
    private static final int DEBUG_MAX_BATCH_COUNT = 5;
    private static final int DEBUG_MAX_BATCH_INTERVAL_MS = 3 * 1000;
    private static final int DEFAULT_MAX_BATCH_COUNT = 100;
    private static final int DEFAULT_MAX_BATCH_INTERVAL_MS = 15 * 1000;

    // Default values for sender config
    private static final String DEFAULT_ENDPOINT_URL = "https://dc.services.visualstudio.com/v2/track";
    private static final int DEFAULT_SENDER_READ_TIMEOUT = 10 * 1000;
    private static final int DEFAULTSENDER_CONNECT_TIMEOUT = 15 * 1000;

    // Default values for session config
    protected static final int DEFAULT_SESSION_INTERVAL = 20 * 1000; // 20 seconds
    
    /**
     * Lock object to ensure thread safety of the configuration
     */
    protected final Object lock;

    /**
     * The maximum size of a batch in bytes
     */
    private int maxBatchCount;

    /**
     * The maximum interval allowed between calls to batchInvoke
     */
    private int maxBatchIntervalMs;

    /**
     * The url to which payloads will be sent
     */
    private String endpointUrl;

    /**
     * The timeout for reading the response from the data collector endpoint
     */

    private int senderReadTimeoutMs;

    /**
     * The timeout for connecting to the data collector endpoint
     */
    private int senderConnectTimeoutMs;

    /**
     * The interval at which sessions are renewed
     */
    private long sessionIntervalMs;

    /**
     * Constructs a new INSTANCE of a config
     */
    public ApplicationInsightsConfig() {
        this.lock = new Object();

        // Initialize default values for queue config
        //TODO: If running on a device with developer mode enabled, the default values will be set (move to getter)
        this.maxBatchCount = (ApplicationInsights.isDeveloperMode()) ? DEBUG_MAX_BATCH_COUNT : DEFAULT_MAX_BATCH_COUNT;
        this.maxBatchIntervalMs = (ApplicationInsights.isDeveloperMode()) ? DEBUG_MAX_BATCH_INTERVAL_MS : DEFAULT_MAX_BATCH_INTERVAL_MS;

        // Initialize default values for sender config
        this.endpointUrl = DEFAULT_ENDPOINT_URL;
        this.senderReadTimeoutMs = DEFAULT_SENDER_READ_TIMEOUT;
        this.senderConnectTimeoutMs = DEFAULTSENDER_CONNECT_TIMEOUT;

        // Initialize default values for session config
        this.sessionIntervalMs = DEFAULT_SESSION_INTERVAL;
    }

    /**
     * Gets the maximum size of a batch in bytes
     * @return the max batch count until we send a bundle of data to the server
     */
    public int getMaxBatchCount() {
        return this.maxBatchCount;
    }

    /**
     * Sets the maximum size of a batch in bytes
{'fraction_non_alphanumeric': 0.06159420289855073, 'fraction_numerical': 0.012422360248447204, 'mean_word_length': 2.992424242424242, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3147276', 'n_tokens_mistral': 1598, 'n_tokens_neox': 1491, 'n_words': 516}