Documentation ¶
Index ¶
- func ParseDuration(s string) (time.Duration, error)
- func ParseTimeAt(s string, currentTimestamp int64) (int64, error)
- func ParseTimeMsec(s string) (int64, error)
- func PutLabels(x *Labels)
- type Duration
- type Labels
- func (x *Labels) Add(name, value string)
- func (x *Labels) AddFrom(src *Labels)
- func (x *Labels) Clone() *Labels
- func (x *Labels) Get(name string) string
- func (x *Labels) GetLabels() []prompbmarshal.Label
- func (x *Labels) InitFromMap(m map[string]string)
- func (x *Labels) InternStrings()
- func (x *Labels) Len() int
- func (x *Labels) Less(i, j int) bool
- func (x *Labels) MarshalJSON() ([]byte, error)
- func (x *Labels) MarshalYAML() (any, error)
- func (x *Labels) RemoveDuplicates()
- func (x *Labels) RemoveLabelsWithDoubleUnderscorePrefix()
- func (x *Labels) RemoveMetaLabels()
- func (x *Labels) Reset()
- func (x *Labels) Set(name, value string)
- func (x *Labels) Sort()
- func (x *Labels) SortStable()
- func (x *Labels) String() string
- func (x *Labels) Swap(i, j int)
- func (x *Labels) ToMap() map[string]string
- func (x *Labels) UnmarshalJSON(data []byte) error
- func (x *Labels) UnmarshalYAML(unmarshal func(any) error) error
- type LabelsCompressor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseDuration ¶
ParseDuration parses duration string in Prometheus format
func ParseTimeAt ¶
ParseTimeAt parses time s in different formats, assuming the given currentTimestamp.
See https://docs.victoriametrics.com/single-server-victoriametrics/#timestamp-formats
If s doesn't contain timezone information, then the local timezone is used.
It returns unix timestamp in nanoseconds.
func ParseTimeMsec ¶
ParseTimeMsec parses time s in different formats.
See https://docs.victoriametrics.com/single-server-victoriametrics/#timestamp-formats
It returns unix timestamp in milliseconds.
Types ¶
type Duration ¶
Duration is duration, which must be used in Prometheus-compatible yaml configs.
func NewDuration ¶
NewDuration returns Duration for given d.
func (Duration) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler interface.
type Labels ¶
type Labels struct {
Labels []prompbmarshal.Label
}
Labels contains Prometheus labels.
func GetLabels ¶
func GetLabels() *Labels
GetLabels returns and empty Labels instance from the pool.
The returned Labels instance must be returned to pool via PutLabels() when no longer needed.
func MustNewLabelsFromString ¶
MustNewLabelsFromString creates labels from s, which can have the form `metric{labels}`.
This function must be used only in tests. Use NewLabelsFromString in production code.
func NewLabelsFromMap ¶
NewLabelsFromMap returns Labels generated from m.
func NewLabelsFromString ¶
NewLabelsFromString creates labels from s, which can have the form `metric{labels}`.
This function must be used only in non performance-critical code, since it allocates too much
func (*Labels) GetLabels ¶
func (x *Labels) GetLabels() []prompbmarshal.Label
GetLabels returns the list of labels from x.
func (*Labels) InitFromMap ¶
InitFromMap initializes x from m.
func (*Labels) InternStrings ¶
func (x *Labels) InternStrings()
InternStrings interns all the strings used in x labels.
func (*Labels) MarshalJSON ¶
MarshalJSON returns JSON representation for x.
func (*Labels) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler interface.
func (*Labels) RemoveDuplicates ¶
func (x *Labels) RemoveDuplicates()
RemoveDuplicates removes labels with duplicate names.
func (*Labels) RemoveLabelsWithDoubleUnderscorePrefix ¶
func (x *Labels) RemoveLabelsWithDoubleUnderscorePrefix()
RemoveLabelsWithDoubleUnderscorePrefix removes labels with "__" prefix from x.
func (*Labels) RemoveMetaLabels ¶
func (x *Labels) RemoveMetaLabels()
RemoveMetaLabels removes all the `__meta_` labels from x.
See https://www.robustperception.io/life-of-a-label for details.
func (*Labels) Set ¶
Set label value for label with given name If the label with the given name doesn't exist, it adds as the new label
func (*Labels) Sort ¶
func (x *Labels) Sort()
Sort sorts x labels in alphabetical order of their names.
func (*Labels) SortStable ¶
func (x *Labels) SortStable()
SortStable sorts x labels in alphabetical order of their name using stable sort.
func (*Labels) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON from data.
type LabelsCompressor ¶
type LabelsCompressor struct {
// contains filtered or unexported fields
}
LabelsCompressor compresses []prompbmarshal.Label into short binary strings
func (*LabelsCompressor) Compress ¶
func (lc *LabelsCompressor) Compress(dst []byte, labels []prompbmarshal.Label) []byte
Compress compresses labels, appends the compressed labels to dst and returns the result.
It is safe calling Compress from concurrent goroutines.
func (*LabelsCompressor) Decompress ¶
func (lc *LabelsCompressor) Decompress(dst []prompbmarshal.Label, src []byte) []prompbmarshal.Label
Decompress decompresses src into []prompbmarshal.Label, appends it to dst and returns the result.
It is safe calling Decompress from concurrent goroutines.
func (*LabelsCompressor) ItemsCount ¶
func (lc *LabelsCompressor) ItemsCount() uint64
ItemsCount returns the number of items in lc
func (*LabelsCompressor) SizeBytes ¶
func (lc *LabelsCompressor) SizeBytes() uint64
SizeBytes returns the size of lc data in bytes