Documentation
¶
Overview ¶
Package common provides general utility helper functions and types
Index ¶
- func ComputeExternalURL(u, listenAddr string) (*url.URL, error)
- func GenerateKey(url string) uint64
- func GetFreePort() (int, *net.TCPListener, error)
- func GetUUIDFromString(stringSlice []string) (string, error)
- func MakeConfig[T any](filePath string) (*T, error)
- func NewGrafanaClient(config *GrafanaWebConfig, logger log.Logger) (*grafana.Grafana, error)
- func Round(value int64, nearest int64) int64
- func SanitizeFloat(v float64) float64
- func TimeTrack(start time.Time, name string, logger log.Logger)
- type GrafanaWebConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeExternalURL ¶
ComputeExternalURL computes a sanitized external URL from a raw input. It infers unset URL parts from the OS and the given listen address.
func GenerateKey ¶ added in v0.2.0
GenerateKey generates a reproducible key from a given URL string.
func GetFreePort ¶
func GetFreePort() (int, *net.TCPListener, error)
GetFreePort in this case makes the closing of the listener the responsibility of the caller to allow for a guarantee that multiple random port allocations don't collide.
func GetUUIDFromString ¶
GetUUIDFromString returns a UUID5 for given slice of strings.
func MakeConfig ¶
MakeConfig reads config file, merges with passed default config and returns updated config instance.
func NewGrafanaClient ¶ added in v0.2.0
NewGrafanaClient instantiates a new instance of Grafana client.
func Round ¶ added in v0.2.0
Round returns a value less than or equal to value that is multiple of nearest.
func SanitizeFloat ¶
SanitizeFloat replaces +/-Inf and NaN with zero.
Types ¶
type GrafanaWebConfig ¶
type GrafanaWebConfig struct { URL string `yaml:"url"` TeamsIDs []string `yaml:"teams_ids"` HTTPClientConfig config_util.HTTPClientConfig `yaml:",inline"` }
GrafanaWebConfig makes HTTP Grafana config.