Skip to content

Commit 6d749ad

Browse files
committed
chore: Do not send metrics if there is an emulator
1 parent dc073fb commit 6d749ad

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/telemetry/DatastoreMetricsRecorder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ static DatastoreMetricsRecorder getInstance(@Nonnull DatastoreOptions datastoreO
114114

115115
// If the user has enabled metrics, we will attempt to export metrics to their
116116
// configured backend. We will first check their supplied Otel object, then check
117-
// the global Otel config. If there is nothing configured, then a no-op Otel object
118-
// will be used.
119-
if (otelOptions.isMetricsEnabled()) {
117+
// the global Otel config.
118+
// Note: Metrics will not be sent if an emulator is enabled.
119+
if (otelOptions.isMetricsEnabled() && !emulatorEnabled) {
120120
OpenTelemetry customOtel = otelOptions.getOpenTelemetry();
121121
if (customOtel == null) {
122122
customOtel = GlobalOpenTelemetry.get();

0 commit comments

Comments
 (0)