mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-25 12:48:04 +08:00
vendor: update buildkit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
2
vendor/go.opentelemetry.io/otel/trace/config.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/trace/config.go
generated
vendored
@@ -124,7 +124,7 @@ func NewSpanEndConfig(options ...SpanEndOption) SpanConfig {
|
||||
}
|
||||
|
||||
// SpanStartOption applies an option to a SpanConfig. These options are applicable
|
||||
// only when the span is created
|
||||
// only when the span is created.
|
||||
type SpanStartOption interface {
|
||||
applySpanStart(SpanConfig) SpanConfig
|
||||
}
|
||||
|
2
vendor/go.opentelemetry.io/otel/trace/doc.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/trace/doc.go
generated
vendored
@@ -17,7 +17,7 @@ Package trace provides an implementation of the tracing part of the
|
||||
OpenTelemetry API.
|
||||
|
||||
To participate in distributed traces a Span needs to be created for the
|
||||
operation being performed as part of a traced workflow. It its simplest form:
|
||||
operation being performed as part of a traced workflow. In its simplest form:
|
||||
|
||||
var tracer trace.Tracer
|
||||
|
||||
|
2
vendor/go.opentelemetry.io/otel/trace/noop.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/trace/noop.go
generated
vendored
@@ -85,5 +85,5 @@ func (noopSpan) AddEvent(string, ...EventOption) {}
|
||||
// SetName does nothing.
|
||||
func (noopSpan) SetName(string) {}
|
||||
|
||||
// TracerProvider returns a no-op TracerProvider
|
||||
// TracerProvider returns a no-op TracerProvider.
|
||||
func (noopSpan) TracerProvider() TracerProvider { return noopTracerProvider{} }
|
||||
|
84
vendor/go.opentelemetry.io/otel/trace/trace.go
generated
vendored
84
vendor/go.opentelemetry.io/otel/trace/trace.go
generated
vendored
@@ -63,7 +63,7 @@ func (t TraceID) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(t.String())
|
||||
}
|
||||
|
||||
// String returns the hex string representation form of a TraceID
|
||||
// String returns the hex string representation form of a TraceID.
|
||||
func (t TraceID) String() string {
|
||||
return hex.EncodeToString(t[:])
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func (s SpanID) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(s.String())
|
||||
}
|
||||
|
||||
// String returns the hex string representation form of a SpanID
|
||||
// String returns the hex string representation form of a SpanID.
|
||||
func (s SpanID) String() string {
|
||||
return hex.EncodeToString(s[:])
|
||||
}
|
||||
@@ -151,7 +151,7 @@ func decodeHex(h string, b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TraceFlags contains flags that can be set on a SpanContext
|
||||
// TraceFlags contains flags that can be set on a SpanContext.
|
||||
type TraceFlags byte //nolint:revive // revive complains about stutter of `trace.TraceFlags`.
|
||||
|
||||
// IsSampled returns if the sampling bit is set in the TraceFlags.
|
||||
@@ -160,7 +160,7 @@ func (tf TraceFlags) IsSampled() bool {
|
||||
}
|
||||
|
||||
// WithSampled sets the sampling bit in a new copy of the TraceFlags.
|
||||
func (tf TraceFlags) WithSampled(sampled bool) TraceFlags {
|
||||
func (tf TraceFlags) WithSampled(sampled bool) TraceFlags { // nolint:revive // sampled is not a control flag.
|
||||
if sampled {
|
||||
return tf | FlagsSampled
|
||||
}
|
||||
@@ -174,7 +174,7 @@ func (tf TraceFlags) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(tf.String())
|
||||
}
|
||||
|
||||
// String returns the hex string representation form of TraceFlags
|
||||
// String returns the hex string representation form of TraceFlags.
|
||||
func (tf TraceFlags) String() string {
|
||||
return hex.EncodeToString([]byte{byte(tf)}[:])
|
||||
}
|
||||
@@ -364,8 +364,9 @@ type Span interface {
|
||||
SpanContext() SpanContext
|
||||
|
||||
// SetStatus sets the status of the Span in the form of a code and a
|
||||
// description, overriding previous values set. The description is only
|
||||
// included in a status when the code is for an error.
|
||||
// description, provided the status hasn't already been set to a higher
|
||||
// value before (OK > Error > Unset). The description is only included in a
|
||||
// status when the code is for an error.
|
||||
SetStatus(code codes.Code, description string)
|
||||
|
||||
// SetName sets the Span name.
|
||||
@@ -386,16 +387,16 @@ type Span interface {
|
||||
//
|
||||
// For example, a Link is used in the following situations:
|
||||
//
|
||||
// 1. Batch Processing: A batch of operations may contain operations
|
||||
// associated with one or more traces/spans. Since there can only be one
|
||||
// parent SpanContext, a Link is used to keep reference to the
|
||||
// SpanContext of all operations in the batch.
|
||||
// 2. Public Endpoint: A SpanContext for an in incoming client request on a
|
||||
// public endpoint should be considered untrusted. In such a case, a new
|
||||
// trace with its own identity and sampling decision needs to be created,
|
||||
// but this new trace needs to be related to the original trace in some
|
||||
// form. A Link is used to keep reference to the original SpanContext and
|
||||
// track the relationship.
|
||||
// 1. Batch Processing: A batch of operations may contain operations
|
||||
// associated with one or more traces/spans. Since there can only be one
|
||||
// parent SpanContext, a Link is used to keep reference to the
|
||||
// SpanContext of all operations in the batch.
|
||||
// 2. Public Endpoint: A SpanContext for an in incoming client request on a
|
||||
// public endpoint should be considered untrusted. In such a case, a new
|
||||
// trace with its own identity and sampling decision needs to be created,
|
||||
// but this new trace needs to be related to the original trace in some
|
||||
// form. A Link is used to keep reference to the original SpanContext and
|
||||
// track the relationship.
|
||||
type Link struct {
|
||||
// SpanContext of the linked Span.
|
||||
SpanContext SpanContext
|
||||
@@ -503,17 +504,48 @@ type Tracer interface {
|
||||
Start(ctx context.Context, spanName string, opts ...SpanStartOption) (context.Context, Span)
|
||||
}
|
||||
|
||||
// TracerProvider provides access to instrumentation Tracers.
|
||||
// TracerProvider provides Tracers that are used by instrumentation code to
|
||||
// trace computational workflows.
|
||||
//
|
||||
// A TracerProvider is the collection destination of all Spans from Tracers it
|
||||
// provides, it represents a unique telemetry collection pipeline. How that
|
||||
// pipeline is defined, meaning how those Spans are collected, processed, and
|
||||
// where they are exported, depends on its implementation. Instrumentation
|
||||
// authors do not need to define this implementation, rather just use the
|
||||
// provided Tracers to instrument code.
|
||||
//
|
||||
// Commonly, instrumentation code will accept a TracerProvider implementation
|
||||
// at runtime from its users or it can simply use the globally registered one
|
||||
// (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider).
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type TracerProvider interface {
|
||||
// Tracer creates an implementation of the Tracer interface.
|
||||
// The instrumentationName must be the name of the library providing
|
||||
// instrumentation. This name may be the same as the instrumented code
|
||||
// only if that code provides built-in instrumentation. If the
|
||||
// instrumentationName is empty, then a implementation defined default
|
||||
// name will be used instead.
|
||||
// Tracer returns a unique Tracer scoped to be used by instrumentation code
|
||||
// to trace computational workflows. The scope and identity of that
|
||||
// instrumentation code is uniquely defined by the name and options passed.
|
||||
//
|
||||
// This method must be concurrency safe.
|
||||
Tracer(instrumentationName string, opts ...TracerOption) Tracer
|
||||
// The passed name needs to uniquely identify instrumentation code.
|
||||
// Therefore, it is recommended that name is the Go package name of the
|
||||
// library providing instrumentation (note: not the code being
|
||||
// instrumented). Instrumentation libraries can have multiple versions,
|
||||
// therefore, the WithInstrumentationVersion option should be used to
|
||||
// distinguish these different codebases. Additionally, instrumentation
|
||||
// libraries may sometimes use traces to communicate different domains of
|
||||
// workflow data (i.e. using spans to communicate workflow events only). If
|
||||
// this is the case, the WithScopeAttributes option should be used to
|
||||
// uniquely identify Tracers that handle the different domains of workflow
|
||||
// data.
|
||||
//
|
||||
// If the same name and options are passed multiple times, the same Tracer
|
||||
// will be returned (it is up to the implementation if this will be the
|
||||
// same underlying instance of that Tracer or not). It is not necessary to
|
||||
// call this multiple times with the same name and options to get an
|
||||
// up-to-date Tracer. All implementations will ensure any TracerProvider
|
||||
// configuration changes are propagated to all provided Tracers.
|
||||
//
|
||||
// If name is empty, then an implementation defined default name will be
|
||||
// used instead.
|
||||
//
|
||||
// This method is safe to call concurrently.
|
||||
Tracer(name string, options ...TracerOption) Tracer
|
||||
}
|
||||
|
29
vendor/go.opentelemetry.io/otel/trace/tracestate.go
generated
vendored
29
vendor/go.opentelemetry.io/otel/trace/tracestate.go
generated
vendored
@@ -21,7 +21,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
const (
|
||||
maxListMembers = 32
|
||||
|
||||
listDelimiter = ","
|
||||
@@ -32,10 +32,6 @@ var (
|
||||
withTenantKeyFormat = `[a-z0-9][_0-9a-z\-\*\/]{0,240}@[a-z][_0-9a-z\-\*\/]{0,13}`
|
||||
valueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]`
|
||||
|
||||
keyRe = regexp.MustCompile(`^((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))$`)
|
||||
valueRe = regexp.MustCompile(`^(` + valueFormat + `)$`)
|
||||
memberRe = regexp.MustCompile(`^\s*((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`)
|
||||
|
||||
errInvalidKey errorConst = "invalid tracestate key"
|
||||
errInvalidValue errorConst = "invalid tracestate value"
|
||||
errInvalidMember errorConst = "invalid tracestate list-member"
|
||||
@@ -43,6 +39,12 @@ var (
|
||||
errDuplicate errorConst = "duplicate list-member in tracestate"
|
||||
)
|
||||
|
||||
var (
|
||||
keyRe = regexp.MustCompile(`^((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))$`)
|
||||
valueRe = regexp.MustCompile(`^(` + valueFormat + `)$`)
|
||||
memberRe = regexp.MustCompile(`^\s*((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`)
|
||||
)
|
||||
|
||||
type member struct {
|
||||
Key string
|
||||
Value string
|
||||
@@ -68,7 +70,6 @@ func parseMember(m string) (member, error) {
|
||||
Key: matches[1],
|
||||
Value: matches[4],
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
// String encodes member into a string compliant with the W3C Trace Context
|
||||
@@ -171,7 +172,8 @@ func (ts TraceState) Get(key string) string {
|
||||
// specification an error is returned with the original TraceState.
|
||||
//
|
||||
// If adding a new list-member means the TraceState would have more members
|
||||
// than is allowed an error is returned instead with the original TraceState.
|
||||
// then is allowed, the new list-member will be inserted and the right-most
|
||||
// list-member will be dropped in the returned TraceState.
|
||||
func (ts TraceState) Insert(key, value string) (TraceState, error) {
|
||||
m, err := newMember(key, value)
|
||||
if err != nil {
|
||||
@@ -179,17 +181,10 @@ func (ts TraceState) Insert(key, value string) (TraceState, error) {
|
||||
}
|
||||
|
||||
cTS := ts.Delete(key)
|
||||
if cTS.Len()+1 > maxListMembers {
|
||||
// TODO (MrAlias): When the second version of the Trace Context
|
||||
// specification is published this needs to not return an error.
|
||||
// Instead it should drop the "right-most" member and insert the new
|
||||
// member at the front.
|
||||
//
|
||||
// https://github.com/w3c/trace-context/pull/448
|
||||
return ts, fmt.Errorf("failed to insert: %w", errMemberNumber)
|
||||
if cTS.Len()+1 <= maxListMembers {
|
||||
cTS.list = append(cTS.list, member{})
|
||||
}
|
||||
|
||||
cTS.list = append(cTS.list, member{})
|
||||
// When the number of members exceeds capacity, drop the "right-most".
|
||||
copy(cTS.list[1:], cTS.list)
|
||||
cTS.list[0] = m
|
||||
|
||||
|
Reference in New Issue
Block a user