mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to 539be170
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@ -22,7 +22,6 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"go.opentelemetry.io/contrib"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
@ -62,15 +61,23 @@ func parentHook(hook string) string {
|
||||
|
||||
// ClientTraceOption allows customizations to how the httptrace.Client
|
||||
// collects information.
|
||||
type ClientTraceOption func(*clientTracer)
|
||||
type ClientTraceOption interface {
|
||||
apply(*clientTracer)
|
||||
}
|
||||
|
||||
// WithoutSubSpans will modify the httptrace.Client to only collect data
|
||||
type clientTraceOptionFunc func(*clientTracer)
|
||||
|
||||
func (fn clientTraceOptionFunc) apply(c *clientTracer) {
|
||||
fn(c)
|
||||
}
|
||||
|
||||
// WithoutSubSpans will modify the httptrace.ClientTrace to only collect data
|
||||
// as Events and Attributes on a span found in the context. By default
|
||||
// sub-spans will be generated.
|
||||
func WithoutSubSpans() ClientTraceOption {
|
||||
return func(ct *clientTracer) {
|
||||
return clientTraceOptionFunc(func(ct *clientTracer) {
|
||||
ct.useSpans = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithRedactedHeaders will be replaced by fixed '****' values for the header
|
||||
@ -78,19 +85,31 @@ func WithoutSubSpans() ClientTraceOption {
|
||||
// redacted by default: Authorization, WWW-Authenticate, Proxy-Authenticate
|
||||
// Proxy-Authorization, Cookie, Set-Cookie
|
||||
func WithRedactedHeaders(headers ...string) ClientTraceOption {
|
||||
return func(ct *clientTracer) {
|
||||
return clientTraceOptionFunc(func(ct *clientTracer) {
|
||||
for _, header := range headers {
|
||||
ct.redactedHeaders[strings.ToLower(header)] = struct{}{}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithoutHeaders will disable adding span annotations for the http headers
|
||||
// WithoutHeaders will disable adding span attributes for the http headers
|
||||
// and values.
|
||||
func WithoutHeaders() ClientTraceOption {
|
||||
return func(ct *clientTracer) {
|
||||
return clientTraceOptionFunc(func(ct *clientTracer) {
|
||||
ct.addHeaders = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithInsecureHeaders will add span attributes for all http headers *INCLUDING*
|
||||
// the sensitive headers that are redacted by default. The attribute values
|
||||
// will include the raw un-redacted text. This might be useful for
|
||||
// debugging authentication related issues, but should not be used for
|
||||
// production deployments.
|
||||
func WithInsecureHeaders() ClientTraceOption {
|
||||
return clientTraceOptionFunc(func(ct *clientTracer) {
|
||||
ct.addHeaders = true
|
||||
ct.redactedHeaders = nil
|
||||
})
|
||||
}
|
||||
|
||||
type clientTracer struct {
|
||||
@ -106,6 +125,13 @@ type clientTracer struct {
|
||||
useSpans bool
|
||||
}
|
||||
|
||||
// NewClientTrace returns an httptrace.ClientTrace implementation that will
|
||||
// record OpenTelemetry spans for requests made by an http.Client. By default
|
||||
// several spans will be added to the trace for various stages of a request
|
||||
// (dns, connection, tls, etc). Also by default, all HTTP headers will be
|
||||
// added as attributes to spans, although several headers will be automatically
|
||||
// redacted: Authorization, WWW-Authenticate, Proxy-Authenticate,
|
||||
// Proxy-Authorization, Cookie, and Set-Cookie.
|
||||
func NewClientTrace(ctx context.Context, opts ...ClientTraceOption) *httptrace.ClientTrace {
|
||||
ct := &clientTracer{
|
||||
Context: ctx,
|
||||
@ -122,7 +148,7 @@ func NewClientTrace(ctx context.Context, opts ...ClientTraceOption) *httptrace.C
|
||||
useSpans: true,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(ct)
|
||||
opt.apply(ct)
|
||||
}
|
||||
|
||||
var tp trace.TracerProvider
|
||||
@ -134,7 +160,7 @@ func NewClientTrace(ctx context.Context, opts ...ClientTraceOption) *httptrace.C
|
||||
|
||||
ct.tr = tp.Tracer(
|
||||
"go.opentelemetry.io/otel/instrumentation/httptrace",
|
||||
trace.WithInstrumentationVersion(contrib.SemVersion()),
|
||||
trace.WithInstrumentationVersion(SemVersion()),
|
||||
)
|
||||
|
||||
return &httptrace.ClientTrace{
|
||||
|
@ -6,9 +6,6 @@ replace go.opentelemetry.io/contrib => ../../../../..
|
||||
|
||||
require (
|
||||
github.com/google/go-cmp v0.5.6
|
||||
github.com/stretchr/testify v1.7.0
|
||||
go.opentelemetry.io/contrib v0.21.0
|
||||
go.opentelemetry.io/otel v1.0.0-RC1
|
||||
go.opentelemetry.io/otel/oteltest v1.0.0-RC1
|
||||
go.opentelemetry.io/otel/trace v1.0.0-RC1
|
||||
go.opentelemetry.io/otel v1.0.0
|
||||
go.opentelemetry.io/otel/trace v1.0.0
|
||||
)
|
||||
|
@ -7,12 +7,10 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
go.opentelemetry.io/otel v1.0.0-RC1 h1:4CeoX93DNTWt8awGK9JmNXzF9j7TyOu9upscEdtcdXc=
|
||||
go.opentelemetry.io/otel v1.0.0-RC1/go.mod h1:x9tRa9HK4hSSq7jf2TKbqFbtt58/TGk0f9XiEYISI1I=
|
||||
go.opentelemetry.io/otel/oteltest v1.0.0-RC1 h1:G685iP3XiskCwk/z0eIabL55XUl2gk0cljhGk9sB0Yk=
|
||||
go.opentelemetry.io/otel/oteltest v1.0.0-RC1/go.mod h1:+eoIG0gdEOaPNftuy1YScLr1Gb4mL/9lpDkZ0JjMRq4=
|
||||
go.opentelemetry.io/otel/trace v1.0.0-RC1 h1:jrjqKJZEibFrDz+umEASeU3LvdVyWKlnTh7XEfwrT58=
|
||||
go.opentelemetry.io/otel/trace v1.0.0-RC1/go.mod h1:86UHmyHWFEtWjfWPSbu0+d0Pf9Q6e1U+3ViBOc+NXAg=
|
||||
go.opentelemetry.io/otel v1.0.0 h1:qTTn6x71GVBvoafHK/yaRUmFzI4LcONZD0/kXxl5PHI=
|
||||
go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg=
|
||||
go.opentelemetry.io/otel/trace v1.0.0 h1:TSBr8GTEtKevYMG/2d21M989r5WJYVimhTHBKVEZuh4=
|
||||
go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
|
@ -26,9 +26,17 @@ import (
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
// Option is a function that allows configuration of the httptrace Extract()
|
||||
// and Inject() functions
|
||||
type Option func(*config)
|
||||
// Option allows configuration of the httptrace Extract()
|
||||
// and Inject() functions.
|
||||
type Option interface {
|
||||
apply(*config)
|
||||
}
|
||||
|
||||
type optionFunc func(*config)
|
||||
|
||||
func (o optionFunc) apply(c *config) {
|
||||
o(c)
|
||||
}
|
||||
|
||||
type config struct {
|
||||
propagators propagation.TextMapPropagator
|
||||
@ -37,16 +45,18 @@ type config struct {
|
||||
func newConfig(opts []Option) *config {
|
||||
c := &config{propagators: otel.GetTextMapPropagator()}
|
||||
for _, o := range opts {
|
||||
o(c)
|
||||
o.apply(c)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// WithPropagators sets the propagators to use for Extraction and Injection
|
||||
func WithPropagators(props propagation.TextMapPropagator) Option {
|
||||
return func(c *config) {
|
||||
c.propagators = props
|
||||
}
|
||||
return optionFunc(func(c *config) {
|
||||
if props != nil {
|
||||
c.propagators = props
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Extract returns the Attributes, Context Entries, and SpanContext that were encoded by Inject.
|
||||
|
26
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace/version.go
generated
vendored
Normal file
26
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace/version.go
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
// 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 otelhttptrace
|
||||
|
||||
// Version is the current release version of the httptrace instrumentation.
|
||||
func Version() string {
|
||||
return "0.24.0"
|
||||
// This string is updated by the pre_release.sh script during release
|
||||
}
|
||||
|
||||
// SemVersion is the semantic version to be supplied to tracer/meter creation.
|
||||
func SemVersion() string {
|
||||
return "semver:" + Version()
|
||||
}
|
Reference in New Issue
Block a user