package opencensus

import "github.com/google/trillian/monitoring/opencensus"

Package opencensus enables tracing and metrics collection using OpenCensus.

Index

Functions

func EnableHTTPServerTracing

func EnableHTTPServerTracing(projectID string, percent int) (http.Handler, error)

EnableHTTPServerTracing turns on Stackdriver tracing for HTTP requests on the default ServeMux. The returned handler must be passed to the HTTP server. The supplied projectID can be nil for GCP but might need to be set for other cloud platforms. Refer to the appropriate documentation. The percentage of traced requests can be set between 0 and 100. Note that 0 does not disable tracing entirely but causes the default configuration to be used.

func EnableRPCServerTracing

func EnableRPCServerTracing(projectID string, percent int) ([]grpc.ServerOption, error)

EnableRPCServerTracing turns on Stackdriver tracing. The returned options must be passed to the GRPC server. The supplied projectID can be nil for GCP but might need to be set for other cloud platforms. Refer to the appropriate documentation. The percentage of traced requests can be set between 0 and 100. Note that 0 does not disable tracing entirely but causes the default configuration to be used.

func StartSpan

func StartSpan(ctx context.Context, name string) (context.Context, func())

StartSpan starts a new tracing span. The returned context should be used for all child calls within the span, and the returned func should be called to close the span.

Source Files

trace.go

Version
v1.7.1 (latest)
Published
Jan 9, 2025
Platform
linux/amd64
Imports
9 packages
Last checked
5 days ago

Tools for package owners.