Documentation ¶
Index ¶
- func CamelToSnake(str string) string
- func CompareYAML(a, b interface{}) bool
- func CompareYAMLWithHook(a, b interface{}, ...) bool
- func DefaultConfigFromFlags(cfg interface{}) interface{}
- func EnableOtelFeatureGates(fgNames ...string) error
- func Eventually(t require.TestingT, check func(t require.TestingT))
- func EventuallyWithBackoff(t require.TestingT, check func(t require.TestingT), bc backoff.Config)
- func MarshalYAMLMerged(vv ...interface{}) ([]byte, error)
- func MustRegisterOrGet(reg prometheus.Registerer, c prometheus.Collector) prometheus.Collector
- func SetupFlowModeOtelFeatureGates() error
- func SetupStaticModeOtelFeatureGates() error
- func TestFlowLogger(t require.TestingT) *logging.Logger
- func TestLogger(t testing.TB) log.Logger
- func UnmarshalYAMLMerged(bb []byte, vv ...interface{}) error
- func Untab(s string) string
- type ConfigFlags
- type PrefixedConfigFlags
- type RawYAML
- type UncheckedCollector
- type Unregisterer
- type WaitTrigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelToSnake ¶ added in v0.22.9
CamelToSnake is a helper function for converting CamelCase to Snake Case
func CompareYAML ¶ added in v0.14.0
func CompareYAML(a, b interface{}) bool
CompareYAML marshals a and b to YAML and ensures that their contents are equal. If either Marshal fails, CompareYAML returns false.
func CompareYAMLWithHook ¶ added in v0.30.0
func CompareYAMLWithHook(a, b interface{}, hook func(in interface{}) (ok bool, out interface{}, err error)) bool
CompareYAMLWithHook marshals both a and b to YAML and checks the results for equality, allowing for a hook to define custom marshaling behavior. If either Marshal fails, CompareYAMLWithHook returns false.
func DefaultConfigFromFlags ¶
func DefaultConfigFromFlags(cfg interface{}) interface{}
DefaultConfigFromFlags will load default values into cfg by retrieving default values that are registered as flags.
cfg must implement either PrefixedConfigFlags or ConfigFlags.
func EnableOtelFeatureGates ¶ added in v0.37.0
Enables a set of feature gates in Otel's Global Feature Gate Registry.
func Eventually ¶ added in v0.31.0
Eventually calls the check function several times until it doesn't report an error. Failing the test in the t provided to check does not fail the test until the provided backoff.Config is out of retries.
func EventuallyWithBackoff ¶ added in v0.33.0
func MarshalYAMLMerged ¶ added in v0.22.0
MarshalYAMLMerged marshals all values from vv into a single object.
func MustRegisterOrGet ¶ added in v0.38.0
func MustRegisterOrGet(reg prometheus.Registerer, c prometheus.Collector) prometheus.Collector
MustRegisterOrGet will attempt to register the supplied collector into the register. If it's already registered, it will return that one. In case that the register procedure fails with something other than already registered, this will panic.
func SetupFlowModeOtelFeatureGates ¶ added in v0.37.0
func SetupFlowModeOtelFeatureGates() error
Enables a set of feature gates which should always be enabled for Flow mode.
func SetupStaticModeOtelFeatureGates ¶ added in v0.37.0
func SetupStaticModeOtelFeatureGates() error
Enables a set of feature gates which should always be enabled for Static mode.
func TestFlowLogger ¶ added in v0.33.0
TestFlowLogger generates a Flow-compatible logger for a test.
func TestLogger ¶ added in v0.14.0
TestLogger generates a logger for a test.
func UnmarshalYAMLMerged ¶ added in v0.22.0
UnmarshalYAMLMerged performs a strict unmarshal of bb into all values from vv.
Types ¶
type ConfigFlags ¶
ConfigFlags is an interface that will register flags that can control some object.
type PrefixedConfigFlags ¶
PrefixedConfigFlags is an interface that, given a prefix for flags and a flagset, will register flags that can control some object.
type RawYAML ¶ added in v0.22.0
type RawYAML []byte
RawYAML is similar to json.RawMessage and allows for deferred YAML decoding.
func (RawYAML) MarshalYAML ¶ added in v0.22.0
MarshalYAML implements yaml.Marshaler.
func (*RawYAML) UnmarshalYAML ¶ added in v0.22.0
UnmarshalYAML implements yaml.Unmarshaler.
type UncheckedCollector ¶ added in v0.33.1
type UncheckedCollector struct {
// contains filtered or unexported fields
}
UncheckedCollector is a prometheus.Collector which stores a set of unchecked metrics.
func NewUncheckedCollector ¶ added in v0.33.1
func NewUncheckedCollector(inner prometheus.Collector) *UncheckedCollector
NewUncheckedCollector creates a new UncheckedCollector. If inner is nil, UncheckedCollector returns no metrics.
func (*UncheckedCollector) Collect ¶ added in v0.33.1
func (uc *UncheckedCollector) Collect(ch chan<- prometheus.Metric)
Collector implements prometheus.Collector. If the UncheckedCollector has a non-nil inner collector, metrics will be collected from it.
func (*UncheckedCollector) Describe ¶ added in v0.33.1
func (uc *UncheckedCollector) Describe(_ chan<- *prometheus.Desc)
Describe implements prometheus.Collector, but is a no-op to be considered an "unchecked" collector by Prometheus. See prometheus.Collector for more information.
func (*UncheckedCollector) SetCollector ¶ added in v0.33.1
func (uc *UncheckedCollector) SetCollector(inner prometheus.Collector)
SetCollector replaces the inner collector.
type Unregisterer ¶ added in v0.13.0
type Unregisterer struct {
// contains filtered or unexported fields
}
Unregisterer is a Prometheus Registerer that can unregister all collectors passed to it.
func WrapWithUnregisterer ¶ added in v0.13.0
func WrapWithUnregisterer(reg prometheus.Registerer) *Unregisterer
WrapWithUnregisterer wraps a prometheus Registerer with capabilities to unregister all collectors.
func (*Unregisterer) MustRegister ¶ added in v0.13.0
func (u *Unregisterer) MustRegister(cs ...prometheus.Collector)
MustRegister implements prometheus.Registerer.
func (*Unregisterer) Register ¶ added in v0.13.0
func (u *Unregisterer) Register(c prometheus.Collector) error
Register implements prometheus.Registerer.
func (*Unregisterer) Unregister ¶ added in v0.13.0
func (u *Unregisterer) Unregister(c prometheus.Collector) bool
Unregister implements prometheus.Registerer.
func (*Unregisterer) UnregisterAll ¶ added in v0.13.0
func (u *Unregisterer) UnregisterAll() bool
UnregisterAll unregisters all collectors that were registered through the Registerer.
type WaitTrigger ¶ added in v0.22.0
type WaitTrigger struct {
// contains filtered or unexported fields
}
WaitTrigger allows for waiting for a specific condition to be met. Useful for tests.
func NewWaitTrigger ¶ added in v0.22.0
func NewWaitTrigger() *WaitTrigger
NewWaitTrigger creates a new WaitTrigger.
func (*WaitTrigger) Trigger ¶ added in v0.22.0
func (wt *WaitTrigger) Trigger()
Trigger completes the trigger and alerts all waiting. Calling Trigger again after the first invocation is a no-op.
func (*WaitTrigger) Wait ¶ added in v0.22.0
func (wt *WaitTrigger) Wait(timeout time.Duration) error
Wait waits for trigger to complete up to the specified timeout. Returns an error if the timeout expires.
func (*WaitTrigger) WaitContext ¶ added in v0.22.9
func (wt *WaitTrigger) WaitContext(ctx context.Context) error
WaitContext waits for trigger to complete or for the context to cancel. Returns an error if ctx gets canceled.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package k8s spins up a Kubernetes cluster for testing.
|
Package k8s spins up a Kubernetes cluster for testing. |
Package structwalk allows you to "walk" the hierarchy of a struct.
|
Package structwalk allows you to "walk" the hierarchy of a struct. |
Package subset implements functions to check if one value is a subset of another.
|
Package subset implements functions to check if one value is a subset of another. |
Package testappender exposes utilities to test code which writes to Prometheus storage.Appenders.
|
Package testappender exposes utilities to test code which writes to Prometheus storage.Appenders. |
Package zapadapter allows github.com/go-kit/log to be used as a Zap core.
|
Package zapadapter allows github.com/go-kit/log to be used as a Zap core. |