use of com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileCache 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;
}
use of com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileCache in project ApplicationInsights-Java by microsoft.
the class TelemetryChannelTest method getTelemetryChannel.
private TelemetryChannel getTelemetryChannel() throws MalformedURLException {
List<HttpPipelinePolicy> policies = new ArrayList<>();
policies.add(new RedirectPolicy(Cache.bounded(5)));
HttpPipelineBuilder pipelineBuilder = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])).httpClient(recordingHttpClient);
LocalFileCache localFileCache = new LocalFileCache(tempFolder);
StatsbeatModule mockedStatsModule = Mockito.mock(StatsbeatModule.class);
when(mockedStatsModule.getNetworkStatsbeat()).thenReturn(Mockito.mock(NetworkStatsbeat.class));
return new TelemetryChannel(pipelineBuilder.build(), new URL(END_POINT_URL), new LocalFileWriter(localFileCache, tempFolder, null), mockedStatsModule, false);
}
use of com.microsoft.applicationinsights.agent.internal.localstorage.LocalFileCache 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);
}
Aggregations