kit: Index | Files

package opencensus

import ""

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.


Package Files

doc.go endpoint.go endpoint_options.go grpc.go http.go tracer_options.go


const TraceEndpointDefaultName = "gokit/endpoint"

TraceEndpointDefaultName is the default endpoint span name to use.

func GRPCClientTrace Uses

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

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

func GRPCServerTrace Uses

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

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

func HTTPClientTrace Uses

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

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

func HTTPServerTrace Uses

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

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

func TraceEndpoint Uses

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.

type EndpointOption Uses

type EndpointOption func(*EndpointOptions)

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

func WithEndpointAttributes Uses

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

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

func WithEndpointConfig Uses

func WithEndpointConfig(options EndpointOptions) EndpointOption

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

func WithIgnoreBusinessError Uses

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 Uses

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 Uses

type TracerOption func(o *TracerOptions)

TracerOption allows for functional options to our OpenCensus tracing middleware.

func IsPublic Uses

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 Uses

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 Uses

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 Uses

func WithSampler(sampler trace.Sampler) TracerOption

WithSampler sets the sampler to use by our OpenCensus Tracer.

func WithTracerConfig Uses

func WithTracerConfig(options TracerOptions) TracerOption

WithTracerConfig sets all configuration options at once.

type TracerOptions Uses

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

TracerOptions holds configuration for our tracing middlewares

Package opencensus imports 14 packages (graph) and is imported by 6 packages. Updated 2019-01-27. Refresh now. Tools for package owners.