opencensus

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package opencensus provides Go kit integration to the OpenCensus project. OpenCensus is a single distribution of libraries for metrics and distributed tracing with minimal overhead that allows you to export data to multiple backends. The Go kit OpenCencus package as provided here contains middlewares for tracing.

Index

Constants

View Source
const TraceEndpointDefaultName = "gokit/endpoint"

TraceEndpointDefaultName is the default endpoint span name to use.

Variables

This section is empty.

Functions

func GRPCClientTrace

func GRPCClientTrace(options ...TracerOption) kitgrpc.ClientOption

GRPCClientTrace enables OpenCensus tracing of a Go kit gRPC transport client.

func GRPCServerTrace

func GRPCServerTrace(options ...TracerOption) kitgrpc.ServerOption

GRPCServerTrace enables OpenCensus tracing of a Go kit gRPC transport server.

func HTTPClientTrace

func HTTPClientTrace(options ...TracerOption) kithttp.ClientOption

HTTPClientTrace enables OpenCensus tracing of a Go kit HTTP transport client.

func HTTPServerTrace

func HTTPServerTrace(options ...TracerOption) kithttp.ServerOption

HTTPServerTrace enables OpenCensus tracing of a Go kit HTTP transport server.

func TraceEndpoint

func TraceEndpoint(name string, options ...EndpointOption) endpoint.Middleware

TraceEndpoint returns an Endpoint middleware, tracing a Go kit endpoint. This endpoint tracer should be used in combination with a Go kit Transport tracing middleware, generic OpenCensus transport middleware or custom before and after transport functions as service propagation of SpanContext is not provided in this middleware.

Types

type EndpointOption

type EndpointOption func(*EndpointOptions)

EndpointOption allows for functional options to our OpenCensus endpoint tracing middleware.

func WithEndpointAttributes

func WithEndpointAttributes(attrs ...trace.Attribute) EndpointOption

WithEndpointAttributes sets the default attributes for the spans created by the Endpoint tracer.

func WithEndpointConfig

func WithEndpointConfig(options EndpointOptions) EndpointOption

WithEndpointConfig sets all configuration options at once by use of the EndpointOptions struct.

func WithIgnoreBusinessError

func WithIgnoreBusinessError(val bool) EndpointOption

WithIgnoreBusinessError if set to true will not treat a business error identified through the endpoint.Failer interface as a span error.

type EndpointOptions

type EndpointOptions struct {
	// IgnoreBusinessError if set to true will not treat a business error
	// identified through the endpoint.Failer interface as a span error.
	IgnoreBusinessError bool

	// Attributes holds the default attributes which will be set on span
	// creation by our Endpoint middleware.
	Attributes []trace.Attribute
}

EndpointOptions holds the options for tracing an endpoint

type TracerOption

type TracerOption func(o *TracerOptions)

TracerOption allows for functional options to our OpenCensus tracing middleware.

func IsPublic

func IsPublic(isPublic bool) TracerOption

IsPublic should be set to true for publicly accessible servers and for clients that should not propagate their current trace metadata. On the server side a new trace will always be started regardless of any trace metadata being found in the incoming request. If any trace metadata is found, it will be added as a linked trace instead.

func WithHTTPPropagation

func WithHTTPPropagation(p propagation.HTTPFormat) TracerOption

WithHTTPPropagation sets the propagation handlers for the HTTP transport middlewares. If used on a non HTTP transport this is a noop.

func WithName

func WithName(name string) TracerOption

WithName sets the name for an instrumented transport endpoint. If name is omitted at tracing middleware creation, the method of the transport or transport rpc name is used.

func WithSampler

func WithSampler(sampler trace.Sampler) TracerOption

WithSampler sets the sampler to use by our OpenCensus Tracer.

func WithTracerConfig

func WithTracerConfig(options TracerOptions) TracerOption

WithTracerConfig sets all configuration options at once.

type TracerOptions

type TracerOptions struct {
	Sampler       trace.Sampler
	Name          string
	Public        bool
	HTTPPropagate propagation.HTTPFormat
}

TracerOptions holds configuration for our tracing middlewares

Jump to

Keyboard shortcuts

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