Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractMetricDesc(metric prometheus.Metric) (string, error)
- func ExtractMetricValue(counterOrGauge prometheus.Metric) (float64, error)
- func GetEnvVarName(prefix, fName string) (envVar string)
- func GetSharedLease(ctx context.Context, conn *pgx.Conn, id int64) error
- func HistogramBucketsSaturating(start float64, factor float64, max float64) []float64
- func IsTimescaleDBInstalled(conn pgxconn.PgxConn) bool
- func LabelToPrompbLabels(l labels.Labels) []prompb.Label
- func ParseEnv(p string, fs *flag.FlagSet) error
- func Pointer[T any](x T) *T
- type AdvisoryLock
- type AfterConnectFunc
- type ManualTicker
- type PgAdvisoryLock
- func (l *PgAdvisoryLock) Close()
- func (l *PgAdvisoryLock) Conn() (*pgx.Conn, error)
- func (l *PgAdvisoryLock) GetAdvisoryLock() (bool, error)
- func (l *PgAdvisoryLock) GetSharedAdvisoryLock() (bool, error)
- func (l *PgAdvisoryLock) Unlock() (bool, error)
- func (l *PgAdvisoryLock) UnlockShared() (bool, error)
- type Ticker
Constants ¶
const PromNamespace = "promscale"
Variables ¶
Functions ¶
func ExtractMetricDesc ¶
func ExtractMetricDesc(metric prometheus.Metric) (string, error)
func ExtractMetricValue ¶
func ExtractMetricValue(counterOrGauge prometheus.Metric) (float64, error)
func GetEnvVarName ¶
GetEnvVarName returns the name of the environment variable used for setting the configuration flag based on a prefix and flag name.
func HistogramBucketsSaturating ¶
returns a exponential histogram for a saturating metric. Grows exponentially until max-10, and has another bucket for max. This is done so we can tell from the histogram if the resource was saturated or not.
func IsTimescaleDBInstalled ¶
func ParseEnv ¶
ParseEnv takes a prefix string p and *flag.FlagSet. Each flag in the FlagSet is exposed as an upper case environment variable prefixed with p. Any flag that was not explicitly set by a user is updated to the environment variable, if set.
Note: when run with multiple times with different prefixes on the same FlagSet, precedence will get values set with prefix which is parsed first.
Types ¶
type AdvisoryLock ¶
type ManualTicker ¶
func NewManualTicker ¶
func NewManualTicker(channelSize int) *ManualTicker
func (*ManualTicker) Channel ¶
func (m *ManualTicker) Channel() <-chan time.Time
func (*ManualTicker) Stop ¶
func (m *ManualTicker) Stop()
func (*ManualTicker) Tick ¶
func (m *ManualTicker) Tick()
func (*ManualTicker) Wait ¶
func (m *ManualTicker) Wait()
type PgAdvisoryLock ¶
type PgAdvisoryLock struct {
// contains filtered or unexported fields
}
func NewPgAdvisoryLock ¶
func NewPgAdvisoryLock(groupLockID int64, connStr string) (*PgAdvisoryLock, error)
NewPgAdvisoryLock creates a new instance with specified lock ID, connection pool and lock timeout.
func (*PgAdvisoryLock) GetAdvisoryLock ¶
func (l *PgAdvisoryLock) GetAdvisoryLock() (bool, error)
func (*PgAdvisoryLock) GetSharedAdvisoryLock ¶
func (l *PgAdvisoryLock) GetSharedAdvisoryLock() (bool, error)
func (*PgAdvisoryLock) Unlock ¶
func (l *PgAdvisoryLock) Unlock() (bool, error)
func (*PgAdvisoryLock) UnlockShared ¶
func (l *PgAdvisoryLock) UnlockShared() (bool, error)