tracing

package
Version: v0.0.0-...-05b694e Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 20 Imported by: 87

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// HTTPSpanMiddleware is an http.Handler middleware to create spans for the HTTP endpoint.
	HTTPSpanMiddleware = HTTPSpanIgnoringPaths()
)

Functions

func HTTPSpanIgnoringPaths

func HTTPSpanIgnoringPaths(pathsToIgnore ...string) func(http.Handler) http.Handler

HTTPSpanIgnoringPaths is an http.Handler middleware to create spans for the HTTP endpoint, not sampling any request whose path is in pathsToIgnore.

func SetupDynamicPublishing deprecated

func SetupDynamicPublishing(logger *zap.SugaredLogger, configMapWatcher configmap.Watcher, serviceName, tracingConfigName string) error

Deprecated: Use SetupPublishingWithDynamicConfig.

func SetupStaticPublishing deprecated

func SetupStaticPublishing(logger *zap.SugaredLogger, serviceName string, cfg *config.Config) error

Deprecated: Use SetupPublishingWithStaticConfig.

Types

type ConfigOption

type ConfigOption func(*config.Config) error

ConfigOption is the interface for adding additional exporters and configuring opencensus tracing.

func WithExporter

func WithExporter(name string, logger *zap.SugaredLogger) ConfigOption

WithExporter returns a ConfigOption for use with NewOpenCensusTracer that configures it to export traces based on the configuration read from config-tracing.

func WithExporterFull

func WithExporterFull(name, host string, logger *zap.SugaredLogger) ConfigOption

WithExporterFull supports host argument for WithExporter. The host arg is used for a value of tag ip="{IP}" so you can use an actual IP. Otherwise, the host name must be able to be resolved. e.g)

"name" is a service name like activator-service.
"host" is a endpoint IP like activator-service's endpoint IP.

func WithZipkinExporter deprecated

func WithZipkinExporter(reporterFact ZipkinReporterFactory, endpoint *zipkinmodel.Endpoint) ConfigOption

WithZipkinExporter returns a config with zipkin enabled.

Deprecated: This function is the legacy entrypoint and should be replaced with one of:

  • WithExporter() in production code
  • testing/FakeZipkinExporter() in test code.

type OpenCensusTracer

type OpenCensusTracer struct {
	// contains filtered or unexported fields
}

OpenCensusTracer is responsible for managing and updating configuration of OpenCensus tracing

func NewOpenCensusTracer

func NewOpenCensusTracer(configOptions ...ConfigOption) *OpenCensusTracer

func (*OpenCensusTracer) ApplyConfig

func (oct *OpenCensusTracer) ApplyConfig(cfg *config.Config) error

func (*OpenCensusTracer) Finish deprecated

func (oct *OpenCensusTracer) Finish() error

Deprecated: Use Shutdown.

func (*OpenCensusTracer) Shutdown

func (oct *OpenCensusTracer) Shutdown(ctx context.Context) error

type Tracer

type Tracer interface {
	// Shutdown allows for proper cleanup/flush.
	Shutdown(ctx context.Context) error
}

func SetupPublishingWithDynamicConfig

func SetupPublishingWithDynamicConfig(logger *zap.SugaredLogger, configMapWatcher configmap.Watcher, serviceName, tracingConfigName string) (Tracer, error)

SetupPublishingWithDynamicConfig sets up trace publishing for the process, by watching a ConfigMap for the configuration. The caller should call .Shutdown() on the returned OpenCensusTracer before shutdown to make sure all traces are properly flushed. Note that other pieces still need to generate the traces, this just ensures that if generated, they are collected appropriately. This is normally done by using tracing.HTTPSpanMiddleware as a middleware HTTP handler. The configuration will be dynamically updated when the ConfigMap is updated.

func SetupPublishingWithDynamicConfigAndInitialValue

func SetupPublishingWithDynamicConfigAndInitialValue(logger *zap.SugaredLogger, configMapWatcher configmap.Watcher, serviceName string, configm *corev1.ConfigMap) (Tracer, error)

SetupPublishingWithDynamicConfigAndInitialValue sets up the trace publishing for the process with an initial value, by watching a ConfigMap for the configuration. Note that other pieces still need to generate the traces, this just ensures that if generated, they are collected appropriately. This is normally done by using tracing.HTTPSpanMiddleware as a middleware HTTP handler. The configuration will be dynamically updated when the ConfigMap is updated.

func SetupPublishingWithStaticConfig

func SetupPublishingWithStaticConfig(logger *zap.SugaredLogger, serviceName string, cfg *config.Config) (Tracer, error)

SetupPublishingWithStaticConfig sets up trace publishing for the process. The caller should call .Shutdown() on the returned Tracer before shutdown to make sure all traces are properly flushed. Note that other pieces still need to generate the traces, this just ensures that if generated, they are collected appropriately. This is normally done by using tracing.HTTPSpanMiddleware as a middleware HTTP handler. The configuration will not be dynamically updated.

type ZipkinReporterFactory

type ZipkinReporterFactory func(*config.Config) (zipkinreporter.Reporter, error)

ZipkinReporterFactory is a factory function which creates a reporter given a config

Directories

Path Synopsis
Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Revision controller depends.
Package config holds the typed objects that define the schemas for assorted ConfigMap objects on which the Revision controller depends.

Jump to

Keyboard shortcuts

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