package
0.0.0-20180929164314-b5bdc3694f97
Repository: https://github.com/m3db/m3aggregator.git
Documentation: pkg.go.dev

# README

Interfaces

  • Handler processes aggregated metrics alongside their policies.
  • Writer encodes and buffers data before writing them to backends.
  • Router routes encoded data to the corresponding backend queues.
  • Queue queues up encoded data and asynchronously forwards them to backend servers.

How the interfaces fit together

Client uses Handler to create new Writers, which encodes data internally and flushes them when the internal buffer is large enough. The flushed buffer is then routed to different backend Queues via the Router and eventually sent to the backend servers.

Optimizations

  • In order to make sure we don't encode data more times than necessary, the backend queues are grouped by their sharding ids so that if two backends share the same sharding id (including the sharding hash type and the total number of shards), they belong to the same group which receives ref-counted buffers from a single writer so that aggregated metrics are only encoded once per sharding function to save CPU cycles.

  • In order to reduce lock contention among different aggregator lists, the writers returned from the handlers are intentionally thread-unsafe. Each aggregator list holds on to a writer it creates when the list is created, and uses the writer to write data in a flush. This is okay because a list only performs at most one flush at any given time. As a result, the lists writes data independently and don't contend with each other when flushing at the same time.

# Packages

Package common is a generated GoMock package.
No description provided by the author
Package router is a generated GoMock package.
Package writer is a generated GoMock package.

# Functions

NewBlackholeHandler creates a new blackhole handler.
NewBroadcastHandler creates a new Handler that broadcasts incoming data to a list of handlers.
NewLoggingHandler creates a new logging handler.
NewMockHandler creates a new mock instance.
NewShardedHandler creates a new sharded handler.

# Structs

FlushHandlerConfiguration configures flush handlers.
MockHandler is a mock of Handler interface.
MockHandlerMockRecorder is the mock recorder for MockHandler.
SharderRouter contains a sharder id and a router.

# Interfaces

Handler handles aggregated metrics alongside their policies.

# Type aliases

Type is the handler type.