[VOL-5486] Fix deprecated versions
Change-Id: I3e03ea246020547ae75fa92ce8cf5cbba7e8f3bb
Signed-off-by: Abhay Kumar <abhay.kumar@radisys.com>
diff --git a/vendor/go.opentelemetry.io/otel/propagation/README.md b/vendor/go.opentelemetry.io/otel/propagation/README.md
new file mode 100644
index 0000000..e2959ac
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/propagation/README.md
@@ -0,0 +1,3 @@
+# Propagation
+
+[](https://pkg.go.dev/go.opentelemetry.io/otel/propagation)
diff --git a/vendor/go.opentelemetry.io/otel/propagation/baggage.go b/vendor/go.opentelemetry.io/otel/propagation/baggage.go
new file mode 100644
index 0000000..ebda502
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/propagation/baggage.go
@@ -0,0 +1,77 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+package propagation // import "go.opentelemetry.io/otel/propagation"
+
+import (
+ "context"
+
+ "go.opentelemetry.io/otel/baggage"
+)
+
+const baggageHeader = "baggage"
+
+// Baggage is a propagator that supports the W3C Baggage format.
+//
+// This propagates user-defined baggage associated with a trace. The complete
+// specification is defined at https://www.w3.org/TR/baggage/.
+type Baggage struct{}
+
+var _ TextMapPropagator = Baggage{}
+
+// Inject sets baggage key-values from ctx into the carrier.
+func (b Baggage) Inject(ctx context.Context, carrier TextMapCarrier) {
+ bStr := baggage.FromContext(ctx).String()
+ if bStr != "" {
+ carrier.Set(baggageHeader, bStr)
+ }
+}
+
+// Extract returns a copy of parent with the baggage from the carrier added.
+// If carrier implements [ValuesGetter] (e.g. [HeaderCarrier]), Values is invoked
+// for multiple values extraction. Otherwise, Get is called.
+func (b Baggage) Extract(parent context.Context, carrier TextMapCarrier) context.Context {
+ if multiCarrier, ok := carrier.(ValuesGetter); ok {
+ return extractMultiBaggage(parent, multiCarrier)
+ }
+ return extractSingleBaggage(parent, carrier)
+}
+
+// Fields returns the keys who's values are set with Inject.
+func (b Baggage) Fields() []string {
+ return []string{baggageHeader}
+}
+
+func extractSingleBaggage(parent context.Context, carrier TextMapCarrier) context.Context {
+ bStr := carrier.Get(baggageHeader)
+ if bStr == "" {
+ return parent
+ }
+
+ bag, err := baggage.Parse(bStr)
+ if err != nil {
+ return parent
+ }
+ return baggage.ContextWithBaggage(parent, bag)
+}
+
+func extractMultiBaggage(parent context.Context, carrier ValuesGetter) context.Context {
+ bVals := carrier.Values(baggageHeader)
+ if len(bVals) == 0 {
+ return parent
+ }
+ var members []baggage.Member
+ for _, bStr := range bVals {
+ currBag, err := baggage.Parse(bStr)
+ if err != nil {
+ continue
+ }
+ members = append(members, currBag.Members()...)
+ }
+
+ b, err := baggage.New(members...)
+ if err != nil || b.Len() == 0 {
+ return parent
+ }
+ return baggage.ContextWithBaggage(parent, b)
+}
diff --git a/vendor/go.opentelemetry.io/otel/propagation/doc.go b/vendor/go.opentelemetry.io/otel/propagation/doc.go
new file mode 100644
index 0000000..33a3baf
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/propagation/doc.go
@@ -0,0 +1,13 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+/*
+Package propagation contains OpenTelemetry context propagators.
+
+OpenTelemetry propagators are used to extract and inject context data from and
+into messages exchanged by applications. The propagator supported by this
+package is the W3C Trace Context encoding
+(https://www.w3.org/TR/trace-context/), and W3C Baggage
+(https://www.w3.org/TR/baggage/).
+*/
+package propagation // import "go.opentelemetry.io/otel/propagation"
diff --git a/vendor/go.opentelemetry.io/otel/propagation/propagation.go b/vendor/go.opentelemetry.io/otel/propagation/propagation.go
new file mode 100644
index 0000000..5c8c26e
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/propagation/propagation.go
@@ -0,0 +1,168 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+package propagation // import "go.opentelemetry.io/otel/propagation"
+
+import (
+ "context"
+ "net/http"
+)
+
+// TextMapCarrier is the storage medium used by a TextMapPropagator.
+// See ValuesGetter for how a TextMapCarrier can get multiple values for a key.
+type TextMapCarrier interface {
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+
+ // Get returns the value associated with the passed key.
+ Get(key string) string
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+
+ // Set stores the key-value pair.
+ Set(key string, value string)
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+
+ // Keys lists the keys stored in this carrier.
+ Keys() []string
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+}
+
+// ValuesGetter can return multiple values for a single key,
+// with contrast to TextMapCarrier.Get which returns a single value.
+type ValuesGetter interface {
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+
+ // Values returns all values associated with the passed key.
+ Values(key string) []string
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+}
+
+// MapCarrier is a TextMapCarrier that uses a map held in memory as a storage
+// medium for propagated key-value pairs.
+type MapCarrier map[string]string
+
+// Compile time check that MapCarrier implements the TextMapCarrier.
+var _ TextMapCarrier = MapCarrier{}
+
+// Get returns the value associated with the passed key.
+func (c MapCarrier) Get(key string) string {
+ return c[key]
+}
+
+// Set stores the key-value pair.
+func (c MapCarrier) Set(key, value string) {
+ c[key] = value
+}
+
+// Keys lists the keys stored in this carrier.
+func (c MapCarrier) Keys() []string {
+ keys := make([]string, 0, len(c))
+ for k := range c {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+// HeaderCarrier adapts http.Header to satisfy the TextMapCarrier and ValuesGetter interfaces.
+type HeaderCarrier http.Header
+
+// Compile time check that HeaderCarrier implements ValuesGetter.
+var _ TextMapCarrier = HeaderCarrier{}
+
+// Compile time check that HeaderCarrier implements TextMapCarrier.
+var _ ValuesGetter = HeaderCarrier{}
+
+// Get returns the first value associated with the passed key.
+func (hc HeaderCarrier) Get(key string) string {
+ return http.Header(hc).Get(key)
+}
+
+// Values returns all values associated with the passed key.
+func (hc HeaderCarrier) Values(key string) []string {
+ return http.Header(hc).Values(key)
+}
+
+// Set stores the key-value pair.
+func (hc HeaderCarrier) Set(key string, value string) {
+ http.Header(hc).Set(key, value)
+}
+
+// Keys lists the keys stored in this carrier.
+func (hc HeaderCarrier) Keys() []string {
+ keys := make([]string, 0, len(hc))
+ for k := range hc {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+// TextMapPropagator propagates cross-cutting concerns as key-value text
+// pairs within a carrier that travels in-band across process boundaries.
+type TextMapPropagator interface {
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+
+ // Inject set cross-cutting concerns from the Context into the carrier.
+ Inject(ctx context.Context, carrier TextMapCarrier)
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+
+ // Extract reads cross-cutting concerns from the carrier into a Context.
+ // Implementations may check if the carrier implements ValuesGetter,
+ // to support extraction of multiple values per key.
+ Extract(ctx context.Context, carrier TextMapCarrier) context.Context
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+
+ // Fields returns the keys whose values are set with Inject.
+ Fields() []string
+ // DO NOT CHANGE: any modification will not be backwards compatible and
+ // must never be done outside of a new major release.
+}
+
+type compositeTextMapPropagator []TextMapPropagator
+
+func (p compositeTextMapPropagator) Inject(ctx context.Context, carrier TextMapCarrier) {
+ for _, i := range p {
+ i.Inject(ctx, carrier)
+ }
+}
+
+func (p compositeTextMapPropagator) Extract(ctx context.Context, carrier TextMapCarrier) context.Context {
+ for _, i := range p {
+ ctx = i.Extract(ctx, carrier)
+ }
+ return ctx
+}
+
+func (p compositeTextMapPropagator) Fields() []string {
+ unique := make(map[string]struct{})
+ for _, i := range p {
+ for _, k := range i.Fields() {
+ unique[k] = struct{}{}
+ }
+ }
+
+ fields := make([]string, 0, len(unique))
+ for k := range unique {
+ fields = append(fields, k)
+ }
+ return fields
+}
+
+// NewCompositeTextMapPropagator returns a unified TextMapPropagator from the
+// group of passed TextMapPropagator. This allows different cross-cutting
+// concerns to be propagates in a unified manner.
+//
+// The returned TextMapPropagator will inject and extract cross-cutting
+// concerns in the order the TextMapPropagators were provided. Additionally,
+// the Fields method will return a de-duplicated slice of the keys that are
+// set with the Inject method.
+func NewCompositeTextMapPropagator(p ...TextMapPropagator) TextMapPropagator {
+ return compositeTextMapPropagator(p)
+}
diff --git a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go
new file mode 100644
index 0000000..6870e31
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go
@@ -0,0 +1,156 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+package propagation // import "go.opentelemetry.io/otel/propagation"
+
+import (
+ "context"
+ "encoding/hex"
+ "fmt"
+ "strings"
+
+ "go.opentelemetry.io/otel/trace"
+)
+
+const (
+ supportedVersion = 0
+ maxVersion = 254
+ traceparentHeader = "traceparent"
+ tracestateHeader = "tracestate"
+ delimiter = "-"
+)
+
+// TraceContext is a propagator that supports the W3C Trace Context format
+// (https://www.w3.org/TR/trace-context/)
+//
+// This propagator will propagate the traceparent and tracestate headers to
+// guarantee traces are not broken. It is up to the users of this propagator
+// to choose if they want to participate in a trace by modifying the
+// traceparent header and relevant parts of the tracestate header containing
+// their proprietary information.
+type TraceContext struct{}
+
+var (
+ _ TextMapPropagator = TraceContext{}
+ versionPart = fmt.Sprintf("%.2X", supportedVersion)
+)
+
+// Inject injects the trace context from ctx into carrier.
+func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {
+ sc := trace.SpanContextFromContext(ctx)
+ if !sc.IsValid() {
+ return
+ }
+
+ if ts := sc.TraceState().String(); ts != "" {
+ carrier.Set(tracestateHeader, ts)
+ }
+
+ // Clear all flags other than the trace-context supported sampling bit.
+ flags := sc.TraceFlags() & trace.FlagsSampled
+
+ var sb strings.Builder
+ sb.Grow(2 + 32 + 16 + 2 + 3)
+ _, _ = sb.WriteString(versionPart)
+ traceID := sc.TraceID()
+ spanID := sc.SpanID()
+ flagByte := [1]byte{byte(flags)}
+ var buf [32]byte
+ for _, src := range [][]byte{traceID[:], spanID[:], flagByte[:]} {
+ _ = sb.WriteByte(delimiter[0])
+ n := hex.Encode(buf[:], src)
+ _, _ = sb.Write(buf[:n])
+ }
+ carrier.Set(traceparentHeader, sb.String())
+}
+
+// Extract reads tracecontext from the carrier into a returned Context.
+//
+// The returned Context will be a copy of ctx and contain the extracted
+// tracecontext as the remote SpanContext. If the extracted tracecontext is
+// invalid, the passed ctx will be returned directly instead.
+func (tc TraceContext) Extract(ctx context.Context, carrier TextMapCarrier) context.Context {
+ sc := tc.extract(carrier)
+ if !sc.IsValid() {
+ return ctx
+ }
+ return trace.ContextWithRemoteSpanContext(ctx, sc)
+}
+
+func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
+ h := carrier.Get(traceparentHeader)
+ if h == "" {
+ return trace.SpanContext{}
+ }
+
+ var ver [1]byte
+ if !extractPart(ver[:], &h, 2) {
+ return trace.SpanContext{}
+ }
+ version := int(ver[0])
+ if version > maxVersion {
+ return trace.SpanContext{}
+ }
+
+ var scc trace.SpanContextConfig
+ if !extractPart(scc.TraceID[:], &h, 32) {
+ return trace.SpanContext{}
+ }
+ if !extractPart(scc.SpanID[:], &h, 16) {
+ return trace.SpanContext{}
+ }
+
+ var opts [1]byte
+ if !extractPart(opts[:], &h, 2) {
+ return trace.SpanContext{}
+ }
+ if version == 0 && (h != "" || opts[0] > 2) {
+ // version 0 not allow extra
+ // version 0 not allow other flag
+ return trace.SpanContext{}
+ }
+
+ // Clear all flags other than the trace-context supported sampling bit.
+ scc.TraceFlags = trace.TraceFlags(opts[0]) & trace.FlagsSampled
+
+ // Ignore the error returned here. Failure to parse tracestate MUST NOT
+ // affect the parsing of traceparent according to the W3C tracecontext
+ // specification.
+ scc.TraceState, _ = trace.ParseTraceState(carrier.Get(tracestateHeader))
+ scc.Remote = true
+
+ sc := trace.NewSpanContext(scc)
+ if !sc.IsValid() {
+ return trace.SpanContext{}
+ }
+
+ return sc
+}
+
+// upperHex detect hex is upper case Unicode characters.
+func upperHex(v string) bool {
+ for _, c := range v {
+ if c >= 'A' && c <= 'F' {
+ return true
+ }
+ }
+ return false
+}
+
+func extractPart(dst []byte, h *string, n int) bool {
+ part, left, _ := strings.Cut(*h, delimiter)
+ *h = left
+ // hex.Decode decodes unsupported upper-case characters, so exclude explicitly.
+ if len(part) != n || upperHex(part) {
+ return false
+ }
+ if p, err := hex.Decode(dst, []byte(part)); err != nil || p != n/2 {
+ return false
+ }
+ return true
+}
+
+// Fields returns the keys who's values are set with Inject.
+func (tc TraceContext) Fields() []string {
+ return []string{traceparentHeader, tracestateHeader}
+}