sketchpb

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IndexMapping_Interpolation_name = map[int32]string{
	0: "NONE",
	1: "LINEAR",
	2: "QUADRATIC",
	3: "CUBIC",
}
View Source
var IndexMapping_Interpolation_value = map[string]int32{
	"NONE":      0,
	"LINEAR":    1,
	"QUADRATIC": 2,
	"CUBIC":     3,
}

Functions

This section is empty.

Types

type DDSketch

type DDSketch struct {
	// The mapping between positive values and the bin indexes they belong to.
	Mapping *IndexMapping `protobuf:"bytes,1,opt,name=mapping,proto3" json:"mapping,omitempty"`
	// The store for keeping track of positive values.
	PositiveValues *Store `protobuf:"bytes,2,opt,name=positiveValues,proto3" json:"positiveValues,omitempty"`
	// The store for keeping track of negative values. A negative value v is mapped using its positive opposite -v.
	NegativeValues *Store `protobuf:"bytes,3,opt,name=negativeValues,proto3" json:"negativeValues,omitempty"`
	// The count for the value zero and its close neighborhood (whose width depends on the mapping).
	ZeroCount            float64  `protobuf:"fixed64,4,opt,name=zeroCount,proto3" json:"zeroCount,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

A DDSketch is essentially a histogram that partitions the range of positive values into an infinite number of indexed bins whose size grows exponentially. It keeps track of the number of values (or possibly floating-point weights) added to each bin. Negative values are partitioned like positive values, symmetrically to zero. The value zero as well as its close neighborhood that would be mapped to extreme bin indexes is mapped to a specific counter.

func (*DDSketch) Descriptor

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

func (*DDSketch) GetMapping

func (m *DDSketch) GetMapping() *IndexMapping

func (*DDSketch) GetNegativeValues

func (m *DDSketch) GetNegativeValues() *Store

func (*DDSketch) GetPositiveValues

func (m *DDSketch) GetPositiveValues() *Store

func (*DDSketch) GetZeroCount

func (m *DDSketch) GetZeroCount() float64

func (*DDSketch) ProtoMessage

func (*DDSketch) ProtoMessage()

func (*DDSketch) Reset

func (m *DDSketch) Reset()

func (*DDSketch) String

func (m *DDSketch) String() string

func (*DDSketch) XXX_DiscardUnknown added in v1.4.0

func (m *DDSketch) XXX_DiscardUnknown()

func (*DDSketch) XXX_Marshal added in v1.4.0

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

func (*DDSketch) XXX_Merge added in v1.4.0

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

func (*DDSketch) XXX_Size added in v1.4.0

func (m *DDSketch) XXX_Size() int

func (*DDSketch) XXX_Unmarshal added in v1.4.0

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

type IndexMapping

type IndexMapping struct {
	// The gamma parameter of the mapping, such that bin index that a value v belongs to is roughly equal to
	// log(v)/log(gamma).
	Gamma float64 `protobuf:"fixed64,1,opt,name=gamma,proto3" json:"gamma,omitempty"`
	// An offset that can be used to shift all bin indexes.
	IndexOffset float64 `protobuf:"fixed64,2,opt,name=indexOffset,proto3" json:"indexOffset,omitempty"`
	// To speed up the computation of the index a value belongs to, the computation of the log may be approximated using
	// the fact that the log to the base 2 of powers of 2 can be computed at a low cost from the binary representation of
	// the input value. Other values can be approximated by interpolating between successive powers of 2 (linearly,
	// quadratically or cubically).
	// NONE means that the log is to be computed exactly (no interpolation).
	Interpolation        IndexMapping_Interpolation `protobuf:"varint,3,opt,name=interpolation,proto3,enum=IndexMapping_Interpolation" json:"interpolation,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                   `json:"-"`
	XXX_unrecognized     []byte                     `json:"-"`
	XXX_sizecache        int32                      `json:"-"`
}

How to map positive values to the bins they belong to.

func (*IndexMapping) Descriptor

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

func (*IndexMapping) GetGamma

func (m *IndexMapping) GetGamma() float64

func (*IndexMapping) GetIndexOffset

func (m *IndexMapping) GetIndexOffset() float64

func (*IndexMapping) GetInterpolation

func (m *IndexMapping) GetInterpolation() IndexMapping_Interpolation

func (*IndexMapping) ProtoMessage

func (*IndexMapping) ProtoMessage()

func (*IndexMapping) Reset

func (m *IndexMapping) Reset()

func (*IndexMapping) String

func (m *IndexMapping) String() string

func (*IndexMapping) XXX_DiscardUnknown added in v1.4.0

func (m *IndexMapping) XXX_DiscardUnknown()

func (*IndexMapping) XXX_Marshal added in v1.4.0

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

func (*IndexMapping) XXX_Merge added in v1.4.0

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

func (*IndexMapping) XXX_Size added in v1.4.0

func (m *IndexMapping) XXX_Size() int

func (*IndexMapping) XXX_Unmarshal added in v1.4.0

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

type IndexMapping_Interpolation

type IndexMapping_Interpolation int32
const (
	IndexMapping_NONE      IndexMapping_Interpolation = 0
	IndexMapping_LINEAR    IndexMapping_Interpolation = 1
	IndexMapping_QUADRATIC IndexMapping_Interpolation = 2
	IndexMapping_CUBIC     IndexMapping_Interpolation = 3
)

func (IndexMapping_Interpolation) EnumDescriptor

func (IndexMapping_Interpolation) EnumDescriptor() ([]byte, []int)

func (IndexMapping_Interpolation) String

type Store

type Store struct {
	// The bin counts, encoded sparsely.
	BinCounts map[int32]float64 `` /* 164-byte string literal not displayed */
	// The bin counts, encoded contiguously. The values of contiguousBinCounts are the counts for the bins of indexes
	// o, o+1, o+2, etc., where o is contiguousBinIndexOffset.
	ContiguousBinCounts      []float64 `protobuf:"fixed64,2,rep,packed,name=contiguousBinCounts,proto3" json:"contiguousBinCounts,omitempty"`
	ContiguousBinIndexOffset int32     `protobuf:"zigzag32,3,opt,name=contiguousBinIndexOffset,proto3" json:"contiguousBinIndexOffset,omitempty"`
	XXX_NoUnkeyedLiteral     struct{}  `json:"-"`
	XXX_unrecognized         []byte    `json:"-"`
	XXX_sizecache            int32     `json:"-"`
}

A Store maps bin indexes to their respective counts. Counts can be encoded sparsely using binCounts, but also in a contiguous way using contiguousBinCounts and contiguousBinIndexOffset. Given that non-empty bins are in practice usually contiguous or close to one another, the latter contiguous encoding method is usually more efficient than the sparse one. Both encoding methods can be used conjointly. If a bin appears in both the sparse and the contiguous encodings, its count value is the sum of the counts in each encodings.

func (*Store) Descriptor

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

func (*Store) GetBinCounts

func (m *Store) GetBinCounts() map[int32]float64

func (*Store) GetContiguousBinCounts

func (m *Store) GetContiguousBinCounts() []float64

func (*Store) GetContiguousBinIndexOffset

func (m *Store) GetContiguousBinIndexOffset() int32

func (*Store) ProtoMessage

func (*Store) ProtoMessage()

func (*Store) Reset

func (m *Store) Reset()

func (*Store) String

func (m *Store) String() string

func (*Store) XXX_DiscardUnknown added in v1.4.0

func (m *Store) XXX_DiscardUnknown()

func (*Store) XXX_Marshal added in v1.4.0

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

func (*Store) XXX_Merge added in v1.4.0

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

func (*Store) XXX_Size added in v1.4.0

func (m *Store) XXX_Size() int

func (*Store) XXX_Unmarshal added in v1.4.0

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

Jump to

Keyboard shortcuts

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