mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-31 23:58:03 +08:00
vendor: update buildkit to 1e6032c
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
40
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
40
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
@@ -25,12 +25,12 @@ type InstrumentConfig struct {
|
||||
}
|
||||
|
||||
// Description describes the instrument in human-readable terms.
|
||||
func (cfg InstrumentConfig) Description() string {
|
||||
func (cfg *InstrumentConfig) Description() string {
|
||||
return cfg.description
|
||||
}
|
||||
|
||||
// Unit describes the measurement unit for a instrument.
|
||||
func (cfg InstrumentConfig) Unit() unit.Unit {
|
||||
func (cfg *InstrumentConfig) Unit() unit.Unit {
|
||||
return cfg.unit
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func (cfg InstrumentConfig) Unit() unit.Unit {
|
||||
type InstrumentOption interface {
|
||||
// ApplyMeter is used to set a InstrumentOption value of a
|
||||
// InstrumentConfig.
|
||||
applyInstrument(*InstrumentConfig)
|
||||
applyInstrument(InstrumentConfig) InstrumentConfig
|
||||
}
|
||||
|
||||
// NewInstrumentConfig creates a new InstrumentConfig
|
||||
@@ -46,28 +46,30 @@ type InstrumentOption interface {
|
||||
func NewInstrumentConfig(opts ...InstrumentOption) InstrumentConfig {
|
||||
var config InstrumentConfig
|
||||
for _, o := range opts {
|
||||
o.applyInstrument(&config)
|
||||
config = o.applyInstrument(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
type instrumentOptionFunc func(*InstrumentConfig)
|
||||
type instrumentOptionFunc func(InstrumentConfig) InstrumentConfig
|
||||
|
||||
func (fn instrumentOptionFunc) applyInstrument(cfg *InstrumentConfig) {
|
||||
fn(cfg)
|
||||
func (fn instrumentOptionFunc) applyInstrument(cfg InstrumentConfig) InstrumentConfig {
|
||||
return fn(cfg)
|
||||
}
|
||||
|
||||
// WithDescription applies provided description.
|
||||
func WithDescription(desc string) InstrumentOption {
|
||||
return instrumentOptionFunc(func(cfg *InstrumentConfig) {
|
||||
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) {
|
||||
return instrumentOptionFunc(func(cfg InstrumentConfig) InstrumentConfig {
|
||||
cfg.unit = unit
|
||||
return cfg
|
||||
})
|
||||
}
|
||||
|
||||
@@ -78,19 +80,19 @@ 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(*MeterConfig)
|
||||
applyMeter(MeterConfig) MeterConfig
|
||||
}
|
||||
|
||||
// NewMeterConfig creates a new MeterConfig and applies
|
||||
@@ -98,27 +100,29 @@ type MeterOption interface {
|
||||
func NewMeterConfig(opts ...MeterOption) MeterConfig {
|
||||
var config MeterConfig
|
||||
for _, o := range opts {
|
||||
o.applyMeter(&config)
|
||||
config = o.applyMeter(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
type meterOptionFunc func(*MeterConfig)
|
||||
type meterOptionFunc func(MeterConfig) MeterConfig
|
||||
|
||||
func (fn meterOptionFunc) applyMeter(cfg *MeterConfig) {
|
||||
fn(cfg)
|
||||
func (fn meterOptionFunc) applyMeter(cfg MeterConfig) MeterConfig {
|
||||
return fn(cfg)
|
||||
}
|
||||
|
||||
// WithInstrumentationVersion sets the instrumentation version.
|
||||
func WithInstrumentationVersion(version string) MeterOption {
|
||||
return meterOptionFunc(func(config *MeterConfig) {
|
||||
return meterOptionFunc(func(config MeterConfig) MeterConfig {
|
||||
config.instrumentationVersion = version
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
||||
// WithSchemaURL sets the schema URL.
|
||||
func WithSchemaURL(schemaURL string) MeterOption {
|
||||
return meterOptionFunc(func(config *MeterConfig) {
|
||||
return meterOptionFunc(func(config MeterConfig) MeterConfig {
|
||||
config.schemaURL = schemaURL
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user