mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-23 19:58:03 +08:00
vendor: update buildkit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
65
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
65
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
@@ -14,65 +14,6 @@
|
||||
|
||||
package metric // import "go.opentelemetry.io/otel/metric"
|
||||
|
||||
import (
|
||||
"go.opentelemetry.io/otel/metric/unit"
|
||||
)
|
||||
|
||||
// InstrumentConfig contains options for metric instrument descriptors.
|
||||
type InstrumentConfig struct {
|
||||
description string
|
||||
unit unit.Unit
|
||||
}
|
||||
|
||||
// Description describes the instrument in human-readable terms.
|
||||
func (cfg *InstrumentConfig) Description() string {
|
||||
return cfg.description
|
||||
}
|
||||
|
||||
// Unit describes the measurement unit for a instrument.
|
||||
func (cfg *InstrumentConfig) Unit() unit.Unit {
|
||||
return cfg.unit
|
||||
}
|
||||
|
||||
// InstrumentOption is an interface for applying metric instrument options.
|
||||
type InstrumentOption interface {
|
||||
// ApplyMeter is used to set a InstrumentOption value of a
|
||||
// InstrumentConfig.
|
||||
applyInstrument(InstrumentConfig) InstrumentConfig
|
||||
}
|
||||
|
||||
// NewInstrumentConfig creates a new InstrumentConfig
|
||||
// and applies all the given options.
|
||||
func NewInstrumentConfig(opts ...InstrumentOption) InstrumentConfig {
|
||||
var config InstrumentConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyInstrument(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
type instrumentOptionFunc func(InstrumentConfig) InstrumentConfig
|
||||
|
||||
func (fn instrumentOptionFunc) applyInstrument(cfg InstrumentConfig) InstrumentConfig {
|
||||
return fn(cfg)
|
||||
}
|
||||
|
||||
// WithDescription applies provided description.
|
||||
func WithDescription(desc string) InstrumentOption {
|
||||
return instrumentOptionFunc(func(cfg InstrumentConfig) InstrumentConfig {
|
||||
cfg.description = desc
|
||||
return cfg
|
||||
})
|
||||
}
|
||||
|
||||
// WithUnit applies provided unit.
|
||||
func WithUnit(unit unit.Unit) InstrumentOption {
|
||||
return instrumentOptionFunc(func(cfg InstrumentConfig) InstrumentConfig {
|
||||
cfg.unit = unit
|
||||
return cfg
|
||||
})
|
||||
}
|
||||
|
||||
// MeterConfig contains options for Meters.
|
||||
type MeterConfig struct {
|
||||
instrumentationVersion string
|
||||
@@ -80,18 +21,18 @@ type MeterConfig struct {
|
||||
}
|
||||
|
||||
// InstrumentationVersion is the version of the library providing instrumentation.
|
||||
func (cfg *MeterConfig) InstrumentationVersion() string {
|
||||
func (cfg MeterConfig) InstrumentationVersion() string {
|
||||
return cfg.instrumentationVersion
|
||||
}
|
||||
|
||||
// SchemaURL is the schema_url of the library providing instrumentation.
|
||||
func (cfg *MeterConfig) SchemaURL() string {
|
||||
func (cfg MeterConfig) SchemaURL() string {
|
||||
return cfg.schemaURL
|
||||
}
|
||||
|
||||
// MeterOption is an interface for applying Meter options.
|
||||
type MeterOption interface {
|
||||
// ApplyMeter is used to set a MeterOption value of a MeterConfig.
|
||||
// applyMeter is used to set a MeterOption value of a MeterConfig.
|
||||
applyMeter(MeterConfig) MeterConfig
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user