tracing

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OnePercentSampling is a configuration that samples 1% of the requests.
	// TODO(#1712): Remove this and pull "static" configuration from the
	// environment instead.
	OnePercentSampling = &tracingconfig.Config{
		Backend:        tracingconfig.Zipkin,
		Debug:          false,
		SampleRate:     0.01,
		ZipkinEndpoint: "http://zipkin.istio-system.svc.cluster.local:9411/api/v2/spans",
	}

	// AlwaysSample is a configuration that samples 100% of the requests and sends them to Zipkin.
	// It is expected to be used only for testing purposes (e.g. in e2e tests).
	// TODO(#1712): Remove this and pull "static" configuration from the environment instead.
	AlwaysSample = &tracingconfig.Config{
		Backend:        tracingconfig.Zipkin,
		Debug:          true,
		SampleRate:     1.0,
		ZipkinEndpoint: "http://zipkin.istio-system.svc.cluster.local:9411/api/v2/spans",
	}
)

Functions

func AddSpanFromTraceparentAttribute added in v0.10.0

func AddSpanFromTraceparentAttribute(ctx context.Context, name string, event cloudevents.Event) (context.Context, error)

AddSpanFromTraceparentAttribute extracts the traceparent extension attribute from the CloudEvent and returns a context with that span set. If the traceparent extension attribute is not found or cannot be parsed, then an error is returned.

func AddTraceparentAttributeFromContext added in v0.10.0

func AddTraceparentAttributeFromContext(ctx context.Context, event cloudevents.Event) cloudevents.Event

AddTraceparentAttributeFromContext returns a CloudEvent that is identical to the input event, with the traceparent CloudEvents extension attribute added. The value for that attribute is the Span stored in the context.

The context is expected to have passed through the OpenCensus HTTP Handler, so that the Span has been added to it.

func BrokerFilterName added in v0.7.0

func BrokerFilterName(args BrokerFilterNameArgs) string

BrokerFilterName creates the service name for Broker Filters to use when writing traces.

func BrokerIngressName added in v0.7.0

func BrokerIngressName(args BrokerIngressNameArgs) string

BrokerIngressName creates the service name for Broker Ingresses to use when writing Zipkin traces.

func SetupDynamicPublishing added in v0.9.0

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

SetupDynamicPublishing sets up trace publishing for the process, 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 SetupStaticPublishing added in v0.9.0

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

SetupStaticPublishing sets up trace publishing for the process. 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.

Types

type BrokerFilterNameArgs added in v0.7.0

type BrokerFilterNameArgs struct {
	Namespace  string
	BrokerName string
}

BrokerFilterNameArgs are the arguments needed to generate the BrokerFilterName.

type BrokerIngressNameArgs added in v0.7.0

type BrokerIngressNameArgs struct {
	Namespace  string
	BrokerName string
}

BrokerIngressNameArgs are the arguments needed to generate the BrokerIngressName.

Jump to

Keyboard shortcuts

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