Skip to content

Commit 7f70c5c

Browse files
heyamstrask
andauthored
Update createTelemetryItemExporter (Azure#37620)
* Update util method * Address comments * Update comment Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com> --------- Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
1 parent 6200f69 commit 7f70c5c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/AzureMonitorExporterBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.azure.monitor.opentelemetry.exporter.implementation.configuration.ConnectionString;
3030
import com.azure.monitor.opentelemetry.exporter.implementation.configuration.StatsbeatConnectionString;
3131
import com.azure.monitor.opentelemetry.exporter.implementation.heartbeat.HeartbeatExporter;
32+
import com.azure.monitor.opentelemetry.exporter.implementation.localstorage.LocalStorageStats;
3233
import com.azure.monitor.opentelemetry.exporter.implementation.models.ContextTagKeys;
3334
import com.azure.monitor.opentelemetry.exporter.implementation.pipeline.TelemetryItemExporter;
3435
import com.azure.monitor.opentelemetry.exporter.implementation.statsbeat.Feature;
@@ -356,7 +357,8 @@ private void internalBuildAndFreeze(ConfigProperties configProperties) {
356357
TempDirs.getApplicationInsightsTempDir(
357358
LOGGER,
358359
"Telemetry will not be stored to disk and retried on sporadic network failures");
359-
builtTelemetryItemExporter = AzureMonitorHelper.createTelemetryItemExporter(httpPipeline, statsbeatModule, tempDir);
360+
// TODO (heya) change LocalStorageStats.noop() to statsbeatModule.getNonessentialStatsbeat() when we decide to collect non-essential Statsbeat by default.
361+
builtTelemetryItemExporter = AzureMonitorHelper.createTelemetryItemExporter(httpPipeline, statsbeatModule, tempDir, LocalStorageStats.noop());
360362
startStatsbeatModule(statsbeatModule, configProperties, tempDir); // wait till TelemetryItemExporter has been initialized before starting StatsbeatModule
361363
frozen = true;
362364
}

sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/utils/AzureMonitorHelper.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
import com.azure.monitor.opentelemetry.exporter.implementation.pipeline.TelemetryItemExporter;
1111
import com.azure.monitor.opentelemetry.exporter.implementation.pipeline.TelemetryPipeline;
1212
import com.azure.monitor.opentelemetry.exporter.implementation.pipeline.TelemetryPipelineListener;
13+
import com.azure.monitor.opentelemetry.exporter.implementation.statsbeat.NonessentialStatsbeat;
1314
import com.azure.monitor.opentelemetry.exporter.implementation.statsbeat.StatsbeatModule;
1415
import com.azure.monitor.opentelemetry.exporter.implementation.statsbeat.StatsbeatTelemetryPipelineListener;
16+
import reactor.util.annotation.NonNull;
1517

1618
import java.io.File;
1719

1820
public final class AzureMonitorHelper {
1921

20-
public static TelemetryItemExporter createTelemetryItemExporter(HttpPipeline httpPipeline, StatsbeatModule statsbeatModule, File tempDir) {
22+
public static TelemetryItemExporter createTelemetryItemExporter(HttpPipeline httpPipeline, StatsbeatModule statsbeatModule, File tempDir, LocalStorageStats localStorageStats) {
2123
TelemetryPipeline telemetryPipeline = new TelemetryPipeline(httpPipeline, statsbeatModule::shutdown);
2224

2325
TelemetryPipelineListener telemetryPipelineListener;
@@ -39,8 +41,7 @@ public static TelemetryItemExporter createTelemetryItemExporter(HttpPipeline htt
3941
50, // default to 50MB
4042
TempDirs.getSubDir(tempDir, "telemetry"),
4143
telemetryPipeline,
42-
// TODO (trask) change this to statsbeatModule.getNonessentialStatsbeat()?
43-
LocalStorageStats.noop(),
44+
localStorageStats,
4445
false));
4546
}
4647

0 commit comments

Comments
 (0)