mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: bump the github-dependencies group with 2 updates
Bumps the github-dependencies group with 2 updates: [github.com/aws/aws-sdk-go-v2/service/sts](https://github.com/aws/aws-sdk-go-v2) and [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang). Updates `github.com/aws/aws-sdk-go-v2/service/sts` from 1.30.7 to 1.31.1 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/service/s3/v1.31.1/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/mgn/v1.30.7...service/s3/v1.31.1) Updates `github.com/prometheus/client_golang` from 1.20.3 to 1.20.4 - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.20.3...v1.20.4) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/service/sts dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-dependencies - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
dbd8462bcc
commit
40ad4163cb
13
vendor/github.com/aws/smithy-go/CHANGELOG.md
generated
vendored
13
vendor/github.com/aws/smithy-go/CHANGELOG.md
generated
vendored
@ -1,3 +1,16 @@
|
||||
# Release (2024-09-19)
|
||||
|
||||
## General Highlights
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
## Module Highlights
|
||||
* `github.com/aws/smithy-go`: v1.21.0
|
||||
* **Feature**: Add tracing and metrics APIs, and builtin instrumentation for both, in generated clients.
|
||||
* `github.com/aws/smithy-go/metrics/smithyotelmetrics`: [v1.0.0](metrics/smithyotelmetrics/CHANGELOG.md#v100-2024-09-19)
|
||||
* **Release**: Initial release of `smithyotelmetrics` module, which is used to adapt an OpenTelemetry SDK meter provider to be used with Smithy clients.
|
||||
* `github.com/aws/smithy-go/tracing/smithyoteltracing`: [v1.0.0](tracing/smithyoteltracing/CHANGELOG.md#v100-2024-09-19)
|
||||
* **Release**: Initial release of `smithyoteltracing` module, which is used to adapt an OpenTelemetry SDK tracer provider to be used with Smithy clients.
|
||||
|
||||
# Release (2024-08-14)
|
||||
|
||||
## Module Highlights
|
||||
|
2
vendor/github.com/aws/smithy-go/go_module_metadata.go
generated
vendored
2
vendor/github.com/aws/smithy-go/go_module_metadata.go
generated
vendored
@ -3,4 +3,4 @@
|
||||
package smithy
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.20.4"
|
||||
const goModuleVersion = "1.21.0"
|
||||
|
136
vendor/github.com/aws/smithy-go/metrics/metrics.go
generated
vendored
Normal file
136
vendor/github.com/aws/smithy-go/metrics/metrics.go
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
// Package metrics defines the metrics APIs used by Smithy clients.
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/aws/smithy-go"
|
||||
)
|
||||
|
||||
// MeterProvider is the entry point for creating a Meter.
|
||||
type MeterProvider interface {
|
||||
Meter(scope string, opts ...MeterOption) Meter
|
||||
}
|
||||
|
||||
// MeterOption applies configuration to a Meter.
|
||||
type MeterOption func(o *MeterOptions)
|
||||
|
||||
// MeterOptions represents configuration for a Meter.
|
||||
type MeterOptions struct {
|
||||
Properties smithy.Properties
|
||||
}
|
||||
|
||||
// Meter is the entry point for creation of measurement instruments.
|
||||
type Meter interface {
|
||||
// integer/synchronous
|
||||
Int64Counter(name string, opts ...InstrumentOption) (Int64Counter, error)
|
||||
Int64UpDownCounter(name string, opts ...InstrumentOption) (Int64UpDownCounter, error)
|
||||
Int64Gauge(name string, opts ...InstrumentOption) (Int64Gauge, error)
|
||||
Int64Histogram(name string, opts ...InstrumentOption) (Int64Histogram, error)
|
||||
|
||||
// integer/asynchronous
|
||||
Int64AsyncCounter(name string, callback Int64Callback, opts ...InstrumentOption) (AsyncInstrument, error)
|
||||
Int64AsyncUpDownCounter(name string, callback Int64Callback, opts ...InstrumentOption) (AsyncInstrument, error)
|
||||
Int64AsyncGauge(name string, callback Int64Callback, opts ...InstrumentOption) (AsyncInstrument, error)
|
||||
|
||||
// floating-point/synchronous
|
||||
Float64Counter(name string, opts ...InstrumentOption) (Float64Counter, error)
|
||||
Float64UpDownCounter(name string, opts ...InstrumentOption) (Float64UpDownCounter, error)
|
||||
Float64Gauge(name string, opts ...InstrumentOption) (Float64Gauge, error)
|
||||
Float64Histogram(name string, opts ...InstrumentOption) (Float64Histogram, error)
|
||||
|
||||
// floating-point/asynchronous
|
||||
Float64AsyncCounter(name string, callback Float64Callback, opts ...InstrumentOption) (AsyncInstrument, error)
|
||||
Float64AsyncUpDownCounter(name string, callback Float64Callback, opts ...InstrumentOption) (AsyncInstrument, error)
|
||||
Float64AsyncGauge(name string, callback Float64Callback, opts ...InstrumentOption) (AsyncInstrument, error)
|
||||
}
|
||||
|
||||
// InstrumentOption applies configuration to an instrument.
|
||||
type InstrumentOption func(o *InstrumentOptions)
|
||||
|
||||
// InstrumentOptions represents configuration for an instrument.
|
||||
type InstrumentOptions struct {
|
||||
UnitLabel string
|
||||
Description string
|
||||
}
|
||||
|
||||
// Int64Counter measures a monotonically increasing int64 value.
|
||||
type Int64Counter interface {
|
||||
Add(context.Context, int64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// Int64UpDownCounter measures a fluctuating int64 value.
|
||||
type Int64UpDownCounter interface {
|
||||
Add(context.Context, int64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// Int64Gauge samples a discrete int64 value.
|
||||
type Int64Gauge interface {
|
||||
Sample(context.Context, int64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// Int64Histogram records multiple data points for an int64 value.
|
||||
type Int64Histogram interface {
|
||||
Record(context.Context, int64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// Float64Counter measures a monotonically increasing float64 value.
|
||||
type Float64Counter interface {
|
||||
Add(context.Context, float64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// Float64UpDownCounter measures a fluctuating float64 value.
|
||||
type Float64UpDownCounter interface {
|
||||
Add(context.Context, float64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// Float64Gauge samples a discrete float64 value.
|
||||
type Float64Gauge interface {
|
||||
Sample(context.Context, float64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// Float64Histogram records multiple data points for an float64 value.
|
||||
type Float64Histogram interface {
|
||||
Record(context.Context, float64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// AsyncInstrument is the universal handle returned for creation of all async
|
||||
// instruments.
|
||||
//
|
||||
// Callers use the Stop() API to unregister the callback passed at instrument
|
||||
// creation.
|
||||
type AsyncInstrument interface {
|
||||
Stop()
|
||||
}
|
||||
|
||||
// Int64Callback describes a function invoked when an async int64 instrument is
|
||||
// read.
|
||||
type Int64Callback func(context.Context, Int64Observer)
|
||||
|
||||
// Int64Observer is the interface passed to async int64 instruments.
|
||||
//
|
||||
// Callers use the Observe() API of this interface to report metrics to the
|
||||
// underlying collector.
|
||||
type Int64Observer interface {
|
||||
Observe(context.Context, int64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// Float64Callback describes a function invoked when an async float64
|
||||
// instrument is read.
|
||||
type Float64Callback func(context.Context, Float64Observer)
|
||||
|
||||
// Float64Observer is the interface passed to async int64 instruments.
|
||||
//
|
||||
// Callers use the Observe() API of this interface to report metrics to the
|
||||
// underlying collector.
|
||||
type Float64Observer interface {
|
||||
Observe(context.Context, float64, ...RecordMetricOption)
|
||||
}
|
||||
|
||||
// RecordMetricOption applies configuration to a recorded metric.
|
||||
type RecordMetricOption func(o *RecordMetricOptions)
|
||||
|
||||
// RecordMetricOptions represents configuration for a recorded metric.
|
||||
type RecordMetricOptions struct {
|
||||
Properties smithy.Properties
|
||||
}
|
67
vendor/github.com/aws/smithy-go/metrics/nop.go
generated
vendored
Normal file
67
vendor/github.com/aws/smithy-go/metrics/nop.go
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
package metrics
|
||||
|
||||
import "context"
|
||||
|
||||
// NopMeterProvider is a no-op metrics implementation.
|
||||
type NopMeterProvider struct{}
|
||||
|
||||
var _ MeterProvider = (*NopMeterProvider)(nil)
|
||||
|
||||
// Meter returns a meter which creates no-op instruments.
|
||||
func (NopMeterProvider) Meter(string, ...MeterOption) Meter {
|
||||
return nopMeter{}
|
||||
}
|
||||
|
||||
type nopMeter struct{}
|
||||
|
||||
var _ Meter = (*nopMeter)(nil)
|
||||
|
||||
func (nopMeter) Int64Counter(string, ...InstrumentOption) (Int64Counter, error) {
|
||||
return nopInstrument[int64]{}, nil
|
||||
}
|
||||
func (nopMeter) Int64UpDownCounter(string, ...InstrumentOption) (Int64UpDownCounter, error) {
|
||||
return nopInstrument[int64]{}, nil
|
||||
}
|
||||
func (nopMeter) Int64Gauge(string, ...InstrumentOption) (Int64Gauge, error) {
|
||||
return nopInstrument[int64]{}, nil
|
||||
}
|
||||
func (nopMeter) Int64Histogram(string, ...InstrumentOption) (Int64Histogram, error) {
|
||||
return nopInstrument[int64]{}, nil
|
||||
}
|
||||
func (nopMeter) Int64AsyncCounter(string, Int64Callback, ...InstrumentOption) (AsyncInstrument, error) {
|
||||
return nopInstrument[int64]{}, nil
|
||||
}
|
||||
func (nopMeter) Int64AsyncUpDownCounter(string, Int64Callback, ...InstrumentOption) (AsyncInstrument, error) {
|
||||
return nopInstrument[int64]{}, nil
|
||||
}
|
||||
func (nopMeter) Int64AsyncGauge(string, Int64Callback, ...InstrumentOption) (AsyncInstrument, error) {
|
||||
return nopInstrument[int64]{}, nil
|
||||
}
|
||||
func (nopMeter) Float64Counter(string, ...InstrumentOption) (Float64Counter, error) {
|
||||
return nopInstrument[float64]{}, nil
|
||||
}
|
||||
func (nopMeter) Float64UpDownCounter(string, ...InstrumentOption) (Float64UpDownCounter, error) {
|
||||
return nopInstrument[float64]{}, nil
|
||||
}
|
||||
func (nopMeter) Float64Gauge(string, ...InstrumentOption) (Float64Gauge, error) {
|
||||
return nopInstrument[float64]{}, nil
|
||||
}
|
||||
func (nopMeter) Float64Histogram(string, ...InstrumentOption) (Float64Histogram, error) {
|
||||
return nopInstrument[float64]{}, nil
|
||||
}
|
||||
func (nopMeter) Float64AsyncCounter(string, Float64Callback, ...InstrumentOption) (AsyncInstrument, error) {
|
||||
return nopInstrument[float64]{}, nil
|
||||
}
|
||||
func (nopMeter) Float64AsyncUpDownCounter(string, Float64Callback, ...InstrumentOption) (AsyncInstrument, error) {
|
||||
return nopInstrument[float64]{}, nil
|
||||
}
|
||||
func (nopMeter) Float64AsyncGauge(string, Float64Callback, ...InstrumentOption) (AsyncInstrument, error) {
|
||||
return nopInstrument[float64]{}, nil
|
||||
}
|
||||
|
||||
type nopInstrument[N any] struct{}
|
||||
|
||||
func (nopInstrument[N]) Add(context.Context, N, ...RecordMetricOption) {}
|
||||
func (nopInstrument[N]) Sample(context.Context, N, ...RecordMetricOption) {}
|
||||
func (nopInstrument[N]) Record(context.Context, N, ...RecordMetricOption) {}
|
||||
func (nopInstrument[_]) Stop() {}
|
41
vendor/github.com/aws/smithy-go/middleware/context.go
generated
vendored
Normal file
41
vendor/github.com/aws/smithy-go/middleware/context.go
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
package middleware
|
||||
|
||||
import "context"
|
||||
|
||||
type (
|
||||
serviceIDKey struct{}
|
||||
operationNameKey struct{}
|
||||
)
|
||||
|
||||
// WithServiceID adds a service ID to the context, scoped to middleware stack
|
||||
// values.
|
||||
//
|
||||
// This API is called in the client runtime when bootstrapping an operation and
|
||||
// should not typically be used directly.
|
||||
func WithServiceID(parent context.Context, id string) context.Context {
|
||||
return WithStackValue(parent, serviceIDKey{}, id)
|
||||
}
|
||||
|
||||
// GetServiceID retrieves the service ID from the context. This is typically
|
||||
// the service shape's name from its Smithy model. Service clients for specific
|
||||
// systems (e.g. AWS SDK) may use an alternate designated value.
|
||||
func GetServiceID(ctx context.Context) string {
|
||||
id, _ := GetStackValue(ctx, serviceIDKey{}).(string)
|
||||
return id
|
||||
}
|
||||
|
||||
// WithOperationName adds the operation name to the context, scoped to
|
||||
// middleware stack values.
|
||||
//
|
||||
// This API is called in the client runtime when bootstrapping an operation and
|
||||
// should not typically be used directly.
|
||||
func WithOperationName(parent context.Context, id string) context.Context {
|
||||
return WithStackValue(parent, operationNameKey{}, id)
|
||||
}
|
||||
|
||||
// GetOperationName retrieves the operation name from the context. This is
|
||||
// typically the operation shape's name from its Smithy model.
|
||||
func GetOperationName(ctx context.Context) string {
|
||||
name, _ := GetStackValue(ctx, operationNameKey{}).(string)
|
||||
return name
|
||||
}
|
19
vendor/github.com/aws/smithy-go/properties.go
generated
vendored
19
vendor/github.com/aws/smithy-go/properties.go
generated
vendored
@ -1,9 +1,11 @@
|
||||
package smithy
|
||||
|
||||
import "maps"
|
||||
|
||||
// PropertiesReader provides an interface for reading metadata from the
|
||||
// underlying metadata container.
|
||||
type PropertiesReader interface {
|
||||
Get(key interface{}) interface{}
|
||||
Get(key any) any
|
||||
}
|
||||
|
||||
// Properties provides storing and reading metadata values. Keys may be any
|
||||
@ -12,14 +14,14 @@ type PropertiesReader interface {
|
||||
// The zero value for a Properties instance is ready for reads/writes without
|
||||
// any additional initialization.
|
||||
type Properties struct {
|
||||
values map[interface{}]interface{}
|
||||
values map[any]any
|
||||
}
|
||||
|
||||
// Get attempts to retrieve the value the key points to. Returns nil if the
|
||||
// key was not found.
|
||||
//
|
||||
// Panics if key type is not comparable.
|
||||
func (m *Properties) Get(key interface{}) interface{} {
|
||||
func (m *Properties) Get(key any) any {
|
||||
m.lazyInit()
|
||||
return m.values[key]
|
||||
}
|
||||
@ -28,7 +30,7 @@ func (m *Properties) Get(key interface{}) interface{} {
|
||||
// that key it will be replaced with the new value.
|
||||
//
|
||||
// Panics if the key type is not comparable.
|
||||
func (m *Properties) Set(key, value interface{}) {
|
||||
func (m *Properties) Set(key, value any) {
|
||||
m.lazyInit()
|
||||
m.values[key] = value
|
||||
}
|
||||
@ -36,7 +38,7 @@ func (m *Properties) Set(key, value interface{}) {
|
||||
// Has returns whether the key exists in the metadata.
|
||||
//
|
||||
// Panics if the key type is not comparable.
|
||||
func (m *Properties) Has(key interface{}) bool {
|
||||
func (m *Properties) Has(key any) bool {
|
||||
m.lazyInit()
|
||||
_, ok := m.values[key]
|
||||
return ok
|
||||
@ -55,8 +57,13 @@ func (m *Properties) SetAll(other *Properties) {
|
||||
}
|
||||
}
|
||||
|
||||
// Values returns a shallow clone of the property set's values.
|
||||
func (m *Properties) Values() map[any]any {
|
||||
return maps.Clone(m.values)
|
||||
}
|
||||
|
||||
func (m *Properties) lazyInit() {
|
||||
if m.values == nil {
|
||||
m.values = map[interface{}]interface{}{}
|
||||
m.values = map[any]any{}
|
||||
}
|
||||
}
|
||||
|
96
vendor/github.com/aws/smithy-go/tracing/context.go
generated
vendored
Normal file
96
vendor/github.com/aws/smithy-go/tracing/context.go
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
package tracing
|
||||
|
||||
import "context"
|
||||
|
||||
type (
|
||||
operationTracerKey struct{}
|
||||
spanLineageKey struct{}
|
||||
)
|
||||
|
||||
// GetSpan returns the active trace Span on the context.
|
||||
//
|
||||
// The boolean in the return indicates whether a Span was actually in the
|
||||
// context, but a no-op implementation will be returned if not, so callers
|
||||
// can generally disregard the boolean unless they wish to explicitly confirm
|
||||
// presence/absence of a Span.
|
||||
func GetSpan(ctx context.Context) (Span, bool) {
|
||||
lineage := getLineage(ctx)
|
||||
if len(lineage) == 0 {
|
||||
return nopSpan{}, false
|
||||
}
|
||||
|
||||
return lineage[len(lineage)-1], true
|
||||
}
|
||||
|
||||
// WithSpan sets the active trace Span on the context.
|
||||
func WithSpan(parent context.Context, span Span) context.Context {
|
||||
lineage := getLineage(parent)
|
||||
if len(lineage) == 0 {
|
||||
return context.WithValue(parent, spanLineageKey{}, []Span{span})
|
||||
}
|
||||
|
||||
lineage = append(lineage, span)
|
||||
return context.WithValue(parent, spanLineageKey{}, lineage)
|
||||
}
|
||||
|
||||
// PopSpan pops the current Span off the context, setting the active Span on
|
||||
// the returned Context back to its parent and returning the REMOVED one.
|
||||
//
|
||||
// PopSpan on a context with no active Span will return a no-op instance.
|
||||
//
|
||||
// This is mostly necessary for the runtime to manage base trace spans due to
|
||||
// the wrapped-function nature of the middleware stack. End-users of Smithy
|
||||
// clients SHOULD NOT generally be using this API.
|
||||
func PopSpan(parent context.Context) (context.Context, Span) {
|
||||
lineage := getLineage(parent)
|
||||
if len(lineage) == 0 {
|
||||
return parent, nopSpan{}
|
||||
}
|
||||
|
||||
span := lineage[len(lineage)-1]
|
||||
lineage = lineage[:len(lineage)-1]
|
||||
return context.WithValue(parent, spanLineageKey{}, lineage), span
|
||||
}
|
||||
|
||||
func getLineage(ctx context.Context) []Span {
|
||||
v := ctx.Value(spanLineageKey{})
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return v.([]Span)
|
||||
}
|
||||
|
||||
// GetOperationTracer returns the embedded operation-scoped Tracer on a
|
||||
// Context.
|
||||
//
|
||||
// The boolean in the return indicates whether a Tracer was actually in the
|
||||
// context, but a no-op implementation will be returned if not, so callers
|
||||
// can generally disregard the boolean unless they wish to explicitly confirm
|
||||
// presence/absence of a Tracer.
|
||||
func GetOperationTracer(ctx context.Context) (Tracer, bool) {
|
||||
v := ctx.Value(operationTracerKey{})
|
||||
if v == nil {
|
||||
return nopTracer{}, false
|
||||
}
|
||||
|
||||
return v.(Tracer), true
|
||||
}
|
||||
|
||||
// WithOperationTracer returns a child Context embedding the given Tracer.
|
||||
//
|
||||
// The runtime will use this embed a scoped tracer for client operations,
|
||||
// Smithy/SDK client callers DO NOT need to do this explicitly.
|
||||
func WithOperationTracer(parent context.Context, tracer Tracer) context.Context {
|
||||
return context.WithValue(parent, operationTracerKey{}, tracer)
|
||||
}
|
||||
|
||||
// StartSpan is a convenience API for creating tracing Spans from a Context.
|
||||
//
|
||||
// StartSpan uses the operation-scoped Tracer, previously stored using
|
||||
// [WithOperationTracer], to start the Span. If a Tracer has not been embedded
|
||||
// the returned Span will be a no-op implementation.
|
||||
func StartSpan(ctx context.Context, name string, opts ...SpanOption) (context.Context, Span) {
|
||||
tracer, _ := GetOperationTracer(ctx)
|
||||
return tracer.StartSpan(ctx, name, opts...)
|
||||
}
|
32
vendor/github.com/aws/smithy-go/tracing/nop.go
generated
vendored
Normal file
32
vendor/github.com/aws/smithy-go/tracing/nop.go
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
package tracing
|
||||
|
||||
import "context"
|
||||
|
||||
// NopTracerProvider is a no-op tracing implementation.
|
||||
type NopTracerProvider struct{}
|
||||
|
||||
var _ TracerProvider = (*NopTracerProvider)(nil)
|
||||
|
||||
// Tracer returns a tracer which creates no-op spans.
|
||||
func (NopTracerProvider) Tracer(string, ...TracerOption) Tracer {
|
||||
return nopTracer{}
|
||||
}
|
||||
|
||||
type nopTracer struct{}
|
||||
|
||||
var _ Tracer = (*nopTracer)(nil)
|
||||
|
||||
func (nopTracer) StartSpan(ctx context.Context, name string, opts ...SpanOption) (context.Context, Span) {
|
||||
return ctx, nopSpan{}
|
||||
}
|
||||
|
||||
type nopSpan struct{}
|
||||
|
||||
var _ Span = (*nopSpan)(nil)
|
||||
|
||||
func (nopSpan) Name() string { return "" }
|
||||
func (nopSpan) Context() SpanContext { return SpanContext{} }
|
||||
func (nopSpan) AddEvent(string, ...EventOption) {}
|
||||
func (nopSpan) SetProperty(any, any) {}
|
||||
func (nopSpan) SetStatus(SpanStatus) {}
|
||||
func (nopSpan) End() {}
|
95
vendor/github.com/aws/smithy-go/tracing/tracing.go
generated
vendored
Normal file
95
vendor/github.com/aws/smithy-go/tracing/tracing.go
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
// 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
|
||||
}
|
18
vendor/github.com/aws/smithy-go/transport/http/client.go
generated
vendored
18
vendor/github.com/aws/smithy-go/transport/http/client.go
generated
vendored
@ -7,6 +7,7 @@ import (
|
||||
|
||||
smithy "github.com/aws/smithy-go"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
)
|
||||
|
||||
// ClientDo provides the interface for custom HTTP client implementations.
|
||||
@ -42,6 +43,9 @@ func NewClientHandler(client ClientDo) ClientHandler {
|
||||
func (c ClientHandler) Handle(ctx context.Context, input interface{}) (
|
||||
out interface{}, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
ctx, span := tracing.StartSpan(ctx, "DoHTTPRequest")
|
||||
defer span.End()
|
||||
|
||||
req, ok := input.(*Request)
|
||||
if !ok {
|
||||
return nil, metadata, fmt.Errorf("expect Smithy http.Request value as input, got unsupported type %T", input)
|
||||
@ -52,6 +56,16 @@ func (c ClientHandler) Handle(ctx context.Context, input interface{}) (
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
span.SetProperty("http.method", req.Method)
|
||||
span.SetProperty("http.request_content_length", -1) // at least indicate unknown
|
||||
length, ok, err := req.StreamLength()
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
if ok {
|
||||
span.SetProperty("http.request_content_length", length)
|
||||
}
|
||||
|
||||
resp, err := c.client.Do(builtRequest)
|
||||
if resp == nil {
|
||||
// Ensure a http response value is always present to prevent unexpected
|
||||
@ -79,6 +93,10 @@ func (c ClientHandler) Handle(ctx context.Context, input interface{}) (
|
||||
_ = builtRequest.Body.Close()
|
||||
}
|
||||
|
||||
span.SetProperty("net.protocol.version", fmt.Sprintf("%d.%d", resp.ProtoMajor, resp.ProtoMinor))
|
||||
span.SetProperty("http.status_code", resp.StatusCode)
|
||||
span.SetProperty("http.response_content_length", resp.ContentLength)
|
||||
|
||||
return &Response{Response: resp}, metadata, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user