KubFly SDK for Go / pipeline
package pipeline
import "kubfly.io/sdk/pipeline"
Package pipeline is the core of the collectors — the kubfly-sdk-pipeline module of the Java SDK. The goroutines of the application only measure a record, reserve room in their lane and encode it there: no allocation, no lock (an error and an OBJECT argument are taken apart first, on that goroutine); metrics, alerts, health, traffic and profiles go into direct channels of their own. The drain goroutine orders the records (the ordering window) and gives them to every Output; each output sends its batches on a goroutine of its own (Outlet), so the drain never waits for a network or a disk.
The outputs register their providers in their init (Register): linking an output in is all it takes,
import _ "kubfly.io/sdk/output/bucket"
and the pipeline registers its Collector with api.Collectors; without an output that is on it is nil and nothing is built. Call api.Collectors.Finish at the end of main: Go has no hook at the exit of a process, and the last batches are sent there.
Constants
const ( // Half is the size of a half of a lane, bytes: 1 MiB, whatever the processors — two lanes a processor take 4 MiB // (sdk/spec/stripes.md, §5). Half = 1 << 20 // Window is the ordering window, ms: a record is released by time once it is a second old — late records of other // goroutines come in order. A constant: a longer one holds more memory and delays every output, a shorter one lets // more records out of order. Window = 1000 // Drain is the pause between drains, ms: 50 — a quiet process is drained 20 times a second; a busy one wakes the // drain at once. Drain = 50 // StringLimit is the limit of a string value inside a record, bytes of UTF-8: 8 KiB — the message, the search // and the console see so much of a longer one. StringLimit = 8192 // Inline is the budget of the strings, blobs and images inside the record of an event, bytes: 128 KiB, an eighth of // a half of a lane — a record fits it, whatever its arguments. Inline = 128 * 1024 )
const Area = "collector"
Area is the area of the core of the pipeline in the module pipeline: sdk/pipeline/collector.
const BatchChunk = 1 << 16
BatchChunk is the size of a chunk of a batch, bytes.
const DefaultMode = ModeAsync
DefaultMode is ModeAsync: the application never waits unless asked (Variables.DEFAULT_MODE of the Java SDK).
const System = "core"
System is the system of the core of the pipeline: sdk/pipeline/collector/core.
Variables
var Config = registerConfig(loadConfig(api.Config.Vars))
Config is the configuration of the pipeline.
var Modes = []Mode{ModeAsync, ModeLossless}
Modes are the modes in their order.
Functions
func Register
func Register(provider OutputProvider)
Register registers the provider of an output: its package calls it in its init, so linking the package in is all it takes.
Types
type Batch
type Batch struct {
// contains filtered or unexported fields
}
Batch is what an output sends at once — a segment of the bucket, a request of a collector of logs: bytes in chunks of BatchChunk, the name of its stream, its key and the number of its records. A batch is filled by the drain, sent by the goroutine of its output (Outlet) and given back to the pool of the outlet: its chunks are reused, up to 1 MiB of them; the larger ones go to the collector of garbage.
func (*Batch) Key
func (b *Batch) Key() string
Key is the key of the batch.
func (*Batch) Label
func (b *Batch) Label(stream string, key string, records int64)
Label names the batch before it is sent: its stream (events), its key (empty for a transport without keys) and the records in it.
func (*Batch) Len
func (b *Batch) Len() int64
Len is the bytes written so far.
func (*Batch) Reader
func (b *Batch) Reader() (io.ReadCloser, error)
Reader is the bytes, as many times as needed: a new reader over the chunks, from the first byte.
func (*Batch) Records
func (b *Batch) Records() int64
Records are the records in the batch.
func (*Batch) Reject
func (b *Batch) Reject(count int64)
Reject counts the records a transport refused out of a delivered batch (Partial).
func (*Batch) Rejected
func (b *Batch) Rejected() int64
Rejected are the records refused out of a delivered batch.
func (*Batch) Stream
func (b *Batch) Stream() string
Stream is the stream of the batch.
func (*Batch) Write
func (b *Batch) Write(data []byte) (int, error)
Write appends bytes; it never fails.
func (*Batch) WriteTo
func (b *Batch) WriteTo(w io.Writer) (int64, error)
WriteTo writes the bytes to a writer, chunk by chunk, without a copy: io.WriterTo.
type BatchOwner
type BatchOwner interface {
// Delivered tells that the batch was delivered: wholly, or but for Batch.Rejected records. The batch is valid
// during the call only.
Delivered(batch *Batch)
// Lost tells that the batch is lost: the transport refused it for good, or there was no room in the ring of the
// output. The batch is valid during the call only.
Lost(batch *Batch)
}
BatchOwner is who filled a batch: it learns from the goroutine of the output what became of it.
type Collector
type Collector struct {
// contains filtered or unexported fields
}
Collector is the collector of the pipeline — PipelineCollector of the Java SDK: what the application gives it goes to every Output. The goroutines of the application only measure a record, reserve room in their lane and encode it there; metrics, alerts, health, traffic, profiles and the points of tracks go into direct channels of their own. Everything else — ordering, the formats of the outputs — happens on the drain goroutine, and sending on a goroutine of each output.
func NewCollector
func NewCollector(p *Pipeline, outputs []Output, problems []string) *Collector
NewCollector is a collector of given outputs, made on the pipeline, its drain goroutine started: for tests and tools, and for a collector of one output (bucket.Of); an application links the outputs in. The problems are the wrong settings: WARN events of sdk/pipeline/collector/core once the process starts.
func (*Collector) Alert
func (c *Collector) Alert(id int64, begin int64, end int64, metric *api.Metric, severity alert.Severity, warnings int64, criticals int64, unassessed int64)
Alert is the state of a metric with thresholds: one record ALERT of the stream alerts.
func (*Collector) Begin
func (c *Collector) Begin(id int64, time int64, frame *api.Frame)
Begin is a frame that begins: BEGIN.
func (*Collector) Bridge
func (c *Collector) Bridge() bool
Bridge is false: the collector is not a bridge to another logging system.
func (*Collector) Drain
func (c *Collector) Drain(now int64, all bool)
Drain is one drain with a given clock, then waits for the outputs to deliver what they sent: for tests and diagnostics.
func (*Collector) Enabled
func (c *Collector) Enabled() bool
Enabled is true with an output: a pipeline without an output that is on is never made.
func (*Collector) End
func (c *Collector) End(id int64, time int64, duration int64, threadID int64, threadName string, frame *api.Frame, err error)
End is a frame that ends: END.
func (*Collector) Event
func (c *Collector) Event(id int64, time int64, threadID int64, threadName string, frame *api.Frame, event *api.Event, message string, arg1 api.Arg, arg2 api.Arg, err error)
Event is an event: EVENT; its strings, blobs and images inside the record within the budget of a record (Settings.Inline), in their order — those that do not fit go to a pack of attachments whole.
func (*Collector) EventArgs
func (c *Collector) EventArgs(id int64, time int64, threadID int64, threadName string, frame *api.Frame, event *api.Event, message string, args []api.Arg, err error)
EventArgs is an event of three to api.MaxArguments arguments (api.ArgsCollector): EVENT with each argument of its kind, an object as its type and its text; its strings, blobs and images inside the record within the budget of a record (Settings.Inline), in their order — those that do not fit go to a pack of attachments whole.
func (*Collector) Failures
func (c *Collector) Failures() int64
Failures are the panics of the outputs on the drain goroutine.
func (*Collector) Finish
func (c *Collector) Finish(id int64, time int64, environment *environment.Environment)
Finish is the finish: FINISH, then everything is given to the outputs — the lanes, the window, the channels — and every output sends its last batches and stops.
func (*Collector) Flush
func (c *Collector) Flush()
Flush gives the outputs now everything received so far and returns when it is delivered: both halves of the lanes, the whole ordering window, the channels, the open batch of every stream. A record received later than the window it closed is written with its time raised, as any late record (format.md §5). For reading in the same process (kubflytest); a collector of an application never needs it, its goroutines write on their own.
func (*Collector) Frames
func (c *Collector) Frames(project, module, area, system, component string) bool
Frames tells whether some output takes the frames of a scope: an output that is not OutputFrames takes them all (the call tree of the stand); the others are asked each time.
func (*Collector) Health
func (c *Collector) Health(id int64, time int64, duration int64, check *api.HealthCheck, health api.Health)
Health is a result of a health check: one record HEALTH_RESULT of the stream health, and HEALTH_CHANGE in events when its level changes (the first OK is no change).
func (*Collector) Lost
func (c *Collector) Lost() int64
Lost is the count of the records lost because every lane or a channel was full.
func (*Collector) Metrics
func (c *Collector) Metrics(id int64, begin int64, end int64, snapshots []*api.Snapshot)
Metrics are the aggregates of an interval: one record METRICS of the stream metrics, none without snapshots.
func (*Collector) Pipeline
func (c *Collector) Pipeline() *Pipeline
Pipeline is the pipeline of the collector.
func (*Collector) Profile
func (c *Collector) Profile(id int64, begin int64, end int64, p *profile.Profile)
Profile is the profile of one kind over an interval: one record PROFILE of the stream profiles, its nodes registered in Pipeline.Stacks; none when the profile has no rows.
func (*Collector) Start
func (c *Collector) Start(id int64, time int64, environment *environment.Environment)
Start is the start: the record START, then every output learns of it.
func (*Collector) Threshold
func (c *Collector) Threshold(project, module, area, system string) api.Level
Threshold is the most verbose level of the outputs, asked each time: the level of an output may change once the process has started (the console is silent while a bridge prints the events).
func (*Collector) Track
func (c *Collector) Track(id int64, time int64, kubfly *api.KubFly, point util.TrackPoint)
Track is a point of a track (api.TrackCollector): one record TRACK of the stream tracks (format.md §9c), through its direct channel — a stream of points never crowds the events out of the lanes.
func (*Collector) Traffic
func (c *Collector) Traffic(id int64, begin int64, end int64, edges []traffic.Edge)
Traffic is the links of an interval: one record TRAFFIC of the stream traffic; none when nothing went over the wire.
func (*Collector) Usage
func (c *Collector) Usage(id int64, time int64, usage *usage.Usage)
Usage is a usage snapshot: USAGE, its entity by entities.tsv.
type Configuration
type Configuration struct {
// Causes is the deepest chain of causes (KUBFLY_PIPELINE_CAUSES, 8).
Causes *api.Param[int]
// Suppressed is the most suppressed errors (KUBFLY_PIPELINE_SUPPRESSED, 8).
Suppressed *api.Param[int]
// Batches are the batches ready to go an output holds at most (KUBFLY_PIPELINE_BATCHES, 8).
Batches *api.Param[int]
// Mode is the mode: a full pipeline loses or waits (KUBFLY_PIPELINE_MODE, ModeAsync).
Mode *api.Param[Mode]
// Problems are the wrong values that fell back to their defaults.
Problems []string
}
Configuration is the configuration of the pipeline, taken once from api.Config.Vars when the package loads (KUBFLY_PIPELINE_*): the Config class of the Java SDK, the parameters sdk/pipeline/*; the window and the drain are constants (Window, Drain). Wrong numbers fall back to their defaults and are listed in Problems, reported once the process starts.
type Dictionary
type Dictionary struct {
// contains filtered or unexported fields
}
Dictionary is the dictionary of the process (format.md §5): constant strings shorter than DictionaryLength characters get numbers for the whole process, at most DictionarySize; longer ones and those beyond the limit go as text. A known string costs one lookup in a map read without a lock and no allocation: new strings go to a map under a lock, which becomes the read map again once it has been missed as many times as it has strings.
Before the map, a known string is looked up by the address of its bytes in a small table (front): a constant — a literal, a path kept by its KubFly — is always at one address, so it is found without hashing its text; the text is still compared, so a string that only shares the address of an old one is never taken for it.
func (*Dictionary) String
func (d *Dictionary) String() string
String is the text form.
func (*Dictionary) Text
func (d *Dictionary) Text(id int) string
Text is the string of a number.
type Encoder
type Encoder struct {
// contains filtered or unexported fields
}
Encoder encodes the bodies of records (format.md §4.3–§4.4) with package buffer: every method takes a buffer or nil to count only and returns the offset after what it wrote, so a record is measured and written by the same code. Nothing is allocated for primitives, strings, tags and frames; an error and an OBJECT argument are taken apart once, before measuring (exception, api.ObjectTextOf), so the two passes always agree.
func (*Encoder) Clock
func (e *Encoder) Clock(b []byte, offset int, bucket int64, local int64) int
Clock is the body of CLOCK (format.md §15): the time of the bucket and the local time of its response, from the time of the record.
func (*Encoder) Frames
func (e *Encoder) Frames(b []byte, offset int, frames []api.StackFrame) int
Frames are the frames of a stack trace: class, method, file (strings of the dictionary), line.
func (*Encoder) Gap
func (e *Encoder) Gap(b []byte, offset int, reason int, segments int64, bytes int64, records int64) int
Gap is the body of GAP (format.md §15).
func (*Encoder) Metric
func (e *Encoder) Metric(b []byte, offset int, id int, metric *api.Metric) int
Metric is the definition of a metric (format.md §7): its path, scale, units and thresholds.
func (*Encoder) Stack
func (e *Encoder) Stack(b []byte, offset int, node *profile.StackNode) int
Stack is the body of the definition STACK: the number, the parent and the frame of a node.
type Metrics
type Metrics struct {
// contains filtered or unexported fields
}
Metrics are the metrics of the process, numbered for their definitions (METRIC) in the segments of metrics and alerts.
func (*Metrics) ID
func (m *Metrics) ID(metric *api.Metric) int
ID is the number of a metric; more than DictionarySize metrics are a panic (the API limits them far below).
func (*Metrics) Metric
func (m *Metrics) Metric(id int) *api.Metric
Metric is the metric of a number.
type Mode
type Mode uint8
Mode is the mode of the pipeline (KUBFLY_PIPELINE_MODE, ModeAsync by default): what a writer does when every lane is full, and the drain when the ring of an output is full. Both write on the goroutines of the pipeline, never on the goroutine of the application. The variable is read in any case; the name of the mode (String) is its canonical form — in the documentation, in the problems of the configuration and in the parameter of STATUS. As Mode of the Java SDK.
const ( // ModeAsync is KubFly Async: the application never waits for KubFly. A record that fits in no lane and a batch // that finds the ring of its output full are lost at once and counted (sdk/pipeline/collector/core/lane/lost, // sdk/pipeline/output/<output>/batches/lost). ModeAsync Mode = iota // ModeLossless is KubFly Lossless: every record arrives; the application slows down to the outputs. The records // not released to the outputs yet — in the lanes and in the window — hold at most a budget of bytes, the size of // all the lanes; a writer waits while it is spent and goes on as the drain releases records // (sdk/pipeline/collector/core/lane/waited). A pipeline that moves on nothing for 10 s — the drain or the goroutine // of an output stuck — loses the record or the batch and counts it, as ModeAsync does: the application is never // held forever. ModeLossless )
The modes.
func (Mode) String
func (m Mode) String() string
String is the name of the mode: ASYNC, LOSSLESS — the canonical value of the variable.
type Outlet
type Outlet struct {
// contains filtered or unexported fields
}
Outlet is the sending side of an output: a ring of batches ready to go and the goroutine that gives them to the Transport, so the drain never waits for a network or a disk. The drain takes an empty batch from the pool (Batch), fills it and puts it in the ring (Send); with the ring full the batch is lost at once and counted (sdk/pipeline/output/<output>/batches/lost), the drain goes on. A batch the transport asks to send again is sent again after a pause, from 100 ms doubling to 5 s, until the finish gives up on it.
Lossless (KUBFLY_PIPELINE_MODE=LOSSLESS): with the ring full the drain waits for room while the goroutine of the outlet takes batches; it took none for 10 s — the transport is stuck, say — and the batch is lost, later ones are lost at once until the goroutine takes one again.
func NewOutlet
func NewOutlet(name string, transport Transport, ring int, streams int, pause int64, wait bool) *Outlet
NewOutlet is an outlet, not started: ring is the batches ready to go it holds at most, streams the batches the output fills at once (the pool keeps as many more), pause the pause of the drain in ms — the transport is idle at least as often; wait — the drain waits for room in a full ring instead of losing the batch (Settings.Lossless).
func (*Outlet) Batch
func (o *Outlet) Batch(owner BatchOwner) *Batch
Batch is an empty batch for the drain: from the pool, a new one only while the pool is still filling.
func (*Outlet) BatchMemory
func (o *Outlet) BatchMemory() int64
BatchMemory is the bytes of the chunks of its batches — in the ring, being filled or sent, in the pool: what they hold, read without locks.
func (*Outlet) Failures
func (o *Outlet) Failures() int64
Failures are the panics of the transport and of the owners, the first one printed to the standard error.
func (*Outlet) Finish
func (o *Outlet) Finish(timeout int64)
Finish sends what is in the ring and stops the goroutine: a batch the transport keeps asking to send again is lost once the time is up (timeout, ms). A waiting outlet waits for the goroutine as long as it takes batches — what the drain gave it is not lost at the exit — and until it took none for the stall.
func (*Outlet) Flush
func (o *Outlet) Flush(now int64)
Flush returns when every batch put in the ring before the call is sent or lost and the transport was idle with the given clock: for a flush of the collector, and for tests.
func (*Outlet) Lost
func (o *Outlet) Lost() int64
Lost are the batches lost: refused for good, or without room in the ring.
func (*Outlet) Memory
func (o *Outlet) Memory() int64
Memory is what the output holds: its batches and its own bytes.
func (*Outlet) OutputMemory
func (o *Outlet) OutputMemory() int64
OutputMemory is the bytes its output holds besides the batches (TransportMemory); 0 for a transport that does not tell them.
func (*Outlet) Queued
func (o *Outlet) Queued() int
Queued is the batches waiting in the ring: an output of a lossless pipeline sends smaller ones while the goroutine of the outlet is behind.
func (*Outlet) Send
func (o *Outlet) Send(batch *Batch)
Send puts a filled batch in the ring, or, with the ring full, loses it — at once, or when waiting found the goroutine of the outlet stuck: its owner learns of it on this goroutine.
func (*Outlet) Start
func (o *Outlet) Start()
Start starts the goroutine of the outlet.
type Output
type Output interface {
// Name is the name of the output (bucket).
Name() string
// Level is the most verbose level of the events the output takes: the collector gives the application the most
// verbose level of its outputs, asked each time (cheap and safe for concurrent use).
Level() api.Level
// Record takes a record, in the order of its stream; the record is valid during the call only.
Record(record *Record, now int64)
// Lost tells of the records the application lost since the last call: every lane was full, or a channel.
Lost(records int64, now int64)
// Cycle runs after every drain: the batches that are due are sent, or all of them (a flush, the finish).
Cycle(now int64, all bool)
// Flush returns when what the output has sent so far is delivered or lost (Outlet.Flush).
Flush(now int64)
// Start tells that the process has started: called by the goroutine of the application after START.
Start(time int64)
// Finish tells that the process finishes: called once the drain has given everything and the output sent its
// last batches; the output sends what it has and stops its goroutine.
Finish(time int64)
}
Output is where the pipeline writes the process: the bucket, the console, a collector of logs. An output takes the records the drain releases, in the order of their streams, formats them into its batches (Stream) and sends them through its Outlet, on a goroutine of its own. Every method but Start and Finish is called by the drain only, one call at a time: an output needs no lock for its formats. Level, and Frames of an OutputFrames, are asked by the goroutines of the application.
type OutputAttachments
type OutputAttachments interface {
// Attach keeps a blob or an image: where it is, or one of Pack 0 without room (counted). The data are valid
// during the call only.
Attach(id uuid.UUID, mime string, image bool, data []byte) *api.Attachment
// AttachText keeps the whole UTF-8 of a string: where it is, or one of Pack 0 without room (counted).
AttachText(text string) *api.Attachment
}
OutputAttachments is an Output that keeps attachments — blobs and images beyond the budget of their record, the whole UTF-8 of strings cut in it — in packs of its own (format.md §10d) — Output.attach and Output.attachText of the Java SDK. It copies them on the goroutine of the application that logs them, into room made in advance, safe for concurrent use and never blocking on the bucket; the first such output keeps them and the record refers to that place. Without one, a blob is kept nowhere and a string is only cut.
type OutputFrames
type OutputFrames interface {
// Frames tells whether the output takes the frames of a scope; asked on the goroutines of the application, it
// is cheap and safe for concurrent use.
Frames(project, module, area, system, component string) bool
}
OutputFrames is an Output that chooses the frames it takes — Output.frames of the Java SDK: the collector writes BEGIN and END of a scope when some output takes them; an Output that is not OutputFrames takes them all.
type OutputMemory
type OutputMemory interface {
// Memory is the bytes.
Memory() int64
}
OutputMemory is an Output that tells the bytes it holds — the batches of its outlet and its own buffers (Outlet.Memory) — for STATUS and sdk/pipeline/collector/core/memory/bytes: read on the drain, without locks (Output.memory of the Java SDK).
type OutputProvider
type OutputProvider interface {
// Enabled tells whether the output is on by its configuration (KUBFLY_OUTPUT_<OUTPUT>): cheap, nothing is built.
Enabled() bool
// Create makes the output on the pipeline, its goroutine started; an error when it is on but cannot work — the
// process does not start.
Create(pipeline *Pipeline) (Output, error)
}
OutputProvider is an output as the pipeline finds it: the package of an output registers its provider in its init (Register); the pipeline asks every provider whether its output is on, and makes those that are.
type Pipeline
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline is what the outputs of one pipeline share: its settings, the registries of the process its records refer to — the strings (Dictionary), the stack traces, the metrics, the nodes of the stacks of the profiles — and the Encoder that wrote them. An output that needs the text of a string or the frames of a trace finds them here.
func New
func New(settings Settings) *Pipeline
New is a pipeline with empty registries.
func (*Pipeline) Dictionary
func (p *Pipeline) Dictionary() *Dictionary
Dictionary is the strings of the process.
func (*Pipeline) Encoder
func (p *Pipeline) Encoder() *Encoder
Encoder is the encoder of the bodies of records.
func (*Pipeline) ID
func (p *Pipeline) ID() int64
ID is the number of a record the pipeline or an output writes itself.
func (*Pipeline) Metrics
func (p *Pipeline) Metrics() *Metrics
Metrics are the metrics of the process.
func (*Pipeline) Reader
func (p *Pipeline) Reader() *format.RecordReader
Reader is a new reader of the bodies of the pipeline: the strings and the stack traces from its registries. One per goroutine — an output keeps one for the drain.
func (*Pipeline) Settings
func (p *Pipeline) Settings() Settings
Settings are the settings.
func (*Pipeline) Stacks
func (p *Pipeline) Stacks() *Stacks
Stacks are the nodes of the stacks of the profiles.
func (*Pipeline) Traces
func (p *Pipeline) Traces() *Traces
Traces are the stack traces of the process.
type Record
type Record struct {
// contains filtered or unexported fields
}
Record is one record as the drain gives it to the outputs: a view of the bytes of a lane or a channel, reused for every record — nothing is allocated. Valid only during the call it is given to; an output that keeps it copies the bytes. The body is in the form of format.md §4.3–§4.4: its strings, traces, metrics and stacks are numbers of the registries of the process (Pipeline), so the record is complete with them.
func NewRecord
func NewRecord(stream byte, typ int, lateBy int64, time int64, id int64, body []byte) *Record
NewRecord is a record made by hand, its body not copied: for the tests of an output and for tools that replay records.
func (*Record) Body
func (r *Record) Body() []byte
Body is the body; not to be changed or kept.
func (*Record) ID
func (r *Record) ID() int64
ID is the number of the record.
func (*Record) LateBy
func (r *Record) LateBy() int64
LateBy is by how much the record was late, ms: its time was raised to the last one released by as much; 0 — in time.
func (*Record) Read
func (r *Record) Read(reader *format.RecordReader) *format.RecordReader
Read reads the head of the body with a reader (Pipeline.Reader) and returns it: the rest is read from the reader.
func (*Record) Stream
func (r *Record) Stream() byte
Stream is the stream of the record (format.md §2): format.Events, Metrics, Alerts, Health, Traffic or Profiles.
func (*Record) Time
func (r *Record) Time() int64
Time is the time of ordering, ms since the epoch: never less than that of the record before it in its stream.
func (*Record) Type
func (r *Record) Type() int
Type is the type of the record (format.Event …).
type Result
type Result int
Result is what became of a batch the transport was given.
const ( // Delivered is a batch taken whole. Delivered Result = iota // Retry is a batch not taken now: the outlet sends it again after a pause, while it runs. Retry // Partial is a batch taken but for Batch.Rejected records, which are counted and not sent again. Partial // Lost is a batch refused for good: it is lost and counted. Lost )
type Settings
type Settings struct {
// Half is the size of a half of a lane, bytes; zero — Half (1 MiB), smaller in tests.
Half int
// Lanes is the number of lanes; zero — two per processor, a number in tests.
Lanes int
// Window is the ordering window, ms: Window in an application, shorter in tests.
Window int64
// Drain is the pause between drains, ms: Drain in an application.
Drain int64
// StringLimit is the limit of a string value inside a record, bytes: a longer one is cut, its whole kept in a pack
// of attachments; zero — StringLimit.
StringLimit int
// Causes is the deepest chain of causes.
Causes int
// Suppressed is the most suppressed errors.
Suppressed int
// Batches are the batches ready to go an output holds at most; zero — DefaultBatches.
Batches int
// IDs gives the numbers of the records the pipeline and its outputs write themselves — HEALTH_CHANGE, GAP,
// CLOCK; nil — api.NextID. A test gives its own, for the same bytes.
IDs func() int64
// Lossless is whether a full pipeline waits instead of losing: a writer for a lane (lanes), the drain for the
// ring of an output (Outlet).
Lossless bool
// Inline is the budget of the strings, blobs and images inside the record of an event, bytes: the arguments that
// do not fit go to a pack of attachments whole, kept by an output that keeps attachments (OutputAttachments); a
// larger tag value is written as null; zero — Inline.
Inline int
}
Settings are what the pipeline works with — SettingsOf in an application, given directly in tests. Times are milliseconds.
func SettingsOf
func SettingsOf() Settings
SettingsOf are the settings of the application: Config.
type Stacks
type Stacks struct {
// contains filtered or unexported fields
}
Stacks are the nodes of the tree of the stacks of the profiles (format.md §9b), by the numbers the process gave them (profile.Stacks): for their definitions (STACK) in the segments of profiles.
func (*Stacks) Node
func (s *Stacks) Node(id int) *profile.StackNode
Node is the node of a number.
func (*Stacks) Register
func (s *Stacks) Register(leaf *profile.StackNode)
Register keeps a node and its ancestors, up to the first one already kept.
type Stream
type Stream interface {
// Append formats a record into the open batch, opening one if needed; a batch that is full is sent.
Append(record *Record, now int64)
// Due tells whether the open batch should be closed now.
Due(now int64) bool
// Close ends the open batch, if any, and sends it.
Close()
}
Stream is one stream of an output: a format (the beginning of a batch, the records, its end) and the rules of a batch (when it is due). The bucket writes a segment per stream; a collector of logs may have one stream for all.
type Traces
type Traces struct {
// contains filtered or unexported fields
}
Traces are the stack traces of the process, numbered like strings: an error storm writes one trace once per segment.
func (*Traces) Frames
func (t *Traces) Frames(id int) []api.StackFrame
Frames are the frames of a number.
type Transport
type Transport interface {
// Send sends a batch, valid during the call only; a panic is a loss.
Send(batch *Batch) Result
// Idle is called when the outlet has nothing to send, at least every pause of the drain, and on every flush: what
// the transport does besides batches (the tree of the stand and the pulse of the bucket).
Idle(now int64)
}
Transport is where an output sends its batches: a bucket, a collector of logs, a socket. Called only by the goroutine of its output (Outlet), never by the drain or by the application.
type TransportMemory
type TransportMemory interface {
// OwnMemory is the bytes.
OwnMemory() int64
}
TransportMemory is a Transport that tells the bytes its output holds besides the batches of its outlet — its buffers, what waits for it — for STATUS and sdk/pipeline/collector/core/memory/bytes: read on any goroutine, without locks (Transport.memory of the Java SDK).