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 CoderExporter(ctx context.Context) (*otlptrace.Exporter, error)
- 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¶
funcDefaultExporter¶added inv0.9.0
funcEndHTTPSpan¶added inv0.8.7
EndHTTPSpan captures request and response data after the handler is done.
funcFuncNameSkip¶added inv0.9.0
funcGetTracerName¶added inv0.12.6
GetTracerName returns the tracer name from the context, or TracerName if noneis set.
funcHoneycombExporter¶added inv0.12.0
funcMetadataFromContext¶added inv0.23.2
funcMetadataToContext¶added inv0.23.2
funcMiddleware¶added inv0.9.0
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¶added inv0.13.0
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¶added inv0.12.6
SetTracerName sets the tracer name that will be used by all spans createdfrom the context.
funcStartSpan¶added inv0.9.0
StartSpan calls StartSpanWithName with the name set to the caller's functionname.
funcStartSpanWithName¶added inv0.12.6
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¶added inv0.23.2
typeDRPCHandler¶added inv0.23.2
typeSlogSink¶added inv0.12.6
type SlogSink struct{}
typeStatusWriter¶added inv0.9.0
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¶added inv0.9.0
func (w *StatusWriter) Flush()
func (*StatusWriter)Hijack¶added inv0.9.0
func (w *StatusWriter) Hijack() (net.Conn, *bufio.ReadWriter,error)
func (*StatusWriter)ResponseBody¶added inv0.9.0
func (w *StatusWriter) ResponseBody() []byte
func (*StatusWriter)WriteHeader¶added inv0.9.0
func (w *StatusWriter) WriteHeader(statusint)
typeTracerOpts¶added inv0.9.0
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// Coder exports traces to Coder's public tracing ingest service and is used// to improve the product. It is disabled when opting out of telemetry.Coderbool// Exports traces to Honeycomb.io with the provided API key.Honeycombstring}
TracerOpts specifies which telemetry exporters should be configured.