Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DetShard ¶
type DetShard struct {
// contains filtered or unexported fields
}
DetShard implements Shard
func (*DetShard) GetAddress ¶
GetAddress returns the Shard's address in a usable form
func (*DetShard) GetHashesFor ¶ added in v1.20.0
GetHashesFor generates a number of hashShards for a given DetShard by repeatedly hashing the seed with itself. The intent is to generate a repeatable pseudo-random sequence.
type DeterministicSharder ¶
type DeterministicSharder struct { Config config.Config `inject:""` Logger logger.Logger `inject:""` Peers peer.Peers `inject:""` // contains filtered or unexported fields }
func (*DeterministicSharder) MyShard ¶
func (d *DeterministicSharder) MyShard() Shard
func (*DeterministicSharder) Start ¶
func (d *DeterministicSharder) Start() error
func (*DeterministicSharder) WhichShard ¶
func (d *DeterministicSharder) WhichShard(traceID string) Shard
func (*DeterministicSharder) WhichShardHashed ¶ added in v1.20.0
func (d *DeterministicSharder) WhichShardHashed(traceID string) Shard
WhichShardHashed calculates which shard we want by keeping a list of partitions. Each partition has a different hash value and a map from partition to a given shard. We take the traceID and calculate a hash for each partition, using the partition hash as the seed for the trace hash. Whichever one has the highest value is the partition we use, which determines the shard we use. This is O(N) where N is the number of partitions, but because we use an efficient hash, (as opposed to SHA1) it executes in 1 uSec for 50 partitions, so it works out to about the same cost as the legacy sharder.
func (*DeterministicSharder) WhichShardLegacy ¶ added in v1.20.0
func (d *DeterministicSharder) WhichShardLegacy(traceID string) Shard
WhichShardLegacy is the original sharding decider. It uses sha1, which is slow and not well-distributed, and also simply partitions the sharding space into N evenly-divided buckets, which means that on every change in shard count, half of the traces get reassigned (which leads to broken traces). We leave it here to avoid disrupting things and provide a fallback if needed, but the intent is eventually to delete this.
type Shard ¶
type Shard interface { Equals(Shard) bool // GetAddress returns a string suitable for use in building a URL, eg // http://refinery-1234:8080 or https://10.2.3.4 GetAddress() string }
Shard represents a single instance of Refinery.
type Sharder ¶
type Sharder interface { // MyShard returns the Shard representing this process MyShard() Shard // WhichShard takes in a trace ID as input and returns the shard responsible // for that trace ID WhichShard(string) Shard }
Sharder is for determining which shard should handle a specific trace ID
type SingleServerSharder ¶
func (*SingleServerSharder) MyShard ¶
func (s *SingleServerSharder) MyShard() Shard
func (*SingleServerSharder) WhichShard ¶
func (s *SingleServerSharder) WhichShard(traceID string) Shard
type SingleShard ¶
type SingleShard string
SingleShard implements the Shard interface
func (*SingleShard) Equals ¶
func (s *SingleShard) Equals(other Shard) bool
func (*SingleShard) GetAddress ¶
func (s *SingleShard) GetAddress() string
GetAddress will never be used because every shard is my shard
type SortableShardList ¶
type SortableShardList []*DetShard
func (SortableShardList) Equals ¶
func (s SortableShardList) Equals(other SortableShardList) bool
func (SortableShardList) Len ¶
func (s SortableShardList) Len() int
func (SortableShardList) Less ¶
func (s SortableShardList) Less(i, j int) bool
func (SortableShardList) Swap ¶
func (s SortableShardList) Swap(i, j int)