util

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyLibrdkafkaConf

func ApplyLibrdkafkaConf(config map[string]string, configMap *kafka.ConfigMap) error

ApplyLibrdkafkaConf overlays librdkafka config values from the provided firebolt config onto the consumer config; in the firebolt config these should be key prefixed with 'librdkafka.' and here we remove the prefix and pass 'em through https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md

func BuildInstanceID

func BuildInstanceID() string

BuildInstanceID creates a unique ID for this instance of the running application by appending the host IP address and a random string.

func GetCounterValue

func GetCounterValue(counter prometheus.Counter) (float64, error)

GetCounterValue fetches the current value of a prometheus counter. This is inherently racy and intended for test use only.

func GetCounterVecValue

func GetCounterVecValue(counterVec *prometheus.CounterVec, lvs ...string) (float64, error)

GetCounterVecValue fetches the current value of a prometheus contervec for the passed label values. This is inherently racy and intended for test use only.

func GetGaugeValue

func GetGaugeValue(gauge prometheus.Gauge) (float64, error)

GetGaugeValue fetches the current value of a prometheus gauge. This is inherently racy and intended for test use only.

func GetGaugeVecValue

func GetGaugeVecValue(gaugeVec *prometheus.GaugeVec, lvs ...string) (float64, error)

GetGaugeVecValue fetches the current value of a prometheus gaugevec for the passed label values. This is inherently racy and intended for test use only.

func GetIPAddress

func GetIPAddress() (string, error)

GetIPAddress finds and returns the first non-loopback IP address formatted as a string.

func RandString

func RandString(n int) string

RandString creates and returns a pseudorandom string from randAlphabet of length n.

Types

type Condition

type Condition func() bool

Condition is a function that returns a boolean indicating whether to stop waiting

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL