Search in sources :

Example 1 with LocalFileLoader

use of com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileLoader in project ApplicationInsights-Java by microsoft.

the class TelemetryClient method getStatsbeatChannelBatcher.

public BatchSpanProcessor getStatsbeatChannelBatcher() {
    if (statsbeatChannelBatcher == null) {
        synchronized (channelInitLock) {
            if (statsbeatChannelBatcher == null) {
                File statsbeatFolder;
                LocalFileLoader localFileLoader = null;
                LocalFileWriter localFileWriter = null;
                if (!readOnlyFileSystem) {
                    statsbeatFolder = LocalStorageUtils.getOfflineStatsbeatFolder();
                    LocalFileCache localFileCache = new LocalFileCache(statsbeatFolder);
                    localFileLoader = new LocalFileLoader(localFileCache, statsbeatFolder, null);
                    localFileWriter = new LocalFileWriter(localFileCache, statsbeatFolder, null);
                }
                TelemetryChannel channel = TelemetryChannel.create(endpointProvider.getStatsbeatEndpointUrl(), localFileWriter, ikeyEndpointMap, statsbeatModule, true, null);
                if (!readOnlyFileSystem) {
                    LocalFileSender.start(localFileLoader, channel);
                }
                statsbeatChannelBatcher = BatchSpanProcessor.builder(channel).build("statsbeat");
            }
        }
    }
    return statsbeatChannelBatcher;
}
Also used : LocalFileLoader(com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileLoader) LocalFileCache(com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileCache) LocalFileWriter(com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileWriter) File(java.io.File)

Example 2 with LocalFileLoader

use of com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileLoader in project ApplicationInsights-Java by microsoft.

the class TelemetryClient method initChannelBatcher.

private BatchSpanProcessor initChannelBatcher(int exportQueueCapacity, int maxExportBatchSize, String queueName) {
    LocalFileLoader localFileLoader = null;
    LocalFileWriter localFileWriter = null;
    if (!readOnlyFileSystem) {
        File telemetryFolder = LocalStorageUtils.getOfflineTelemetryFolder();
        LocalFileCache localFileCache = new LocalFileCache(telemetryFolder);
        localFileLoader = new LocalFileLoader(localFileCache, telemetryFolder, statsbeatModule.getNonessentialStatsbeat());
        localFileWriter = new LocalFileWriter(localFileCache, telemetryFolder, statsbeatModule.getNonessentialStatsbeat());
    }
    TelemetryChannel channel = TelemetryChannel.create(endpointProvider.getIngestionEndpointUrl(), localFileWriter, ikeyEndpointMap, statsbeatModule, false, aadAuthentication);
    if (!readOnlyFileSystem) {
        LocalFileSender.start(localFileLoader, channel);
    }
    return BatchSpanProcessor.builder(channel).setMaxQueueSize(exportQueueCapacity).setMaxExportBatchSize(maxExportBatchSize).setMaxPendingExports(100).build(queueName);
}
Also used : LocalFileLoader(com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileLoader) LocalFileCache(com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileCache) LocalFileWriter(com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileWriter) File(java.io.File)

Aggregations

LocalFileCache (com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileCache)2 LocalFileLoader (com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileLoader)2 LocalFileWriter (com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileWriter)2 File (java.io.File)2