labelpb

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 13 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)

Functions

func ExtendSortedLabels added in v0.18.0

func ExtendSortedLabels(lset, extend labels.Labels) labels.Labels

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

func HashWithPrefix(prefix string, lbls []ZLabel) uint64

HashWithPrefix returns a hash for the given prefix and labels.

func LabelsToPromLabels

func LabelsToPromLabels(lset []Label) labels.Labels

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 PromLabelSetsToString(lsets []labels.Labels) string

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

func ZLabelSetsToPromLabelSets(lss ...ZLabelSet) []labels.Labels

ZLabelSetsToPromLabelSets converts slice of labelpb.ZLabelSet to slice of Prometheus labels.

func ZLabelsToPromLabels added in v0.17.0

func ZLabelsToPromLabels(lset []ZLabel) labels.Labels

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

func LabelsFromPromLabels(lset labels.Labels) []Label

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) Descriptor() ([]byte, []int)

func (*Label) Marshal added in v0.17.0

func (m *Label) Marshal() (dAtA []byte, err error)

func (*Label) MarshalTo added in v0.17.0

func (m *Label) MarshalTo(dAtA []byte) (int, error)

func (*Label) MarshalToSizedBuffer added in v0.17.0

func (m *Label) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Label) ProtoMessage added in v0.17.0

func (*Label) ProtoMessage()

func (*Label) Reset added in v0.17.0

func (m *Label) Reset()

func (*Label) Size added in v0.17.0

func (m *Label) Size() (n int)

func (*Label) String added in v0.17.0

func (m *Label) String() string

func (*Label) Unmarshal added in v0.17.0

func (m *Label) Unmarshal(dAtA []byte) error

func (*Label) XXX_DiscardUnknown added in v0.17.0

func (m *Label) XXX_DiscardUnknown()

func (*Label) XXX_Marshal added in v0.17.0

func (m *Label) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Label) XXX_Merge added in v0.17.0

func (m *Label) XXX_Merge(src proto.Message)

func (*Label) XXX_Size added in v0.17.0

func (m *Label) XXX_Size() int

func (*Label) XXX_Unmarshal added in v0.17.0

func (m *Label) XXX_Unmarshal(b []byte) error

type LabelSet

type LabelSet struct {
	Labels []Label `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels"`
}

func (*LabelSet) Descriptor

func (*LabelSet) Descriptor() ([]byte, []int)

func (*LabelSet) Marshal

func (m *LabelSet) Marshal() (dAtA []byte, err error)

func (*LabelSet) MarshalTo

func (m *LabelSet) MarshalTo(dAtA []byte) (int, error)

func (*LabelSet) MarshalToSizedBuffer

func (m *LabelSet) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*LabelSet) ProtoMessage

func (*LabelSet) ProtoMessage()

func (*LabelSet) Reset

func (m *LabelSet) Reset()

func (*LabelSet) Size

func (m *LabelSet) Size() (n int)

func (*LabelSet) String

func (m *LabelSet) String() string

func (*LabelSet) Unmarshal

func (m *LabelSet) Unmarshal(dAtA []byte) error

func (*LabelSet) XXX_DiscardUnknown

func (m *LabelSet) XXX_DiscardUnknown()

func (*LabelSet) XXX_Marshal

func (m *LabelSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LabelSet) XXX_Merge

func (m *LabelSet) XXX_Merge(src proto.Message)

func (*LabelSet) XXX_Size

func (m *LabelSet) XXX_Size() int

func (*LabelSet) XXX_Unmarshal

func (m *LabelSet) XXX_Unmarshal(b []byte) error

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 DeepCopy added in v0.17.0

func DeepCopy(lbls []ZLabel) []ZLabel

DeepCopy copies labels and each label's string to separate bytes.

func ZLabelsFromPromLabels added in v0.17.0

func ZLabelsFromPromLabels(lset labels.Labels) []ZLabel

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) Compare added in v0.17.0

func (m *ZLabel) Compare(other ZLabel) int

Compare implements proto.Comparer.

func (*ZLabel) Equal added in v0.17.0

func (m *ZLabel) Equal(other ZLabel) bool

Equal implements proto.Equaler.

func (*ZLabel) Marshal added in v0.17.0

func (m *ZLabel) Marshal() ([]byte, error)

func (*ZLabel) MarshalJSON added in v0.17.0

func (m *ZLabel) MarshalJSON() ([]byte, error)

func (*ZLabel) MarshalTo added in v0.17.0

func (m *ZLabel) MarshalTo(data []byte) (int, error)

func (*ZLabel) MarshalToSizedBuffer added in v0.17.0

func (m *ZLabel) MarshalToSizedBuffer(data []byte) (int, error)

func (*ZLabel) Size added in v0.17.0

func (m *ZLabel) Size() (n int)

Size implements proto.Sizer.

func (*ZLabel) Unmarshal added in v0.17.0

func (m *ZLabel) Unmarshal(data []byte) error

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

func (m *ZLabel) UnmarshalJSON(entry []byte) error

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) Descriptor() ([]byte, []int)

func (*ZLabelSet) Marshal added in v0.17.0

func (m *ZLabelSet) Marshal() (dAtA []byte, err error)

func (*ZLabelSet) MarshalJSON added in v0.17.0

func (m *ZLabelSet) MarshalJSON() ([]byte, error)

func (*ZLabelSet) MarshalTo added in v0.17.0

func (m *ZLabelSet) MarshalTo(dAtA []byte) (int, error)

func (*ZLabelSet) MarshalToSizedBuffer added in v0.17.0

func (m *ZLabelSet) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ZLabelSet) PromLabels added in v0.17.0

func (m *ZLabelSet) PromLabels() labels.Labels

PromLabels return Prometheus labels.Labels without extra allocation.

func (*ZLabelSet) ProtoMessage added in v0.17.0

func (*ZLabelSet) ProtoMessage()

func (*ZLabelSet) Reset added in v0.17.0

func (m *ZLabelSet) Reset()

func (*ZLabelSet) Size added in v0.17.0

func (m *ZLabelSet) Size() (n int)

func (*ZLabelSet) String added in v0.17.0

func (m *ZLabelSet) String() string

func (*ZLabelSet) Unmarshal added in v0.17.0

func (m *ZLabelSet) Unmarshal(dAtA []byte) error

func (*ZLabelSet) UnmarshalJSON added in v0.17.0

func (m *ZLabelSet) UnmarshalJSON(entry []byte) error

func (*ZLabelSet) XXX_DiscardUnknown added in v0.17.0

func (m *ZLabelSet) XXX_DiscardUnknown()

func (*ZLabelSet) XXX_Marshal added in v0.17.0

func (m *ZLabelSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ZLabelSet) XXX_Merge added in v0.17.0

func (m *ZLabelSet) XXX_Merge(src proto.Message)

func (*ZLabelSet) XXX_Size added in v0.17.0

func (m *ZLabelSet) XXX_Size() int

func (*ZLabelSet) XXX_Unmarshal added in v0.17.0

func (m *ZLabelSet) XXX_Unmarshal(b []byte) error

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL