Vendor Update (#16121)
* update github.com/PuerkitoBio/goquery * update github.com/alecthomas/chroma * update github.com/blevesearch/bleve/v2 * update github.com/caddyserver/certmagic * update github.com/go-enry/go-enry/v2 * update github.com/go-git/go-billy/v5 * update github.com/go-git/go-git/v5 * update github.com/go-redis/redis/v8 * update github.com/go-testfixtures/testfixtures/v3 * update github.com/jaytaylor/html2text * update github.com/json-iterator/go * update github.com/klauspost/compress * update github.com/markbates/goth * update github.com/mattn/go-isatty * update github.com/mholt/archiver/v3 * update github.com/microcosm-cc/bluemonday * update github.com/minio/minio-go/v7 * update github.com/prometheus/client_golang * update github.com/unrolled/render * update github.com/xanzy/go-gitlab * update github.com/yuin/goldmark * update github.com/yuin/goldmark-highlighting Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
61
vendor/go.opentelemetry.io/otel/trace/context.go
generated
vendored
Normal file
61
vendor/go.opentelemetry.io/otel/trace/context.go
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/trace"
|
||||
|
||||
import "context"
|
||||
|
||||
type traceContextKeyType int
|
||||
|
||||
const currentSpanKey traceContextKeyType = iota
|
||||
|
||||
// ContextWithSpan returns a copy of parent with span set as the current Span.
|
||||
func ContextWithSpan(parent context.Context, span Span) context.Context {
|
||||
return context.WithValue(parent, currentSpanKey, span)
|
||||
}
|
||||
|
||||
// ContextWithSpanContext returns a copy of parent with sc as the current
|
||||
// Span. The Span implementation that wraps sc is non-recording and performs
|
||||
// no operations other than to return sc as the SpanContext from the
|
||||
// SpanContext method.
|
||||
func ContextWithSpanContext(parent context.Context, sc SpanContext) context.Context {
|
||||
return ContextWithSpan(parent, nonRecordingSpan{sc: sc})
|
||||
}
|
||||
|
||||
// ContextWithRemoteSpanContext returns a copy of parent with rsc set explicly
|
||||
// as a remote SpanContext and as the current Span. The Span implementation
|
||||
// that wraps rsc is non-recording and performs no operations other than to
|
||||
// return rsc as the SpanContext from the SpanContext method.
|
||||
func ContextWithRemoteSpanContext(parent context.Context, rsc SpanContext) context.Context {
|
||||
return ContextWithSpanContext(parent, rsc.WithRemote(true))
|
||||
}
|
||||
|
||||
// SpanFromContext returns the current Span from ctx.
|
||||
//
|
||||
// If no Span is currently set in ctx an implementation of a Span that
|
||||
// performs no operations is returned.
|
||||
func SpanFromContext(ctx context.Context) Span {
|
||||
if ctx == nil {
|
||||
return noopSpan{}
|
||||
}
|
||||
if span, ok := ctx.Value(currentSpanKey).(Span); ok {
|
||||
return span
|
||||
}
|
||||
return noopSpan{}
|
||||
}
|
||||
|
||||
// SpanContextFromContext returns the current Span's SpanContext.
|
||||
func SpanContextFromContext(ctx context.Context) SpanContext {
|
||||
return SpanFromContext(ctx).SpanContext()
|
||||
}
|
||||
2
vendor/go.opentelemetry.io/otel/trace/go.mod
generated
vendored
2
vendor/go.opentelemetry.io/otel/trace/go.mod
generated
vendored
@@ -49,5 +49,5 @@ replace go.opentelemetry.io/otel/trace => ./
|
||||
require (
|
||||
github.com/google/go-cmp v0.5.5
|
||||
github.com/stretchr/testify v1.7.0
|
||||
go.opentelemetry.io/otel v0.19.0
|
||||
go.opentelemetry.io/otel v0.20.0
|
||||
)
|
||||
|
||||
27
vendor/go.opentelemetry.io/otel/trace/nonrecording.go
generated
vendored
Normal file
27
vendor/go.opentelemetry.io/otel/trace/nonrecording.go
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package trace // import "go.opentelemetry.io/otel/trace"
|
||||
|
||||
// nonRecordingSpan is a minimal implementation of a Span that wraps a
|
||||
// SpanContext. It performs no operations other than to return the wrapped
|
||||
// SpanContext.
|
||||
type nonRecordingSpan struct {
|
||||
noopSpan
|
||||
|
||||
sc SpanContext
|
||||
}
|
||||
|
||||
// SpanContext returns the wrapped SpanContext.
|
||||
func (s nonRecordingSpan) SpanContext() SpanContext { return s.sc }
|
||||
2
vendor/go.opentelemetry.io/otel/trace/noop.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/trace/noop.go
generated
vendored
@@ -51,7 +51,7 @@ func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanOption) (co
|
||||
// noopSpan is an implementation of Span that preforms no operations.
|
||||
type noopSpan struct{}
|
||||
|
||||
var _ noopSpan = noopSpan{}
|
||||
var _ Span = noopSpan{}
|
||||
|
||||
// SpanContext returns an empty span context.
|
||||
func (noopSpan) SpanContext() SpanContext { return SpanContext{} }
|
||||
|
||||
122
vendor/go.opentelemetry.io/otel/trace/trace.go
generated
vendored
122
vendor/go.opentelemetry.io/otel/trace/trace.go
generated
vendored
@@ -30,13 +30,7 @@ import (
|
||||
const (
|
||||
// FlagsSampled is a bitmask with the sampled bit set. A SpanContext
|
||||
// with the sampling bit set means the span is sampled.
|
||||
FlagsSampled = byte(0x01)
|
||||
// FlagsDeferred is a bitmask with the deferred bit set. A SpanContext
|
||||
// with the deferred bit set means the sampling decision has been
|
||||
// defered to the receiver.
|
||||
FlagsDeferred = byte(0x02)
|
||||
// FlagsDebug is a bitmask with the debug bit set.
|
||||
FlagsDebug = byte(0x04)
|
||||
FlagsSampled = TraceFlags(0x01)
|
||||
|
||||
errInvalidHexID errorConst = "trace-id and span-id can only contain [0-9a-f] characters, all lowercase"
|
||||
|
||||
@@ -319,12 +313,40 @@ func isTraceStateKeyValueValid(kv attribute.KeyValue) bool {
|
||||
valueFormatRegExp.MatchString(kv.Value.Emit())
|
||||
}
|
||||
|
||||
// TraceFlags contains flags that can be set on a SpanContext
|
||||
type TraceFlags byte //nolint:golint
|
||||
|
||||
// IsSampled returns if the sampling bit is set in the TraceFlags.
|
||||
func (tf TraceFlags) IsSampled() bool {
|
||||
return tf&FlagsSampled == FlagsSampled
|
||||
}
|
||||
|
||||
// WithSampled sets the sampling bit in a new copy of the TraceFlags.
|
||||
func (tf TraceFlags) WithSampled(sampled bool) TraceFlags {
|
||||
if sampled {
|
||||
return tf | FlagsSampled
|
||||
}
|
||||
|
||||
return tf &^ FlagsSampled
|
||||
}
|
||||
|
||||
// MarshalJSON implements a custom marshal function to encode TraceFlags
|
||||
// as a hex string.
|
||||
func (tf TraceFlags) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(tf.String())
|
||||
}
|
||||
|
||||
// String returns the hex string representation form of TraceFlags
|
||||
func (tf TraceFlags) String() string {
|
||||
return hex.EncodeToString([]byte{byte(tf)}[:])
|
||||
}
|
||||
|
||||
// SpanContextConfig contains mutable fields usable for constructing
|
||||
// an immutable SpanContext.
|
||||
type SpanContextConfig struct {
|
||||
TraceID TraceID
|
||||
SpanID SpanID
|
||||
TraceFlags byte
|
||||
TraceFlags TraceFlags
|
||||
TraceState TraceState
|
||||
Remote bool
|
||||
}
|
||||
@@ -345,7 +367,7 @@ func NewSpanContext(config SpanContextConfig) SpanContext {
|
||||
type SpanContext struct {
|
||||
traceID TraceID
|
||||
spanID SpanID
|
||||
traceFlags byte
|
||||
traceFlags TraceFlags
|
||||
traceState TraceState
|
||||
remote bool
|
||||
}
|
||||
@@ -415,12 +437,17 @@ func (sc SpanContext) WithSpanID(spanID SpanID) SpanContext {
|
||||
}
|
||||
|
||||
// TraceFlags returns the flags from the SpanContext.
|
||||
func (sc SpanContext) TraceFlags() byte {
|
||||
func (sc SpanContext) TraceFlags() TraceFlags {
|
||||
return sc.traceFlags
|
||||
}
|
||||
|
||||
// IsSampled returns if the sampling bit is set in the SpanContext's TraceFlags.
|
||||
func (sc SpanContext) IsSampled() bool {
|
||||
return sc.traceFlags.IsSampled()
|
||||
}
|
||||
|
||||
// WithTraceFlags returns a new SpanContext with the TraceFlags replaced.
|
||||
func (sc SpanContext) WithTraceFlags(flags byte) SpanContext {
|
||||
func (sc SpanContext) WithTraceFlags(flags TraceFlags) SpanContext {
|
||||
return SpanContext{
|
||||
traceID: sc.traceID,
|
||||
spanID: sc.spanID,
|
||||
@@ -430,21 +457,6 @@ func (sc SpanContext) WithTraceFlags(flags byte) SpanContext {
|
||||
}
|
||||
}
|
||||
|
||||
// IsDeferred returns if the deferred bit is set in the trace flags.
|
||||
func (sc SpanContext) IsDeferred() bool {
|
||||
return sc.traceFlags&FlagsDeferred == FlagsDeferred
|
||||
}
|
||||
|
||||
// IsDebug returns if the debug bit is set in the trace flags.
|
||||
func (sc SpanContext) IsDebug() bool {
|
||||
return sc.traceFlags&FlagsDebug == FlagsDebug
|
||||
}
|
||||
|
||||
// IsSampled returns if the sampling bit is set in the trace flags.
|
||||
func (sc SpanContext) IsSampled() bool {
|
||||
return sc.traceFlags&FlagsSampled == FlagsSampled
|
||||
}
|
||||
|
||||
// TraceState returns the TraceState from the SpanContext.
|
||||
func (sc SpanContext) TraceState() TraceState {
|
||||
return sc.traceState
|
||||
@@ -481,48 +493,6 @@ func (sc SpanContext) MarshalJSON() ([]byte, error) {
|
||||
})
|
||||
}
|
||||
|
||||
type traceContextKeyType int
|
||||
|
||||
const (
|
||||
currentSpanKey traceContextKeyType = iota
|
||||
remoteContextKey
|
||||
)
|
||||
|
||||
// ContextWithSpan returns a copy of parent with span set to current.
|
||||
func ContextWithSpan(parent context.Context, span Span) context.Context {
|
||||
return context.WithValue(parent, currentSpanKey, span)
|
||||
}
|
||||
|
||||
// SpanFromContext returns the current span from ctx, or noop span if none set.
|
||||
func SpanFromContext(ctx context.Context) Span {
|
||||
if span, ok := ctx.Value(currentSpanKey).(Span); ok {
|
||||
return span
|
||||
}
|
||||
return noopSpan{}
|
||||
}
|
||||
|
||||
// SpanContextFromContext returns the current SpanContext from ctx, or an empty SpanContext if none set.
|
||||
func SpanContextFromContext(ctx context.Context) SpanContext {
|
||||
if span := SpanFromContext(ctx); span != nil {
|
||||
return span.SpanContext()
|
||||
}
|
||||
return SpanContext{}
|
||||
}
|
||||
|
||||
// ContextWithRemoteSpanContext returns a copy of parent with a remote set as
|
||||
// the remote span context.
|
||||
func ContextWithRemoteSpanContext(parent context.Context, remote SpanContext) context.Context {
|
||||
return context.WithValue(parent, remoteContextKey, remote.WithRemote(true))
|
||||
}
|
||||
|
||||
// RemoteSpanContextFromContext returns the remote span context from ctx.
|
||||
func RemoteSpanContextFromContext(ctx context.Context) SpanContext {
|
||||
if sc, ok := ctx.Value(remoteContextKey).(SpanContext); ok {
|
||||
return sc
|
||||
}
|
||||
return SpanContext{}
|
||||
}
|
||||
|
||||
// Span is the individual component of a trace. It represents a single named
|
||||
// and timed operation of a workflow that is traced. A Tracer is used to
|
||||
// create a Span and it is then up to the operation the Span represents to
|
||||
@@ -545,7 +515,10 @@ type Span interface {
|
||||
// true if the Span is active and events can be recorded.
|
||||
IsRecording() bool
|
||||
|
||||
// RecordError records an error as a Span event.
|
||||
// RecordError will record err as an exception span event for this span. An
|
||||
// additional call toSetStatus is required if the Status of the Span should
|
||||
// be set to Error, this method does not change the Span status. If this
|
||||
// span is not being recorded or err is nil than this method does nothing.
|
||||
RecordError(err error, options ...EventOption)
|
||||
|
||||
// SpanContext returns the SpanContext of the Span. The returned
|
||||
@@ -574,6 +547,10 @@ type Event struct {
|
||||
// Attributes describe the aspects of the event.
|
||||
Attributes []attribute.KeyValue
|
||||
|
||||
// DroppedAttributeCount is the number of attributes that were not
|
||||
// recorded due to configured limits being reached.
|
||||
DroppedAttributeCount int
|
||||
|
||||
// Time at which this event was recorded.
|
||||
Time time.Time
|
||||
}
|
||||
@@ -594,8 +571,15 @@ type Event struct {
|
||||
// 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
|
||||
|
||||
// Attributes describe the aspects of the link.
|
||||
Attributes []attribute.KeyValue
|
||||
|
||||
// DroppedAttributeCount is the number of attributes that were not
|
||||
// recorded due to configured limits being reached.
|
||||
DroppedAttributeCount int
|
||||
}
|
||||
|
||||
// SpanKind is the role a Span plays in a Trace.
|
||||
|
||||
Reference in New Issue
Block a user