TraceEndpointDefaultName is the default endpoint span name to use.
const TraceEndpointDefaultName = "gokit/endpoint"
func GRPCClientTrace(options ...TracerOption) kitgrpc.ClientOption
GRPCClientTrace enables OpenCensus tracing of a Go kit gRPC transport client.
func GRPCServerTrace(options ...TracerOption) kitgrpc.ServerOption
GRPCServerTrace enables OpenCensus tracing of a Go kit gRPC transport server.
func HTTPClientTrace(options ...TracerOption) kithttp.ClientOption
HTTPClientTrace enables OpenCensus tracing of a Go kit HTTP transport client.
func HTTPServerTrace(options ...TracerOption) kithttp.ServerOption
HTTPServerTrace enables OpenCensus tracing of a Go kit HTTP transport server.
func JSONRPCClientTrace(options ...TracerOption) jsonrpc.ClientOption
JSONRPCClientTrace enables OpenCensus tracing of a Go kit JSONRPC transport client.
func JSONRPCServerTrace(options ...TracerOption) jsonrpc.ServerOption
JSONRPCServerTrace enables OpenCensus tracing of a Go kit JSONRPC transport server.
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.
EndpointOption allows for functional options to our OpenCensus endpoint tracing middleware.
type EndpointOption func(*EndpointOptions)
func WithEndpointAttributes(attrs ...trace.Attribute) EndpointOption
WithEndpointAttributes sets the default attributes for the spans created by the Endpoint tracer.
func WithEndpointConfig(options EndpointOptions) EndpointOption
WithEndpointConfig sets all configuration options at once by use of the EndpointOptions struct.
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.
func WithSpanAttributes(fn func(ctx context.Context) []trace.Attribute) EndpointOption
WithSpanAttributes extracts additional attributes from the request context.
func WithSpanName(fn func(ctx context.Context, name string) string) EndpointOption
WithSpanName extracts additional attributes from the request context.
EndpointOptions holds the options for tracing an endpoint
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 // GetName is an optional function that can set the span name based on the existing name // for the endpoint and information in the context. // // If the function is nil, or the returned name is empty, the existing name for the endpoint is used. GetName func(ctx context.Context, name string) string // GetAttributes is an optional function that can extract trace attributes // from the context and add them to the span. GetAttributes func(ctx context.Context) []trace.Attribute }
TracerOption allows for functional options to our OpenCensus tracing middleware.
type TracerOption func(o *TracerOptions)
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(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(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(sampler trace.Sampler) TracerOption
WithSampler sets the sampler to use by our OpenCensus Tracer.
func WithTracerConfig(options TracerOptions) TracerOption
WithTracerConfig sets all configuration options at once.
TracerOptions holds configuration for our tracing middlewares
type TracerOptions struct { Sampler trace.Sampler Name string Public bool HTTPPropagate propagation.HTTPFormat }