Documentation ¶
Index ¶
- Variables
- func ExtendSortedLabels(lset, extend labels.Labels) labels.Labels
- func HashWithPrefix(prefix string, lbls []ZLabel) uint64
- func LabelsToPromLabels(lset []Label) labels.Labels
- func PromLabelSetsToString(lsets []labels.Labels) string
- func ReAllocZLabelsStrings(lset *[]ZLabel)
- func ZLabelSetsToPromLabelSets(lss ...ZLabelSet) []labels.Labels
- func ZLabelsToPromLabels(lset []ZLabel) labels.Labels
- type Label
- func (*Label) Descriptor() ([]byte, []int)
- func (m *Label) Marshal() (dAtA []byte, err error)
- func (m *Label) MarshalTo(dAtA []byte) (int, error)
- func (m *Label) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Label) ProtoMessage()
- func (m *Label) Reset()
- func (m *Label) Size() (n int)
- func (m *Label) String() string
- func (m *Label) Unmarshal(dAtA []byte) error
- func (m *Label) XXX_DiscardUnknown()
- func (m *Label) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Label) XXX_Merge(src proto.Message)
- func (m *Label) XXX_Size() int
- func (m *Label) XXX_Unmarshal(b []byte) error
- type LabelSet
- func (*LabelSet) Descriptor() ([]byte, []int)
- func (m *LabelSet) Marshal() (dAtA []byte, err error)
- func (m *LabelSet) MarshalTo(dAtA []byte) (int, error)
- func (m *LabelSet) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*LabelSet) ProtoMessage()
- func (m *LabelSet) Reset()
- func (m *LabelSet) Size() (n int)
- func (m *LabelSet) String() string
- func (m *LabelSet) Unmarshal(dAtA []byte) error
- func (m *LabelSet) XXX_DiscardUnknown()
- func (m *LabelSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LabelSet) XXX_Merge(src proto.Message)
- func (m *LabelSet) XXX_Size() int
- func (m *LabelSet) XXX_Unmarshal(b []byte) error
- type ZLabel
- func (m *ZLabel) Compare(other ZLabel) int
- func (m *ZLabel) Equal(other ZLabel) bool
- func (m *ZLabel) Marshal() ([]byte, error)
- func (m *ZLabel) MarshalJSON() ([]byte, error)
- func (m *ZLabel) MarshalTo(data []byte) (int, error)
- func (m *ZLabel) MarshalToSizedBuffer(data []byte) (int, error)
- func (m *ZLabel) Size() (n int)
- func (m *ZLabel) Unmarshal(data []byte) error
- func (m *ZLabel) UnmarshalJSON(entry []byte) error
- type ZLabelSet
- func (*ZLabelSet) Descriptor() ([]byte, []int)
- func (m *ZLabelSet) Marshal() (dAtA []byte, err error)
- func (m *ZLabelSet) MarshalJSON() ([]byte, error)
- func (m *ZLabelSet) MarshalTo(dAtA []byte) (int, error)
- func (m *ZLabelSet) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (m *ZLabelSet) PromLabels() labels.Labels
- func (*ZLabelSet) ProtoMessage()
- func (m *ZLabelSet) Reset()
- func (m *ZLabelSet) Size() (n int)
- func (m *ZLabelSet) String() string
- func (m *ZLabelSet) Unmarshal(dAtA []byte) error
- func (m *ZLabelSet) UnmarshalJSON(entry []byte) error
- func (m *ZLabelSet) XXX_DiscardUnknown()
- func (m *ZLabelSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ZLabelSet) XXX_Merge(src proto.Message)
- func (m *ZLabelSet) XXX_Size() int
- func (m *ZLabelSet) XXX_Unmarshal(b []byte) error
- type ZLabelSets
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ExtendSortedLabels ¶ added in v0.18.0
ExtendSortedLabels extend given labels by extend in labels format. The type conversion is done safely, which means we don't modify extend labels underlying array.
In case of existing labels already present in given label set, it will be overwritten by external one. NOTE: Labels and extend has to be sorted.
func HashWithPrefix ¶ added in v0.20.0
HashWithPrefix returns a hash for the given prefix and labels.
func LabelsToPromLabels ¶
LabelsToPromLabels convert slice of labelpb.ZLabel to Prometheus labels in type unsafe manner. It reuses the same memory. Caller should abort using passed []Label.
func PromLabelSetsToString ¶
func ReAllocZLabelsStrings ¶ added in v0.19.0
func ReAllocZLabelsStrings(lset *[]ZLabel)
ReAllocZLabelsStrings re-allocates all underlying bytes for string, detaching it from bigger memory pool.
func ZLabelSetsToPromLabelSets ¶ added in v0.17.0
ZLabelSetsToPromLabelSets converts slice of labelpb.ZLabelSet to slice of Prometheus labels.
func ZLabelsToPromLabels ¶ added in v0.17.0
ZLabelsToPromLabels convert slice of labelpb.ZLabel to Prometheus labels in type unsafe manner. It reuses the same memory. Caller should abort using passed []ZLabel. NOTE: Use with care. ZLabels holds memory from the whole protobuf unmarshal, so the returned Prometheus Labels will hold this memory as well.
Types ¶
type Label ¶
type Label struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` }
func LabelsFromPromLabels ¶
LabelsFromPromLabels converts Prometheus labels to slice of labelpb.ZLabel in type unsafe manner. It reuses the same memory. Caller should abort using passed labels.Labels.
func (*Label) Descriptor ¶ added in v0.17.0
func (*Label) MarshalToSizedBuffer ¶ added in v0.17.0
func (*Label) ProtoMessage ¶ added in v0.17.0
func (*Label) ProtoMessage()
func (*Label) XXX_DiscardUnknown ¶ added in v0.17.0
func (m *Label) XXX_DiscardUnknown()
func (*Label) XXX_Marshal ¶ added in v0.17.0
func (*Label) XXX_Unmarshal ¶ added in v0.17.0
type LabelSet ¶
type LabelSet struct {
Labels []Label `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels"`
}
func (*LabelSet) Descriptor ¶
func (*LabelSet) MarshalToSizedBuffer ¶
func (*LabelSet) ProtoMessage ¶
func (*LabelSet) ProtoMessage()
func (*LabelSet) XXX_DiscardUnknown ¶
func (m *LabelSet) XXX_DiscardUnknown()
func (*LabelSet) XXX_Marshal ¶
func (*LabelSet) XXX_Unmarshal ¶
type ZLabel ¶ added in v0.17.0
type ZLabel Label
ZLabel is a Label (also easily transformable to Prometheus labels.Labels) that can be unmarshalled from protobuf reusing the same memory address for string bytes. NOTE: While unmarshalling it uses exactly same bytes that were allocated for protobuf. This mean that *whole* protobuf bytes will be not GC-ed as long as ZLabels are referenced somewhere. Use it carefully, only for short living protobuf message processing.
func ZLabelsFromPromLabels ¶ added in v0.17.0
ZLabelsFromPromLabels converts Prometheus labels to slice of labelpb.ZLabel in type unsafe manner. It reuses the same memory. Caller should abort using passed labels.Labels.
func (*ZLabel) MarshalJSON ¶ added in v0.17.0
func (*ZLabel) MarshalToSizedBuffer ¶ added in v0.17.0
func (*ZLabel) Unmarshal ¶ added in v0.17.0
Unmarshal unmarshalls gRPC protobuf into ZLabel struct. ZLabel string is directly using bytes passed in `data`. To use it add (gogoproto.customtype) = "github.com/thanos-io/thanos/pkg/store/labelpb.ZLabel" to proto field tag. NOTE: This exists in internal Google protobuf implementation, but not in open source one: https://news.ycombinator.com/item?id=23588882
func (*ZLabel) UnmarshalJSON ¶ added in v0.17.0
type ZLabelSet ¶ added in v0.17.0
type ZLabelSet struct {
Labels []ZLabel `protobuf:"bytes,1,rep,name=labels,proto3,customtype=ZLabel" json:"labels"`
}
func (*ZLabelSet) Descriptor ¶ added in v0.17.0
func (*ZLabelSet) MarshalJSON ¶ added in v0.17.0
func (*ZLabelSet) MarshalToSizedBuffer ¶ added in v0.17.0
func (*ZLabelSet) PromLabels ¶ added in v0.17.0
PromLabels return Prometheus labels.Labels without extra allocation.
func (*ZLabelSet) ProtoMessage ¶ added in v0.17.0
func (*ZLabelSet) ProtoMessage()
func (*ZLabelSet) UnmarshalJSON ¶ added in v0.17.0
func (*ZLabelSet) XXX_DiscardUnknown ¶ added in v0.17.0
func (m *ZLabelSet) XXX_DiscardUnknown()
func (*ZLabelSet) XXX_Marshal ¶ added in v0.17.0
func (*ZLabelSet) XXX_Unmarshal ¶ added in v0.17.0
type ZLabelSets ¶ added in v0.17.1
type ZLabelSets []ZLabelSet
ZLabelSets is a sortable list of ZLabelSet. It assumes the label pairs in each ZLabelSet element are already sorted.
func (ZLabelSets) Len ¶ added in v0.17.1
func (z ZLabelSets) Len() int
func (ZLabelSets) Less ¶ added in v0.17.1
func (z ZLabelSets) Less(i, j int) bool
func (ZLabelSets) Swap ¶ added in v0.17.1
func (z ZLabelSets) Swap(i, j int)