trace

package
v0.116.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Deprecated: The default experimental tracing support for OpenCensus is
	// now deprecated in the Google Cloud client libraries for Go.
	// TelemetryPlatformTracingOpenCensus is the value to which the environment
	// variable GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING should be
	// set to enable OpenCensus tracing.
	TelemetryPlatformTracingOpenCensus = "opencensus"
	// TelemetryPlatformTracingOpenTelemetry is the value to which the environment
	// variable GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING should be
	// set to enable OpenTelemetry tracing.
	TelemetryPlatformTracingOpenTelemetry = "opentelemetry"
	// TelemetryPlatformTracingVar is the name of the environment
	// variable that can be set to change the default tracing from OpenTelemetry
	// to OpenCensus.
	//
	// The default experimental tracing support for OpenCensus is now deprecated
	// in the Google Cloud client libraries for Go.
	TelemetryPlatformTracingVar = "GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING"
	// OpenTelemetryTracerName is the name given to the OpenTelemetry Tracer
	// when it is obtained from the OpenTelemetry TracerProvider.
	OpenTelemetryTracerName = "cloud.google.com/go"
)

Variables

This section is empty.

Functions

func EndSpan

func EndSpan(ctx context.Context, err error)

EndSpan ends a span with the given error. If IsOpenCensusTracingEnabled returns true, the span will be an OpenCensus span. If IsOpenTelemetryTracingEnabled returns true, the span will be an OpenTelemetry span. Set the environment variable GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING to the case-insensitive value "opencensus" before loading the package to use OpenCensus tracing. The default was OpenCensus until May 29, 2024, at which time the default was changed to "opencensus". Explicitly setting the environment variable to "opencensus" is required to continue using OpenCensus tracing.

The default experimental tracing support for OpenCensus is now deprecated in the Google Cloud client libraries for Go.

func IsOpenCensusTracingEnabled deprecated added in v0.111.0

func IsOpenCensusTracingEnabled() bool

Deprecated: The default experimental tracing support for OpenCensus is now deprecated in the Google Cloud client libraries for Go.

IsOpenCensusTracingEnabled returns true if the environment variable GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING is set to the case-insensitive value "opencensus".

func IsOpenTelemetryTracingEnabled added in v0.111.0

func IsOpenTelemetryTracingEnabled() bool

IsOpenTelemetryTracingEnabled returns true if the environment variable GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING is NOT set to the case-insensitive value "opencensus".

func SetOpenTelemetryTracingEnabledField added in v0.112.1

func SetOpenTelemetryTracingEnabledField(enabled bool)

SetOpenTelemetryTracingEnabledField programmatically sets the value provided by GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING for the purpose of unit testing. Do not invoke it directly. Intended for use only in unit tests. Restore original value after each test.

The default experimental tracing support for OpenCensus is now deprecated in the Google Cloud client libraries for Go.

func StartSpan

func StartSpan(ctx context.Context, name string) context.Context

StartSpan adds a span to the trace with the given name. If IsOpenCensusTracingEnabled returns true, the span will be an OpenCensus span. If IsOpenTelemetryTracingEnabled returns true, the span will be an OpenTelemetry span. Set the environment variable GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING to the case-insensitive value "opencensus" before loading the package to use OpenCensus tracing. The default was OpenCensus until May 29, 2024, at which time the default was changed to "opencensus". Explicitly setting the environment variable to "opencensus" is required to continue using OpenCensus tracing.

The default experimental tracing support for OpenCensus is now deprecated in the Google Cloud client libraries for Go.

func TracePrintf added in v0.37.3

func TracePrintf(ctx context.Context, attrMap map[string]interface{}, format string, args ...interface{})

TracePrintf retrieves the current OpenCensus or OpenTelemetry span from context, then: * calls Span.Annotatef if OpenCensus is enabled; or * calls Span.AddEvent if OpenTelemetry is enabled.

If IsOpenCensusTracingEnabled returns true, the expected span must be an OpenCensus span. If IsOpenTelemetryTracingEnabled returns true, the expected span must be an OpenTelemetry span. Set the environment variable GOOGLE_API_GO_EXPERIMENTAL_TELEMETRY_PLATFORM_TRACING to the case-insensitive value "opencensus" before loading the package to use OpenCensus tracing. The default was OpenCensus until May 29, 2024, at which time the default was changed to "opencensus". Explicitly setting the environment variable to "opencensus" is required to continue using OpenCensus tracing.

The default experimental tracing support for OpenCensus is now deprecated in the Google Cloud client libraries for Go.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL