debian-forge-composer/vendor/github.com/aws/smithy-go/tracing/tracing.go
Michael Vogt 409b4f6048 go.mod: update to images@v0.117.0
This commit updates to images v0.117.0 so that the cross-distro.sh
test works again (images removed fedora-39.json in main but the
uses the previous version of images that includes fedora-39 so
there is a mismatch (we should look into if there is a way to
get github.com/osbuild/images@latest instead of main in the
cross-arch test).

It also updates all the vendor stuff that got pulled via the
new images release (which is giantonormous).

This update requires updating the Go version to 1.22.8
2025-02-19 19:19:42 +01:00

95 lines
2.3 KiB
Go

// Package tracing defines tracing APIs to be used by Smithy clients.
package tracing
import (
"context"
"github.com/aws/smithy-go"
)
// SpanStatus records the "success" state of an observed span.
type SpanStatus int
// Enumeration of SpanStatus.
const (
SpanStatusUnset SpanStatus = iota
SpanStatusOK
SpanStatusError
)
// SpanKind indicates the nature of the work being performed.
type SpanKind int
// Enumeration of SpanKind.
const (
SpanKindInternal SpanKind = iota
SpanKindClient
SpanKindServer
SpanKindProducer
SpanKindConsumer
)
// TracerProvider is the entry point for creating client traces.
type TracerProvider interface {
Tracer(scope string, opts ...TracerOption) Tracer
}
// TracerOption applies configuration to a tracer.
type TracerOption func(o *TracerOptions)
// TracerOptions represent configuration for tracers.
type TracerOptions struct {
Properties smithy.Properties
}
// Tracer is the entry point for creating observed client Spans.
//
// Spans created by tracers propagate by existing on the Context. Consumers of
// the API can use [GetSpan] to pull the active Span from a Context.
//
// Creation of child Spans is implicit through Context persistence. If
// CreateSpan is called with a Context that holds a Span, the result will be a
// child of that Span.
type Tracer interface {
StartSpan(ctx context.Context, name string, opts ...SpanOption) (context.Context, Span)
}
// SpanOption applies configuration to a span.
type SpanOption func(o *SpanOptions)
// SpanOptions represent configuration for span events.
type SpanOptions struct {
Kind SpanKind
Properties smithy.Properties
}
// Span records a conceptually individual unit of work that takes place in a
// Smithy client operation.
type Span interface {
Name() string
Context() SpanContext
AddEvent(name string, opts ...EventOption)
SetStatus(status SpanStatus)
SetProperty(k, v any)
End()
}
// EventOption applies configuration to a span event.
type EventOption func(o *EventOptions)
// EventOptions represent configuration for span events.
type EventOptions struct {
Properties smithy.Properties
}
// SpanContext uniquely identifies a Span.
type SpanContext struct {
TraceID string
SpanID string
IsRemote bool
}
// IsValid is true when a span has nonzero trace and span IDs.
func (ctx *SpanContext) IsValid() bool {
return len(ctx.TraceID) != 0 && len(ctx.SpanID) != 0
}