mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-25 12:48:04 +08:00
vendor: github.com/moby/buildkit v0.13.0-rc2
full diff: https://github.com/moby/buildkit/compare/8e3fe35738c2...v0.13.0-rc2 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
32
vendor/go.opentelemetry.io/otel/sdk/metric/instrument.go
generated
vendored
32
vendor/go.opentelemetry.io/otel/sdk/metric/instrument.go
generated
vendored
@@ -188,9 +188,11 @@ type int64Inst struct {
|
||||
embedded.Int64Histogram
|
||||
}
|
||||
|
||||
var _ metric.Int64Counter = (*int64Inst)(nil)
|
||||
var _ metric.Int64UpDownCounter = (*int64Inst)(nil)
|
||||
var _ metric.Int64Histogram = (*int64Inst)(nil)
|
||||
var (
|
||||
_ metric.Int64Counter = (*int64Inst)(nil)
|
||||
_ metric.Int64UpDownCounter = (*int64Inst)(nil)
|
||||
_ metric.Int64Histogram = (*int64Inst)(nil)
|
||||
)
|
||||
|
||||
func (i *int64Inst) Add(ctx context.Context, val int64, opts ...metric.AddOption) {
|
||||
c := metric.NewAddConfig(opts)
|
||||
@@ -219,9 +221,11 @@ type float64Inst struct {
|
||||
embedded.Float64Histogram
|
||||
}
|
||||
|
||||
var _ metric.Float64Counter = (*float64Inst)(nil)
|
||||
var _ metric.Float64UpDownCounter = (*float64Inst)(nil)
|
||||
var _ metric.Float64Histogram = (*float64Inst)(nil)
|
||||
var (
|
||||
_ metric.Float64Counter = (*float64Inst)(nil)
|
||||
_ metric.Float64UpDownCounter = (*float64Inst)(nil)
|
||||
_ metric.Float64Histogram = (*float64Inst)(nil)
|
||||
)
|
||||
|
||||
func (i *float64Inst) Add(ctx context.Context, val float64, opts ...metric.AddOption) {
|
||||
c := metric.NewAddConfig(opts)
|
||||
@@ -260,9 +264,11 @@ type float64Observable struct {
|
||||
embedded.Float64ObservableGauge
|
||||
}
|
||||
|
||||
var _ metric.Float64ObservableCounter = float64Observable{}
|
||||
var _ metric.Float64ObservableUpDownCounter = float64Observable{}
|
||||
var _ metric.Float64ObservableGauge = float64Observable{}
|
||||
var (
|
||||
_ metric.Float64ObservableCounter = float64Observable{}
|
||||
_ metric.Float64ObservableUpDownCounter = float64Observable{}
|
||||
_ metric.Float64ObservableGauge = float64Observable{}
|
||||
)
|
||||
|
||||
func newFloat64Observable(m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[float64]) float64Observable {
|
||||
return float64Observable{
|
||||
@@ -279,9 +285,11 @@ type int64Observable struct {
|
||||
embedded.Int64ObservableGauge
|
||||
}
|
||||
|
||||
var _ metric.Int64ObservableCounter = int64Observable{}
|
||||
var _ metric.Int64ObservableUpDownCounter = int64Observable{}
|
||||
var _ metric.Int64ObservableGauge = int64Observable{}
|
||||
var (
|
||||
_ metric.Int64ObservableCounter = int64Observable{}
|
||||
_ metric.Int64ObservableUpDownCounter = int64Observable{}
|
||||
_ metric.Int64ObservableGauge = int64Observable{}
|
||||
)
|
||||
|
||||
func newInt64Observable(m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[int64]) int64Observable {
|
||||
return int64Observable{
|
||||
|
@@ -113,7 +113,7 @@ func (p *expoHistogramDataPoint[N]) record(v N) {
|
||||
otel.Handle(errors.New("exponential histogram scale underflow"))
|
||||
return
|
||||
}
|
||||
//Downscale
|
||||
// Downscale
|
||||
p.scale -= scaleDelta
|
||||
p.posBuckets.downscale(scaleDelta)
|
||||
p.negBuckets.downscale(scaleDelta)
|
||||
|
64
vendor/go.opentelemetry.io/otel/sdk/metric/meter.go
generated
vendored
64
vendor/go.opentelemetry.io/otel/sdk/metric/meter.go
generated
vendored
@@ -26,11 +26,9 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric/internal/aggregate"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrInstrumentName indicates the created instrument has an invalid name.
|
||||
// Valid names must consist of 255 or fewer characters including alphanumeric, _, ., -, / and start with a letter.
|
||||
ErrInstrumentName = errors.New("invalid instrument name")
|
||||
)
|
||||
// ErrInstrumentName indicates the created instrument has an invalid name.
|
||||
// Valid names must consist of 255 or fewer characters including alphanumeric, _, ., -, / and start with a letter.
|
||||
var ErrInstrumentName = errors.New("invalid instrument name")
|
||||
|
||||
// meter handles the creation and coordination of all metric instruments. A
|
||||
// meter represents a single instrumentation scope; all metric telemetry
|
||||
@@ -97,9 +95,8 @@ func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCou
|
||||
// distribution of int64 measurements during a computational operation.
|
||||
func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) {
|
||||
cfg := metric.NewInt64HistogramConfig(options...)
|
||||
const kind = InstrumentKindHistogram
|
||||
p := int64InstProvider{m}
|
||||
i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit())
|
||||
i, err := p.lookupHistogram(name, cfg)
|
||||
if err != nil {
|
||||
return i, err
|
||||
}
|
||||
@@ -190,9 +187,8 @@ func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDow
|
||||
// distribution of float64 measurements during a computational operation.
|
||||
func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) {
|
||||
cfg := metric.NewFloat64HistogramConfig(options...)
|
||||
const kind = InstrumentKindHistogram
|
||||
p := float64InstProvider{m}
|
||||
i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit())
|
||||
i, err := p.lookupHistogram(name, cfg)
|
||||
if err != nil {
|
||||
return i, err
|
||||
}
|
||||
@@ -268,9 +264,11 @@ func validateInstrumentName(name string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func isAlpha(c rune) bool {
|
||||
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')
|
||||
}
|
||||
|
||||
func isAlphanumeric(c rune) bool {
|
||||
return isAlpha(c) || ('0' <= c && c <= '9')
|
||||
}
|
||||
@@ -456,12 +454,36 @@ func (p int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]ag
|
||||
return p.int64Resolver.Aggregators(inst)
|
||||
}
|
||||
|
||||
func (p int64InstProvider) histogramAggs(name string, cfg metric.Int64HistogramConfig) ([]aggregate.Measure[int64], error) {
|
||||
boundaries := cfg.ExplicitBucketBoundaries()
|
||||
aggError := AggregationExplicitBucketHistogram{Boundaries: boundaries}.err()
|
||||
if aggError != nil {
|
||||
// If boundaries are invalid, ignore them.
|
||||
boundaries = nil
|
||||
}
|
||||
inst := Instrument{
|
||||
Name: name,
|
||||
Description: cfg.Description(),
|
||||
Unit: cfg.Unit(),
|
||||
Kind: InstrumentKindHistogram,
|
||||
Scope: p.scope,
|
||||
}
|
||||
measures, err := p.int64Resolver.HistogramAggregators(inst, boundaries)
|
||||
return measures, errors.Join(aggError, err)
|
||||
}
|
||||
|
||||
// lookup returns the resolved instrumentImpl.
|
||||
func (p int64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*int64Inst, error) {
|
||||
aggs, err := p.aggs(kind, name, desc, u)
|
||||
return &int64Inst{measures: aggs}, err
|
||||
}
|
||||
|
||||
// lookupHistogram returns the resolved instrumentImpl.
|
||||
func (p int64InstProvider) lookupHistogram(name string, cfg metric.Int64HistogramConfig) (*int64Inst, error) {
|
||||
aggs, err := p.histogramAggs(name, cfg)
|
||||
return &int64Inst{measures: aggs}, err
|
||||
}
|
||||
|
||||
// float64InstProvider provides float64 OpenTelemetry instruments.
|
||||
type float64InstProvider struct{ *meter }
|
||||
|
||||
@@ -476,12 +498,36 @@ func (p float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]
|
||||
return p.float64Resolver.Aggregators(inst)
|
||||
}
|
||||
|
||||
func (p float64InstProvider) histogramAggs(name string, cfg metric.Float64HistogramConfig) ([]aggregate.Measure[float64], error) {
|
||||
boundaries := cfg.ExplicitBucketBoundaries()
|
||||
aggError := AggregationExplicitBucketHistogram{Boundaries: boundaries}.err()
|
||||
if aggError != nil {
|
||||
// If boundaries are invalid, ignore them.
|
||||
boundaries = nil
|
||||
}
|
||||
inst := Instrument{
|
||||
Name: name,
|
||||
Description: cfg.Description(),
|
||||
Unit: cfg.Unit(),
|
||||
Kind: InstrumentKindHistogram,
|
||||
Scope: p.scope,
|
||||
}
|
||||
measures, err := p.float64Resolver.HistogramAggregators(inst, boundaries)
|
||||
return measures, errors.Join(aggError, err)
|
||||
}
|
||||
|
||||
// lookup returns the resolved instrumentImpl.
|
||||
func (p float64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*float64Inst, error) {
|
||||
aggs, err := p.aggs(kind, name, desc, u)
|
||||
return &float64Inst{measures: aggs}, err
|
||||
}
|
||||
|
||||
// lookupHistogram returns the resolved instrumentImpl.
|
||||
func (p float64InstProvider) lookupHistogram(name string, cfg metric.Float64HistogramConfig) (*float64Inst, error) {
|
||||
aggs, err := p.histogramAggs(name, cfg)
|
||||
return &float64Inst{measures: aggs}, err
|
||||
}
|
||||
|
||||
type int64ObservProvider struct{ *meter }
|
||||
|
||||
func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (int64Observable, error) {
|
||||
|
51
vendor/go.opentelemetry.io/otel/sdk/metric/metricdata/data.go
generated
vendored
51
vendor/go.opentelemetry.io/otel/sdk/metric/metricdata/data.go
generated
vendored
@@ -240,3 +240,54 @@ type Exemplar[N int64 | float64] struct {
|
||||
// be empty.
|
||||
TraceID []byte `json:",omitempty"`
|
||||
}
|
||||
|
||||
// Summary metric data are used to convey quantile summaries,
|
||||
// a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary)
|
||||
// data type.
|
||||
//
|
||||
// These data points cannot always be merged in a meaningful way. The Summary
|
||||
// type is only used by bridges from other metrics libraries, and cannot be
|
||||
// produced using OpenTelemetry instrumentation.
|
||||
type Summary struct {
|
||||
// DataPoints are the individual aggregated measurements with unique
|
||||
// attributes.
|
||||
DataPoints []SummaryDataPoint
|
||||
}
|
||||
|
||||
func (Summary) privateAggregation() {}
|
||||
|
||||
// SummaryDataPoint is a single data point in a timeseries that describes the
|
||||
// time-varying values of a Summary metric.
|
||||
type SummaryDataPoint struct {
|
||||
// Attributes is the set of key value pairs that uniquely identify the
|
||||
// timeseries.
|
||||
Attributes attribute.Set
|
||||
|
||||
// StartTime is when the timeseries was started.
|
||||
StartTime time.Time
|
||||
// Time is the time when the timeseries was recorded.
|
||||
Time time.Time
|
||||
|
||||
// Count is the number of updates this summary has been calculated with.
|
||||
Count uint64
|
||||
|
||||
// Sum is the sum of the values recorded.
|
||||
Sum float64
|
||||
|
||||
// (Optional) list of values at different quantiles of the distribution calculated
|
||||
// from the current snapshot. The quantiles must be strictly increasing.
|
||||
QuantileValues []QuantileValue
|
||||
}
|
||||
|
||||
// QuantileValue is the value at a given quantile of a summary.
|
||||
type QuantileValue struct {
|
||||
// Quantile is the quantile of this value.
|
||||
//
|
||||
// Must be in the interval [0.0, 1.0].
|
||||
Quantile float64
|
||||
|
||||
// Value is the value at the given quantile of a summary.
|
||||
//
|
||||
// Quantile values must NOT be negative.
|
||||
Value float64
|
||||
}
|
||||
|
3
vendor/go.opentelemetry.io/otel/sdk/metric/periodic_reader.go
generated
vendored
3
vendor/go.opentelemetry.io/otel/sdk/metric/periodic_reader.go
generated
vendored
@@ -127,7 +127,8 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) *Peri
|
||||
rmPool: sync.Pool{
|
||||
New: func() interface{} {
|
||||
return &metricdata.ResourceMetrics{}
|
||||
}},
|
||||
},
|
||||
},
|
||||
}
|
||||
r.externalProducers.Store(conf.producers)
|
||||
|
||||
|
81
vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go
generated
vendored
81
vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go
generated
vendored
@@ -231,7 +231,7 @@ func newInserter[N int64 | float64](p *pipeline, vc *cache[string, instID]) *ins
|
||||
//
|
||||
// If an instrument is determined to use a Drop aggregation, that instrument is
|
||||
// not inserted nor returned.
|
||||
func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Measure[N], error) {
|
||||
func (i *inserter[N]) Instrument(inst Instrument, readerAggregation Aggregation) ([]aggregate.Measure[N], error) {
|
||||
var (
|
||||
matched bool
|
||||
measures []aggregate.Measure[N]
|
||||
@@ -245,8 +245,7 @@ func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Measure[N], error
|
||||
continue
|
||||
}
|
||||
matched = true
|
||||
|
||||
in, id, err := i.cachedAggregator(inst.Scope, inst.Kind, stream)
|
||||
in, id, err := i.cachedAggregator(inst.Scope, inst.Kind, stream, readerAggregation)
|
||||
if err != nil {
|
||||
errs.append(err)
|
||||
}
|
||||
@@ -271,7 +270,7 @@ func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Measure[N], error
|
||||
Description: inst.Description,
|
||||
Unit: inst.Unit,
|
||||
}
|
||||
in, _, err := i.cachedAggregator(inst.Scope, inst.Kind, stream)
|
||||
in, _, err := i.cachedAggregator(inst.Scope, inst.Kind, stream, readerAggregation)
|
||||
if err != nil {
|
||||
errs.append(err)
|
||||
}
|
||||
@@ -291,6 +290,31 @@ type aggVal[N int64 | float64] struct {
|
||||
Err error
|
||||
}
|
||||
|
||||
// readerDefaultAggregation returns the default aggregation for the instrument
|
||||
// kind based on the reader's aggregation preferences. This is used unless the
|
||||
// aggregation is overridden with a view.
|
||||
func (i *inserter[N]) readerDefaultAggregation(kind InstrumentKind) Aggregation {
|
||||
aggregation := i.pipeline.reader.aggregation(kind)
|
||||
switch aggregation.(type) {
|
||||
case nil, AggregationDefault:
|
||||
// If the reader returns default or nil use the default selector.
|
||||
aggregation = DefaultAggregationSelector(kind)
|
||||
default:
|
||||
// Deep copy and validate before using.
|
||||
aggregation = aggregation.copy()
|
||||
if err := aggregation.err(); err != nil {
|
||||
orig := aggregation
|
||||
aggregation = DefaultAggregationSelector(kind)
|
||||
global.Error(
|
||||
err, "using default aggregation instead",
|
||||
"aggregation", orig,
|
||||
"replacement", aggregation,
|
||||
)
|
||||
}
|
||||
}
|
||||
return aggregation
|
||||
}
|
||||
|
||||
// cachedAggregator returns the appropriate aggregate input and output
|
||||
// functions for an instrument configuration. If the exact instrument has been
|
||||
// created within the inst.Scope, those aggregate function instances will be
|
||||
@@ -305,29 +329,14 @@ type aggVal[N int64 | float64] struct {
|
||||
//
|
||||
// If the instrument defines an unknown or incompatible aggregation, an error
|
||||
// is returned.
|
||||
func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (meas aggregate.Measure[N], aggID uint64, err error) {
|
||||
func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream, readerAggregation Aggregation) (meas aggregate.Measure[N], aggID uint64, err error) {
|
||||
switch stream.Aggregation.(type) {
|
||||
case nil:
|
||||
// Undefined, nil, means to use the default from the reader.
|
||||
stream.Aggregation = i.pipeline.reader.aggregation(kind)
|
||||
switch stream.Aggregation.(type) {
|
||||
case nil, AggregationDefault:
|
||||
// If the reader returns default or nil use the default selector.
|
||||
stream.Aggregation = DefaultAggregationSelector(kind)
|
||||
default:
|
||||
// Deep copy and validate before using.
|
||||
stream.Aggregation = stream.Aggregation.copy()
|
||||
if err := stream.Aggregation.err(); err != nil {
|
||||
orig := stream.Aggregation
|
||||
stream.Aggregation = DefaultAggregationSelector(kind)
|
||||
global.Error(
|
||||
err, "using default aggregation instead",
|
||||
"aggregation", orig,
|
||||
"replacement", stream.Aggregation,
|
||||
)
|
||||
}
|
||||
}
|
||||
// The aggregation was not overridden with a view. Use the aggregation
|
||||
// provided by the reader.
|
||||
stream.Aggregation = readerAggregation
|
||||
case AggregationDefault:
|
||||
// The view explicitly requested the default aggregation.
|
||||
stream.Aggregation = DefaultAggregationSelector(kind)
|
||||
}
|
||||
|
||||
@@ -596,7 +605,29 @@ func (r resolver[N]) Aggregators(id Instrument) ([]aggregate.Measure[N], error)
|
||||
|
||||
errs := &multierror{}
|
||||
for _, i := range r.inserters {
|
||||
in, err := i.Instrument(id)
|
||||
in, err := i.Instrument(id, i.readerDefaultAggregation(id.Kind))
|
||||
if err != nil {
|
||||
errs.append(err)
|
||||
}
|
||||
measures = append(measures, in...)
|
||||
}
|
||||
return measures, errs.errorOrNil()
|
||||
}
|
||||
|
||||
// HistogramAggregators returns the histogram Aggregators that must be updated by the instrument
|
||||
// defined by key. If boundaries were provided on instrument instantiation, those take precedence
|
||||
// over boundaries provided by the reader.
|
||||
func (r resolver[N]) HistogramAggregators(id Instrument, boundaries []float64) ([]aggregate.Measure[N], error) {
|
||||
var measures []aggregate.Measure[N]
|
||||
|
||||
errs := &multierror{}
|
||||
for _, i := range r.inserters {
|
||||
agg := i.readerDefaultAggregation(id.Kind)
|
||||
if histAgg, ok := agg.(AggregationExplicitBucketHistogram); ok && len(boundaries) > 0 {
|
||||
histAgg.Boundaries = boundaries
|
||||
agg = histAgg
|
||||
}
|
||||
in, err := i.Instrument(id, agg)
|
||||
if err != nil {
|
||||
errs.append(err)
|
||||
}
|
||||
|
2
vendor/go.opentelemetry.io/otel/sdk/metric/version.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/sdk/metric/version.go
generated
vendored
@@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric"
|
||||
|
||||
// version is the current release version of the metric SDK in use.
|
||||
func version() string {
|
||||
return "1.19.0"
|
||||
return "1.21.0"
|
||||
}
|
||||
|
Reference in New Issue
Block a user