ckey

package
v0.0.0-...-dca2ff9 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b ContextKey) int

Compare returns an integer comparing two strings lexicographically. The result will be 0 if a==b, -1 if a < b, and +1 if a > b.

Types

type ContextKey

type ContextKey [byteSize8]uint64

ContextKey is a non-cryptographic hash that allows to aggregate metrics from a same context together.

This implementation has been designed to remove all heap allocations from the intake to reduce GC pressure on high volumes.

It uses the 128bit murmur3 hash, that is already successfully used on other products. 128bit is probably overkill for avoiding collisions, but it's better to err on the safe side, as we do not have a collision mitigation mechanism.

func (ContextKey) IsZero

func (k ContextKey) IsZero() bool

IsZero returns true if the key is at zero value

type KeyGenerator

type KeyGenerator struct {
	// contains filtered or unexported fields
}

KeyGenerator generates key Not safe for concurrent usage

func NewKeyGenerator

func NewKeyGenerator() *KeyGenerator

NewKeyGenerator creates a new key generator

func (*KeyGenerator) Generate

func (g *KeyGenerator) Generate(name, hostname string, tags []string) ContextKey

Generate returns the ContextKey hash for the given parameters. The tags array is sorted in place to avoid heap allocations.

Jump to

Keyboard shortcuts

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