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() (interface{}, 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(interface{}) 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 ¶ added in v1.91.0
ParseTimeAt parses time s in different formats, assuming the given currentTimestamp.
See https://docs.victoriametrics.com/single-server-victoriametrics/#timestamp-formats
It returns unix timestamp in nanoseconds.
func ParseTimeMsec ¶ added in v1.97.3
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.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler interface.
type Labels ¶ added in v1.85.0
type Labels struct {
Labels []prompbmarshal.Label
}
Labels contains Prometheus labels.
func GetLabels ¶ added in v1.85.0
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 ¶ added in v1.85.0
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 ¶ added in v1.85.0
NewLabelsFromMap returns Labels generated from m.
func NewLabelsFromString ¶ added in v1.85.0
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 ¶ added in v1.85.0
func (x *Labels) GetLabels() []prompbmarshal.Label
GetLabels returns the list of labels from x.
func (*Labels) InitFromMap ¶ added in v1.85.0
InitFromMap initializes x from m.
func (*Labels) InternStrings ¶ added in v1.85.0
func (x *Labels) InternStrings()
InternStrings interns all the strings used in x labels.
func (*Labels) MarshalJSON ¶ added in v1.85.0
MarshalJSON returns JSON representation for x.
func (*Labels) MarshalYAML ¶ added in v1.85.0
MarshalYAML implements yaml.Marshaler interface.
func (*Labels) RemoveDuplicates ¶ added in v1.85.0
func (x *Labels) RemoveDuplicates()
RemoveDuplicates removes labels with duplicate names.
func (*Labels) RemoveLabelsWithDoubleUnderscorePrefix ¶ added in v1.85.0
func (x *Labels) RemoveLabelsWithDoubleUnderscorePrefix()
RemoveLabelsWithDoubleUnderscorePrefix removes labels with "__" prefix from x.
func (*Labels) RemoveMetaLabels ¶ added in v1.85.0
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 ¶ added in v1.90.0
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 ¶ added in v1.85.0
func (x *Labels) Sort()
Sort sorts x labels in alphabetical order of their names.
func (*Labels) SortStable ¶ added in v1.85.0
func (x *Labels) SortStable()
SortStable sorts x labels in alphabetical order of their name using stable sort.
func (*Labels) UnmarshalJSON ¶ added in v1.85.0
UnmarshalJSON unmarshals JSON from data.
func (*Labels) UnmarshalYAML ¶ added in v1.85.0
UnmarshalYAML implements yaml.Unmarshaler interface.
type LabelsCompressor ¶ added in v1.97.7
type LabelsCompressor struct {
// contains filtered or unexported fields
}
LabelsCompressor compresses []prompbmarshal.Label into short binary strings
func (*LabelsCompressor) Compress ¶ added in v1.97.7
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 ¶ added in v1.97.7
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 ¶ added in v1.97.7
func (lc *LabelsCompressor) ItemsCount() uint64
ItemsCount returns the number of items in lc
func (*LabelsCompressor) SizeBytes ¶ added in v1.97.7
func (lc *LabelsCompressor) SizeBytes() uint64
SizeBytes returns the size of lc data in bytes