Skip to content

Commit

Permalink
feat: Disable the tracing feature and remove public APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsannas committed May 6, 2024
1 parent 82feaae commit a736fcc
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ com.google.cloud.firestore.telemetry.TraceUtil getTraceUtil() {
return traceUtil;
}

@InternalApi
@BetaApi
@Nonnull
public FirestoreOpenTelemetryOptions getOpenTelemetryOptions() {
Expand Down Expand Up @@ -223,6 +224,7 @@ public Builder setDatabaseId(@Nonnull String databaseId) {
*
* @param openTelemetryOptions The `FirestoreOpenTelemetryOptions` to use.
*/
@InternalApi
@BetaApi
@Nonnull
public Builder setOpenTelemetryOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import javax.annotation.Nullable;

public interface TraceUtil {
static final boolean TRACING_FEATURE_ENABLED = false;
String ATTRIBUTE_SERVICE_PREFIX = "gcp.firestore.";
String SPAN_NAME_DOC_REF_CREATE = "DocumentReference.Create";
String SPAN_NAME_DOC_REF_SET = "DocumentReference.Set";
Expand Down Expand Up @@ -62,6 +63,11 @@ public interface TraceUtil {
* @return An instance of the TraceUtil class.
*/
static TraceUtil getInstance(@Nonnull FirestoreOptions firestoreOptions) {
// TODO(tracing): Remove this to enable the feature.
if (!TRACING_FEATURE_ENABLED) {
return new DisabledTraceUtil();
}

boolean createEnabledInstance = firestoreOptions.getOpenTelemetryOptions().isTracingEnabled();

// The environment variable can override options to enable/disable telemetry collection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
import javax.annotation.Nullable;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

// TODO(tracing): Re-enable this test when the tracing feature is enabled.
@Ignore
public class OpenTelemetryOptionsTest {
@Nullable private Firestore firestore;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
*/
package com.google.cloud.firestore.it;

import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
@Ignore
public class ITE2ETracingTestGlobalOtel extends ITE2ETracingTest {
@Override
protected boolean isUsingGlobalOpenTelemetrySDK() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
*/
package com.google.cloud.firestore.it;

import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
@Ignore
public class ITE2ETracingTestNonGlobalOtel extends ITE2ETracingTest {
@Override
protected boolean isUsingGlobalOpenTelemetrySDK() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
*/
package com.google.cloud.firestore.it;

import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
@Ignore
public class ITTracingTestGlobalOtel extends ITTracingTest {
@Override
protected boolean isUsingGlobalOpenTelemetrySDK() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
*/
package com.google.cloud.firestore.it;

import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
@Ignore
public class ITTracingTestNonGlobalOtel extends ITTracingTest {
@Override
protected boolean isUsingGlobalOpenTelemetrySDK() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public void tracingEnabledOptionsUseEnabledTraceUtil() {
.setOpenTelemetryOptions(
FirestoreOpenTelemetryOptions.newBuilder().setTracingEnabled(true).build())
.build());
assertThat(traceUtil instanceof EnabledTraceUtil).isTrue();

// This is currently disabled because the feature is disabled as a whole.
// TODO (tracing): This should be `traceUtil instanceof EnabledTraceUtil
// once the feature is enabled.
assertThat(traceUtil instanceof DisabledTraceUtil).isTrue();
}
}

0 comments on commit a736fcc

Please sign in to comment.