package tracing
import "github.com/containerd/containerd/tracing"
Index ¶
- func Attribute(k string, v interface{}) attribute.KeyValue
- func HTTPStatusCodeAttributes(code int) []attribute.KeyValue
- func Name(names ...string) string
- func UpdateHTTPClient(client *http.Client, name string)
- type LogrusHook
- func NewLogrusHook() *LogrusHook
- func (h *LogrusHook) Fire(entry *logrus.Entry) error
- func (h *LogrusHook) Levels() []logrus.Level
- type Span
- func SpanFromContext(ctx context.Context) *Span
- func StartSpan(ctx context.Context, opName string, opts ...SpanOpt) (context.Context, *Span)
- func (s *Span) AddEvent(name string, options ...trace.EventOption)
- func (s *Span) End()
- func (s *Span) SetAttributes(kv ...attribute.KeyValue)
- func (s *Span) SetStatus(err error)
- type SpanOpt
- type StartConfig
Functions ¶
func Attribute ¶
Attribute takes a key value pair and returns attribute.KeyValue type.
func HTTPStatusCodeAttributes ¶
HTTPStatusCodeAttributes generates attributes of the HTTP namespace as specified by the OpenTelemetry specification for a span.
func Name ¶
Name sets the span name by joining a list of strings in dot separated format.
func UpdateHTTPClient ¶
UpdateHTTPClient updates the http client with the necessary otel transport
Types ¶
type LogrusHook ¶
type LogrusHook struct{}
LogrusHook is a logrus hook which adds logrus events to active spans. If the span is not recording or the span context is invalid, the hook is a no-op.
func NewLogrusHook ¶
func NewLogrusHook() *LogrusHook
NewLogrusHook creates a new logrus hook
func (*LogrusHook) Fire ¶
func (h *LogrusHook) Fire(entry *logrus.Entry) error
Fire is called when a log event occurs.
func (*LogrusHook) Levels ¶
func (h *LogrusHook) Levels() []logrus.Level
Levels returns the logrus levels that this hook is interested in.
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span is wrapper around otel trace.Span. Span is the individual component of a trace. It represents a single named and timed operation of a workflow that is traced.
func SpanFromContext ¶
SpanFromContext returns the current Span from the context.
func StartSpan ¶
StartSpan starts child span in a context.
func (*Span) AddEvent ¶
func (s *Span) AddEvent(name string, options ...trace.EventOption)
AddEvent adds an event with provided name and options.
func (*Span) End ¶
func (s *Span) End()
End completes the span.
func (*Span) SetAttributes ¶
SetAttributes sets kv as attributes of the span.
func (*Span) SetStatus ¶
SetStatus sets the status of the current span. If an error is encountered, it records the error and sets span status to Error.
type SpanOpt ¶
type SpanOpt func(config *StartConfig)
func WithHTTPRequest ¶
WithHTTPRequest marks span as a HTTP request operation from client to server. It'll append attributes from the HTTP request object and mark it with `SpanKindClient` type.
Deprecated: use upstream functionality from otelhttp directly instead. This function is kept for API compatibility but no longer works as expected due to required functionality no longer exported in OpenTelemetry libraries.
type StartConfig ¶
type StartConfig struct {
// contains filtered or unexported fields
}
StartConfig defines configuration for a new span object.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
tracing/plugin |
- Version
- v1.7.11
- Published
- Dec 8, 2023
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 10 seconds ago –
Tools for package owners.