Class DatastoreOpenTelemetryOptions (3.1.0)

public class DatastoreOpenTelemetryOptions

Represents the options that are used to configure the use of OpenTelemetry for telemetry collection in the Datastore SDK.

Inheritance

java.lang.Object > DatastoreOpenTelemetryOptions

Static Methods

newBuilder()

public static DatastoreOpenTelemetryOptions.Builder newBuilder()

Returns a new default Builder.

Returns
Type Description
DatastoreOpenTelemetryOptions.Builder

a new Builder.

Methods

getOpenTelemetry()

public OpenTelemetry getOpenTelemetry()

Returns the configured custom OpenTelemetry instance.

Returns
Type Description
io.opentelemetry.api.OpenTelemetry

the configured OpenTelemetry instance, or the global instance if a custom one was not provided. If there is no global instance, then OpenTelemetry.noop() is returned.

isEnabled()

public boolean isEnabled()

Returns whether either tracing or custom metrics (via a user-provided OpenTelemetry instance) are enabled.

Note: This method does not reflect the state of built-in metrics export to Google Cloud Monitoring, which is controlled separately by #isExportBuiltinMetricsToGoogleCloudMonitoring() and is false by default. To check whether any telemetry is active, also consult that flag.

Returns
Type Description
boolean

true if tracing or custom OTel metrics are enabled, false otherwise.

isExportBuiltinMetricsToGoogleCloudMonitoring()

public boolean isExportBuiltinMetricsToGoogleCloudMonitoring()

Returns whether built-in metrics should be exported to Google Cloud Monitoring.

When enabled, client-side metrics are automatically exported to Google Cloud Monitoring using the Cloud Monitoring API. This is independent of the custom OpenTelemetry backend configured via #getOpenTelemetry().

Returns
Type Description
boolean

true if built-in metrics export to Cloud Monitoring is enabled, false otherwise.

isMetricsEnabled()

public boolean isMetricsEnabled()

Returns whether metrics are enabled for the custom (user-provided) OpenTelemetry backend.

Returns
Type Description
boolean

true if metrics are enabled, false otherwise.

isTracingEnabled()

public boolean isTracingEnabled()

Returns whether tracing is enabled.

Returns
Type Description
boolean

true if tracing is enabled, false otherwise.

toBuilder()

public DatastoreOpenTelemetryOptions.Builder toBuilder()

Returns a new Builder initialized with the values from this options instance.

Returns
Type Description
DatastoreOpenTelemetryOptions.Builder

a new Builder.