mirror of
https://github.com/luxfi/kms.git
synced 2026-11-03 08:42:32 +00:00
ghcr.io/luxfi/kms-operator has had no new image since v1.12.3. The Build KMS
Operator workflow failed on every tag since (v1.12.4 … v1.12.7) while its
sibling Build KMS succeeded on the same tag, so the tags looked published.
Dockerfile.operator:27 builds with -mod=vendor, and vendor/ had drifted from
go.mod in both directions:
- go.opentelemetry.io/otel/{metric,trace}: in vendor/modules.txt, not in go.mod
- github.com/luxfi/{crypto,geth,ids,keys,zap,address,age,cache,constants,
container,formatting,math,go-bip32,go-bip39}: in go.mod, not marked explicit
`go mod vendor` alone could not fix it — it aborted first on go.sum entries
missing for the k8s packages cmd/kms-operator imports (k8s.io/api/core/v1,
k8s.io/apimachinery/..., k8s.io/client-go/{dynamic,kubernetes,rest}). So:
go mod tidy (adds them, drops now-unused indirects) then go mod vendor.
Verified by stash control:
operator, -mod=vendor: rc=1 -> rc=0 ("inconsistent vendoring" 1 -> 0)
server, -mod=vendor: rc=1 -> rc=1 (unchanged)
The server's vendor build was already broken and stays broken, for an unrelated
reason: blst.h has never been vendored (confirmed absent from HEAD's tree, so it
could not have worked before either) — go mod vendor does not copy cgo headers
that live outside the package dir. It is not a regression and does not affect
CI: the server's Dockerfile builds with GOFLAGS=-mod=mod after `rm -f go.sum &&
go mod download`, i.e. from the module cache, never from vendor/. The operator
is the only -mod=vendor consumer, which is exactly why it was the only failure.
Co-authored-by: Hanzo Dev <[email protected]>
279 lines
9.5 KiB
Go
279 lines
9.5 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package metric // import "go.opentelemetry.io/otel/metric"
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.opentelemetry.io/otel/metric/embedded"
|
|
)
|
|
|
|
// Int64Observable describes a set of instruments used asynchronously to record
|
|
// int64 measurements once per collection cycle. Observations of these
|
|
// instruments are only made within a callback.
|
|
//
|
|
// Warning: Methods may be added to this interface in minor releases.
|
|
type Int64Observable interface {
|
|
Observable
|
|
|
|
int64Observable()
|
|
}
|
|
|
|
// Int64ObservableCounter is an instrument used to asynchronously record
|
|
// increasing int64 measurements once per collection cycle. Observations are
|
|
// only made within a callback for this instrument. The value observed is
|
|
// assumed the to be the cumulative sum of the count.
|
|
//
|
|
// Warning: Methods may be added to this interface in minor releases. See
|
|
// package documentation on API implementation for information on how to set
|
|
// default behavior for unimplemented methods.
|
|
type Int64ObservableCounter interface {
|
|
// Users of the interface can ignore this. This embedded type is only used
|
|
// by implementations of this interface. See the "API Implementations"
|
|
// section of the package documentation for more information.
|
|
embedded.Int64ObservableCounter
|
|
|
|
Int64Observable
|
|
}
|
|
|
|
// Int64ObservableCounterConfig contains options for asynchronous counter
|
|
// instruments that record int64 values.
|
|
type Int64ObservableCounterConfig struct {
|
|
description string
|
|
unit string
|
|
callbacks []Int64Callback
|
|
}
|
|
|
|
// NewInt64ObservableCounterConfig returns a new [Int64ObservableCounterConfig]
|
|
// with all opts applied.
|
|
func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig {
|
|
var config Int64ObservableCounterConfig
|
|
for _, o := range opts {
|
|
if _, ok := o.(experimentalOption); ok {
|
|
continue
|
|
}
|
|
config = o.applyInt64ObservableCounter(config)
|
|
}
|
|
return config
|
|
}
|
|
|
|
// Description returns the configured description.
|
|
func (c Int64ObservableCounterConfig) Description() string {
|
|
return c.description
|
|
}
|
|
|
|
// Unit returns the configured unit.
|
|
func (c Int64ObservableCounterConfig) Unit() string {
|
|
return c.unit
|
|
}
|
|
|
|
// Callbacks returns the configured callbacks.
|
|
func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback {
|
|
return c.callbacks
|
|
}
|
|
|
|
// Int64ObservableCounterOption applies options to a
|
|
// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and
|
|
// [InstrumentOption] for other options that can be used as an
|
|
// Int64ObservableCounterOption.
|
|
type Int64ObservableCounterOption interface {
|
|
applyInt64ObservableCounter(Int64ObservableCounterConfig) Int64ObservableCounterConfig
|
|
}
|
|
|
|
// Int64ObservableUpDownCounter is an instrument used to asynchronously record
|
|
// int64 measurements once per collection cycle. Observations are only made
|
|
// within a callback for this instrument. The value observed is assumed the to
|
|
// be the cumulative sum of the count.
|
|
//
|
|
// Warning: Methods may be added to this interface in minor releases. See
|
|
// package documentation on API implementation for information on how to set
|
|
// default behavior for unimplemented methods.
|
|
type Int64ObservableUpDownCounter interface {
|
|
// Users of the interface can ignore this. This embedded type is only used
|
|
// by implementations of this interface. See the "API Implementations"
|
|
// section of the package documentation for more information.
|
|
embedded.Int64ObservableUpDownCounter
|
|
|
|
Int64Observable
|
|
}
|
|
|
|
// Int64ObservableUpDownCounterConfig contains options for asynchronous counter
|
|
// instruments that record int64 values.
|
|
type Int64ObservableUpDownCounterConfig struct {
|
|
description string
|
|
unit string
|
|
callbacks []Int64Callback
|
|
}
|
|
|
|
// NewInt64ObservableUpDownCounterConfig returns a new
|
|
// [Int64ObservableUpDownCounterConfig] with all opts applied.
|
|
func NewInt64ObservableUpDownCounterConfig(
|
|
opts ...Int64ObservableUpDownCounterOption,
|
|
) Int64ObservableUpDownCounterConfig {
|
|
var config Int64ObservableUpDownCounterConfig
|
|
for _, o := range opts {
|
|
if _, ok := o.(experimentalOption); ok {
|
|
continue
|
|
}
|
|
config = o.applyInt64ObservableUpDownCounter(config)
|
|
}
|
|
return config
|
|
}
|
|
|
|
// Description returns the configured description.
|
|
func (c Int64ObservableUpDownCounterConfig) Description() string {
|
|
return c.description
|
|
}
|
|
|
|
// Unit returns the configured unit.
|
|
func (c Int64ObservableUpDownCounterConfig) Unit() string {
|
|
return c.unit
|
|
}
|
|
|
|
// Callbacks returns the configured callbacks.
|
|
func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback {
|
|
return c.callbacks
|
|
}
|
|
|
|
// Int64ObservableUpDownCounterOption applies options to a
|
|
// [Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and
|
|
// [InstrumentOption] for other options that can be used as an
|
|
// Int64ObservableUpDownCounterOption.
|
|
type Int64ObservableUpDownCounterOption interface {
|
|
applyInt64ObservableUpDownCounter(Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig
|
|
}
|
|
|
|
// Int64ObservableGauge is an instrument used to asynchronously record
|
|
// instantaneous int64 measurements once per collection cycle. Observations are
|
|
// only made within a callback for this instrument.
|
|
//
|
|
// Warning: Methods may be added to this interface in minor releases. See
|
|
// package documentation on API implementation for information on how to set
|
|
// default behavior for unimplemented methods.
|
|
type Int64ObservableGauge interface {
|
|
// Users of the interface can ignore this. This embedded type is only used
|
|
// by implementations of this interface. See the "API Implementations"
|
|
// section of the package documentation for more information.
|
|
embedded.Int64ObservableGauge
|
|
|
|
Int64Observable
|
|
}
|
|
|
|
// Int64ObservableGaugeConfig contains options for asynchronous counter
|
|
// instruments that record int64 values.
|
|
type Int64ObservableGaugeConfig struct {
|
|
description string
|
|
unit string
|
|
callbacks []Int64Callback
|
|
}
|
|
|
|
// NewInt64ObservableGaugeConfig returns a new [Int64ObservableGaugeConfig]
|
|
// with all opts applied.
|
|
func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig {
|
|
var config Int64ObservableGaugeConfig
|
|
for _, o := range opts {
|
|
if _, ok := o.(experimentalOption); ok {
|
|
continue
|
|
}
|
|
config = o.applyInt64ObservableGauge(config)
|
|
}
|
|
return config
|
|
}
|
|
|
|
// Description returns the configured description.
|
|
func (c Int64ObservableGaugeConfig) Description() string {
|
|
return c.description
|
|
}
|
|
|
|
// Unit returns the configured unit.
|
|
func (c Int64ObservableGaugeConfig) Unit() string {
|
|
return c.unit
|
|
}
|
|
|
|
// Callbacks returns the configured callbacks.
|
|
func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback {
|
|
return c.callbacks
|
|
}
|
|
|
|
// Int64ObservableGaugeOption applies options to a
|
|
// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and
|
|
// [InstrumentOption] for other options that can be used as an
|
|
// Int64ObservableGaugeOption.
|
|
type Int64ObservableGaugeOption interface {
|
|
applyInt64ObservableGauge(Int64ObservableGaugeConfig) Int64ObservableGaugeConfig
|
|
}
|
|
|
|
// Int64Observer is a recorder of int64 measurements.
|
|
//
|
|
// Warning: Methods may be added to this interface in minor releases. See
|
|
// package documentation on API implementation for information on how to set
|
|
// default behavior for unimplemented methods.
|
|
type Int64Observer interface {
|
|
// Users of the interface can ignore this. This embedded type is only used
|
|
// by implementations of this interface. See the "API Implementations"
|
|
// section of the package documentation for more information.
|
|
embedded.Int64Observer
|
|
|
|
// Observe records the int64 value.
|
|
//
|
|
// Use the WithAttributeSet (or, if performance is not a concern,
|
|
// the WithAttributes) option to include measurement attributes.
|
|
//
|
|
// Implementations of this method need to be safe for a user to call
|
|
// concurrently.
|
|
Observe(value int64, options ...ObserveOption)
|
|
}
|
|
|
|
// Int64Callback is a function registered with a Meter that makes observations
|
|
// for an Int64Observable instrument it is registered with. Calls to the
|
|
// Int64Observer record measurement values for the Int64Observable.
|
|
//
|
|
// The function needs to complete in a finite amount of time and the deadline
|
|
// of the passed context is expected to be honored.
|
|
//
|
|
// The function needs to make unique observations across all registered
|
|
// Int64Callbacks. Meaning, it should not report measurements with the same
|
|
// attributes as another Int64Callbacks also registered for the same
|
|
// instrument.
|
|
//
|
|
// The function needs to be reentrant and concurrent safe.
|
|
//
|
|
// Note that Go's mutexes are not reentrant, and locking a mutex takes
|
|
// an indefinite amount of time. It is therefore advised to avoid
|
|
// using mutexes inside callbacks.
|
|
type Int64Callback func(context.Context, Int64Observer) error
|
|
|
|
// Int64ObservableOption applies options to int64 Observer instruments.
|
|
type Int64ObservableOption interface {
|
|
Int64ObservableCounterOption
|
|
Int64ObservableUpDownCounterOption
|
|
Int64ObservableGaugeOption
|
|
}
|
|
|
|
type int64CallbackOpt struct {
|
|
cback Int64Callback
|
|
}
|
|
|
|
func (o int64CallbackOpt) applyInt64ObservableCounter(cfg Int64ObservableCounterConfig) Int64ObservableCounterConfig {
|
|
cfg.callbacks = append(cfg.callbacks, o.cback)
|
|
return cfg
|
|
}
|
|
|
|
func (o int64CallbackOpt) applyInt64ObservableUpDownCounter(
|
|
cfg Int64ObservableUpDownCounterConfig,
|
|
) Int64ObservableUpDownCounterConfig {
|
|
cfg.callbacks = append(cfg.callbacks, o.cback)
|
|
return cfg
|
|
}
|
|
|
|
func (o int64CallbackOpt) applyInt64ObservableGauge(cfg Int64ObservableGaugeConfig) Int64ObservableGaugeConfig {
|
|
cfg.callbacks = append(cfg.callbacks, o.cback)
|
|
return cfg
|
|
}
|
|
|
|
// WithInt64Callback adds callback to be called for an instrument.
|
|
func WithInt64Callback(callback Int64Callback) Int64ObservableOption {
|
|
return int64CallbackOpt{callback}
|
|
}
|