tracing
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Constants
- Variables
- func DefaultExporter(ctx context.Context) (*otlptrace.Exporter, error)
- func EndHTTPSpan(r *http.Request, status int, span trace.Span)
- func FuncName() string
- func FuncNameSkip(skip int) string
- func GetTracerName(ctx context.Context) string
- func HoneycombExporter(ctx context.Context, apiKey string) (*otlptrace.Exporter, error)
- func MetadataFromContext(ctx context.Context) map[string]string
- func MetadataToContext(ctx context.Context, metadata map[string]string) context.Context
- func Middleware(tracerProvider trace.TracerProvider) func(http.Handler) http.Handler
- func PostgresDriver(tp trace.TracerProvider, service string) (string, error)
- func RunWithoutSpan(ctx context.Context, fn func(ctx context.Context))
- func SetTracerName(ctx context.Context, tracerName string) context.Context
- func StartSpan(ctx context.Context, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func StartSpanWithName(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func StatusWriterMiddleware(next http.Handler) http.Handler
- func TracerProvider(ctx context.Context, service string, opts TracerOpts) (*sdktrace.TracerProvider, func(context.Context) error, error)
- type DRPCConn
- type DRPCHandler
- type SlogSink
- type StatusWriter
- type TracerOpts
Constants¶
const TracerName = "coderd"
Variables¶
var NoopSpantrace.Span
Functions¶
funcEndHTTPSpan¶
EndHTTPSpan captures request and response data after the handler is done.
funcFuncNameSkip¶
funcGetTracerName¶
GetTracerName returns the tracer name from the context, or TracerName if noneis set.
funcMiddleware¶
Middleware adds tracing to http routes.
funcPostgresDriver¶
func PostgresDriver(tptrace.TracerProvider, servicestring) (string,error)
Postgres driver will register a new tracing sql driver and return the driver name.
funcRunWithoutSpan¶
RunWithoutSpan runs the given function with the span stripped from thecontext and replaced with a no-op span. This is useful for avoiding logsbeing added to span (to save money).
funcSetTracerName¶
SetTracerName sets the tracer name that will be used by all spans createdfrom the context.
funcStartSpanWithName¶
func StartSpanWithName(ctxcontext.Context, namestring, opts ...trace.SpanStartOption) (context.Context,trace.Span)
StartSpanWithName starts a new span with the given name from the context. Ifa tracer name was set on the context (or one of its parents), it will be usedas the tracer name instead of the default TracerName.
funcTracerProvider¶
func TracerProvider(ctxcontext.Context, servicestring, optsTracerOpts) (*sdktrace.TracerProvider, func(context.Context)error,error)
TracerProvider creates a grpc otlp exporter and configures a trace provider.Caller is responsible for calling TracerProvider.Shutdown to ensure all data is flushed.
Types¶
typeDRPCConn¶
typeDRPCHandler¶
typeSlogSink¶
type SlogSink struct{}
typeStatusWriter¶
type StatusWriter struct {http.ResponseWriterStatusintHijackedbool// contains filtered or unexported fields}
StatusWriter intercepts the status of the request and the response body upto maxBodySize if Status >= 400. It is guaranteed to be the ResponseWriterdirectly downstream from Middleware.
func (*StatusWriter)Flush¶
func (w *StatusWriter) Flush()
func (*StatusWriter)Hijack¶
func (w *StatusWriter) Hijack() (net.Conn, *bufio.ReadWriter,error)
func (*StatusWriter)ResponseBody¶
func (w *StatusWriter) ResponseBody() []byte
func (*StatusWriter)WriteHeader¶
func (w *StatusWriter) WriteHeader(statusint)
typeTracerOpts¶
type TracerOpts struct {// Default exports to a backend configured by environment variables. See://https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.mdDefaultbool// DataDog exports traces and profiles to the local DataDog daemon.DataDogbool// Exports traces to Honeycomb.io with the provided API key.Honeycombstring}
TracerOpts specifies which telemetry exporters should be configured.