KubFly SDK for Go / format
package format
import "kubfly.io/sdk/format"
Package format is the KubFly format at the level its writers and readers share — the constants (magics, streams, record types, flags, the limits of the dictionary), reverse varints and the nested entities of entities.tsv, written and read: the kubfly-sdk-format module of the Java SDK. The pipeline encodes records with it without the segments and the cipher of the decoder (sdk/spec/format.md).
Constants
const ( // SegmentMagic is the magic of a segment: "KFSG". SegmentMagic = 0x4B465347 // EndMagic is the magic at the end of a segment: "KFSE". EndMagic = 0x4B465345 // Major is the major version of segments. Major = 1 // Minor is the minor version of segments: 0 — the first version of the format, 1.0, with every stream, the caller // at the end of BEGIN and the stream profiles included (format.md, decision 86). Minor = 0 // TableVersion is the version of the table. TableVersion = 1 // Trailer is the size of the trailer: u64 table offset, u32 table length, u32 CRC32C of the table, the end magic. Trailer = 20 // TableBlock is the block number of the table in the nonce of the cipher. TableBlock = 0xFFFFFFFF // Events is the stream of events, frames, usage and process records. Events = 1 // Metrics is the stream of metrics. Metrics = 2 // Alerts is the stream of alerts. Alerts = 3 // Health is the stream of health checks. Health = 4 // Traffic is the stream of the links of a process with its peers. Traffic = 5 // Profiles is the stream of the profiles of a process. Profiles = 6 // Tracks is the stream of the tracks of moving objects: their points. Tracks = 7 // CompressionNone is no compression. CompressionNone = 0 // CompressionDeflate is raw deflate (RFC 1951). CompressionDeflate = 1 // CipherNone is no cipher. CipherNone = 0 // CipherEnvelope is the envelope: HPKE for the recipients, AES-256-GCM for the blocks. CipherEnvelope = 1 // Start is the start of the process. Start = 1 // Finish is the finish of the process. Finish = 2 // Begin is a frame that begins. Begin = 3 // End is a frame that ends. End = 4 // Event is a log event. Event = 5 // Usage is a usage snapshot. Usage = 6 // MetricsRecord is an interval of metrics. MetricsRecord = 7 // Gap is a loss. Gap = 8 // Clock is a pair of clocks. Clock = 9 // HealthChange is a change of the state of a health check. HealthChange = 11 // Status is the state of the process as it knows it (STATUS, decision 87): the last record of every segment of // events, written by the output to the bucket. Status = 12 // Alert is an alert. Alert = 16 // HealthResult is a result of a health check. HealthResult = 17 // TrafficRecord is an interval of the links of a process: its edges. TrafficRecord = 18 // ProfileRecord is the profile of one kind over an interval: rows folded by stack. ProfileRecord = 19 // TrackRecord is a point of the track of a moving object (format.md §9c). TrackRecord = 20 // Definitions is the first type of a definition: no time, no number. Definitions = 32 // String is the definition of a string of the dictionary. String = 32 // Enum is the definition of the constants of an enumeration. Enum = 33 // Metric is the definition of a metric. Metric = 34 // Trace is the definition of a stack trace. Trace = 35 // Stack is the definition of a node of the tree of stacks of the profiles. Stack = 36 // Track is the summary of a track of a segment: in its table only (format.md §9c). Track = 37 // ProfileCPU is a profile of the time on the processor (the kind in PROFILE). ProfileCPU = 1 // ProfileAlloc is a profile of the allocations: its rows carry the type allocated. ProfileAlloc = 2 // ProfileLock is a profile of the waits. ProfileLock = 3 // TrafficStatuses is a bit of the mask of an edge of TRAFFIC: the answers by class follow. TrafficStatuses = 1 // TrafficBytes is a bit of the mask of an edge: the bytes received and sent follow. TrafficBytes = 2 // TrafficHistogram is a bit of the mask of an edge: the histogram of the durations follows. TrafficHistogram = 4 // GapLane is a loss: the lane was full. GapLane = 1 // GapCollector is a loss: the collector failed. GapCollector = 2 // GapBucket is a loss: neither the bucket nor the spool took a segment. GapBucket = 3 // GapFinish is a loss: records after the finish. GapFinish = 4 // GapSpool is a loss: the spool was full, its oldest segments were removed. GapSpool = 5 // Late is the bit of the type of a record that arrived later than the ordering window. Late = 0x80 // Null is the bit of a kind byte that marks a null value. Null = 0x80 // GeoAltitude is the bit of the flags of a place (LOCATION, TRACK_POINT): its altitude follows. GeoAltitude = 1 // GeoAccuracy is the bit of the flags of a place: its accuracy follows (TRACK_POINT and TRACK only). GeoAccuracy = 2 // GeoSpeed is the bit of the flags of a place: its speed follows (TRACK_POINT and TRACK only). GeoSpeed = 4 // GeoHeading is the bit of the flags of a place: its heading follows (TRACK_POINT and TRACK only). GeoHeading = 8 // InFrame is a flag of EVENT: inside a frame (an END always is). InFrame = 1 // Exception is a flag of EVENT and END: an exception follows. Exception = 2 // Tags is a flag of EVENT: tags follow. Tags = 4 // Arguments is a flag of EVENT: arguments follow the template — a byte of their number (1–MaxArguments), then // their values. Arguments = 8 // MaxArguments are the most arguments of EVENT (decision 94). MaxArguments = 16 // Cause is a flag of an exception: a cause follows. Cause = 1 // Cut is a flag of an exception: causes or suppressed exceptions were cut at the limits. Cut = 2 // DictionarySize is the most strings of the dictionary of a process. DictionarySize = 65_536 // DictionaryLength is the length strings of the dictionary are shorter than, in characters. DictionaryLength = 64 // DictionaryThreads are the most numbers of the dictionary a writer gives to the names of threads: the rest go as // text, so that threads named per request never take the numbers of the templates and the paths. DictionaryThreads = 1024 )
The constants of the KubFly format (sdk/spec/format.md): magics, versions, streams, record types, flags and the limits of the dictionary. Identifiers never change once written.
const ( // ExceptionRoot is the exception of the record. ExceptionRoot = 0 // ExceptionCausedBy is the cause of the exception one level up. ExceptionCausedBy = 1 // ExceptionSuppressed is an exception suppressed by the exception one level up. ExceptionSuppressed = 2 )
The roles of an exception in its tree (RecordReader.ExceptionRole).
const NewerKinds = 64
NewerKinds is the most kinds the summary of a Newer keeps.
Functions
func Definition
func Definition(typ int) bool
Definition tells whether a type is a definition (no time, no number).
func EntitiesFieldName
func EntitiesFieldName(field reflect.StructField) string
EntitiesFieldName is the name in the table of a field of a struct of an entity.
func EntitiesLatest
func EntitiesLatest(name string) int
EntitiesLatest is the latest version of a type, 0 if the table has none.
func EntitiesName
func EntitiesName(typ reflect.Type) string
EntitiesName is the name of a Go type in the table, "" if it is not an entity.
func EntitiesParts
func EntitiesParts(typ reflect.Type) []reflect.Type
EntitiesParts are the parts of a union — the struct types its interface holds, by pointer — in the order of the table; nil for a type that is not a union.
func EntitiesRead
func EntitiesRead[T any](reader *buffer.Reader) (*T, error)
EntitiesRead reads an entity of any version known to entities.tsv into a new T; nil for version 0. An entity newer than this reader, or of a version the table lacks, is a *Error.
func EntitiesTypes
func EntitiesTypes() []string
EntitiesTypes are the names of the types of the table, sorted.
func EntitiesWrite
func EntitiesWrite(buffer []byte, offset int, value any) (int, error)
EntitiesWrite writes an entity of its latest version — a struct or a pointer to one, nil for none (version 0) — at an offset of a buffer; a nil buffer only counts. The next offset, or an error for a struct that does not match the table.
func OffsetID
func OffsetID(seconds int32) string
OffsetID is the identifier of an offset as Java names a ZoneOffset: Z, +03:00, -05:30:15.
func RecordEntity
func RecordEntity[T any](r *RecordReader) *T
RecordEntity reads the entity of START, FINISH or USAGE (format.md §6): nil for version 0. It allocates.
func VarintsReadReverse
func VarintsReadReverse(bytes []byte, end int, from int) (uint64, error)
VarintsReadReverse reads a reverse varint that ends just before a position, not before from.
func VarintsSize
func VarintsSize(value uint64) int
VarintsSize is the bytes of an unsigned LEB128 integer.
func VarintsWriteReverse
func VarintsWriteReverse(buffer []byte, offset int, value uint64) int
VarintsWriteReverse writes a reverse varint — the LEB128 bytes of the value in reverse order, so that, read from its last byte backwards, it ends at the first byte without the high bit; a nil buffer only counts: the next offset.
Types
type Cursor
type Cursor struct {
// contains filtered or unexported fields
}
Cursor is a reusable cursor that scans encoded bytes without allocating: unsigned and zigzag integers, single bytes, skips. It serves the walk of record bodies (decoder.BodiesWalk) and the reader of the pipeline (RecordReader); values that are objects are decoded strictly by buffer.Reader. Running past the limit panics with a *Error: the functions that take bytes from outside recover it and return it.
func (*Cursor) BigLong
func (c *Cursor) BigLong() int64
BigLong reads a big-endian int64: a half of a UUID.
func (*Cursor) Bytes
func (c *Cursor) Bytes() []byte
Bytes is the slice.
func (*Cursor) Limit
func (c *Cursor) Limit() int
Limit is the position after the last byte.
func (*Cursor) Position
func (c *Cursor) Position() int
Position is the position of the next byte.
func (*Cursor) Reset
func (c *Cursor) Reset(bytes []byte, from int, to int) *Cursor
Reset scans a part of a slice, from its start.
func (*Cursor) SetPosition
func (c *Cursor) SetPosition(position int)
SetPosition moves to a position.
func (*Cursor) Skip
func (c *Cursor) Skip(count uint64)
Skip skips bytes.
func (*Cursor) U32
func (c *Cursor) U32() uint32
U32 reads a little-endian uint32.
func (*Cursor) U64
func (c *Cursor) U64() uint64
U64 reads a little-endian uint64.
func (*Cursor) U8
func (c *Cursor) U8() int
U8 reads one byte.
func (*Cursor) VarInt
func (c *Cursor) VarInt() int
VarInt reads an unsigned LEB128 integer that fits an int32.
func (*Cursor) VarLong
func (c *Cursor) VarLong() uint64
VarLong reads an unsigned LEB128 integer.
func (*Cursor) ZigZagLong
func (c *Cursor) ZigZagLong() int64
ZigZagLong reads a zigzag integer.
type Edge
type Edge struct {
// Protocol is the protocol.
Protocol traffic.Protocol
// Direction is the direction.
Direction traffic.Direction
// Trust is the trust of the headers of the peer.
Trust traffic.Trust
// Peer is the kind of the peer: traffic.PeerKubFly…
Peer byte
// Names are the names of the peer: KubFly — namespace, service, pod, container, version, address; a host — the
// address; a database — the source, the address; a broker — the cluster, the destination; empty beyond.
Names [6]TextSlot
// Instance is the instance of a peer of KubFly.
Instance uuid.UUID
// Operation is the operation.
Operation TextSlot
// Route is the route.
Route TextSlot
// Count are the calls.
Count int64
// Errors are the calls that failed.
Errors int64
// Cancelled are the calls cancelled.
Cancelled int64
// Sum is the sum of the durations, ns.
Sum int64
// Min is the shortest, ns.
Min int64
// Max is the longest, ns.
Max int64
// Statuses are the answers by the class of their code, 1xx to 5xx.
Statuses [traffic.Statuses]int64
// Received are the bytes received.
Received int64
// Sent are the bytes sent.
Sent int64
// Buckets are the buckets of the histogram (RecordReader.NextBucket).
Buckets int
}
Edge is an edge of TRAFFIC as a RecordReader read it, the view reused (traffic.Edge holds the same).
type EntitiesField
type EntitiesField struct {
// Name is the name of the field.
Name string
// Kind is the kind of the field: boolean, int, long, double, float, string, zone, enum:T, list:K, record:T.
Kind string
}
EntitiesField is a field of a version of an entity.
func EntitiesCurrent
func EntitiesCurrent(typ reflect.Type) []EntitiesField
EntitiesCurrent are the fields of a Go type of an entity now, as the table must hold them for its latest version.
func EntitiesFields
func EntitiesFields(name string, version int) ([]EntitiesField, bool)
EntitiesFields are the fields of a version of a type, and whether the table has it.
type EntitiesOutcome
type EntitiesOutcome int
EntitiesOutcome is what a reading of an entity gave.
const ( // EntitiesNone is version 0: no entity. EntitiesNone EntitiesOutcome = iota // EntitiesValue is the entity. EntitiesValue // EntitiesNewer is an entity newer than this reader, it or a required part of it: passed over by its length, // the report tells what and where. EntitiesNewer )
func EntitiesReadNewer
func EntitiesReadNewer[T any](reader *buffer.Reader, newer *Newer) (*T, EntitiesOutcome, error)
EntitiesReadNewer reads an entity of any version known to entities.tsv into a new T; one newer than this reader is passed over by its length and told to the report (decision 89), and so is one whose required part is newer. A part newer than the reader in a list is left out of the list. A nil report makes a newer entity a *Error, as EntitiesRead. Only damaged data is an error.
type Error
type Error struct {
// Message tells what is wrong.
Message string
// Err is the cause, or nil.
Err error
}
Error is data that is not valid in the KubFly format: a wrong magic or version, a checksum that does not match, a record that does not end where its frame says.
func (*Error) Error
func (e *Error) Error() string
Error is the message, with the cause.
func (*Error) Unwrap
func (e *Error) Unwrap() error
Unwrap is the cause.
type Newer
type Newer struct {
// contains filtered or unexported fields
}
Newer is what a reading passed over as newer than this reader (decision 89): records of a type it does not know, entities of a version it does not know. Of a fixed size, whatever was read: the newest version of the SDK among the writers of what was passed over, how much, the first and the last time, and a summary by kind of NewerKinds kinds at most; the passes of the kinds beyond are counted together. One reading fills one, on its goroutine; a timeline of the reflector gives that of its last iteration. The zero value is empty and ready.
func (*Newer) At
func (n *Newer) At(time int64)
At tells that a record begins: its time, ms of the epoch.
func (*Newer) Copy
func (n *Newer) Copy() *Newer
Copy is a copy of the report as it is now.
func (*Newer) Empty
func (n *Newer) Empty() bool
Empty tells whether nothing was passed over.
func (*Newer) First
func (n *Newer) First() (int64, bool)
First is the time of the first record passed over, ms of the epoch; false if nothing was passed over.
func (*Newer) Kinds
func (n *Newer) Kinds() []NewerKind
Kinds is what was passed over, by kind, in the order first met: NewerKinds kinds at most.
func (*Newer) Last
func (n *Newer) Last() (int64, bool)
Last is the time of the last record passed over, ms of the epoch; false if nothing was passed over.
func (*Newer) Merge
func (n *Newer) Merge(other *Newer)
Merge adds another report: of a part of a merged timeline.
func (*Newer) Others
func (n *Newer) Others() int64
Others is the count of the passes of the kinds beyond the summary.
func (*Newer) Passed
func (n *Newer) Passed(what, where string)
Passed tells that something newer was passed over in the record at hand; where is empty for a record.
func (*Newer) SDK
func (n *Newer) SDK() (util.Version, bool)
SDK is the newest version of the SDK among the writers of what was passed over: update to it or newer; false if nothing was passed over, or no header told it.
func (*Newer) Segment
func (n *Newer) Segment(writer util.Version)
Segment tells that a segment begins: the version of the SDK that wrote it, from its header.
func (*Newer) Skipped
func (n *Newer) Skipped() int64
Skipped is how many records and parts were passed over.
func (*Newer) String
func (n *Newer) String() string
String is the text form, for a message: "12 newer than this reader (KubFly SDK 1.7.3)".
type NewerKind
type NewerKind struct {
What string
Where string
Count int64
}
NewerKind is a kind of what was passed over: what — "usage.storage.Disk v2", "record type 21" — and where, the owner and its field ("Usage.storage"), empty for a record; how many times.
type RecordReader
type RecordReader struct {
// contains filtered or unexported fields
}
RecordReader reads the body of a record without allocating — RecordReader of the Java SDK: the fields of the record (format.md §4.4) as numbers and TextSlot views, then what repeats — tags, exceptions with their frames, snapshots, edges, rows — one at a time, each view reused. It serves the outputs that turn records into text (output/console); the reflector decodes into objects instead. Reset reads the head of a body, the Next methods the rest in its order; Finish skips what was not read and checks that the body ends where it was read to.
A damaged body panics with a *Error that names the type of the record, the offset and the rule broken — never the text of the record. Views are valid until the next call that reads on; Value.Arg makes an object, allocating. Not safe for concurrent use: a reader per goroutine.
func NewRecordReader
func NewRecordReader(registry Registry) *RecordReader
NewRecordReader is a reader of bodies whose numbers a registry knows.
func (*RecordReader) Argument
func (r *RecordReader) Argument(index int) *Value
Argument is an argument of EVENT.
func (*RecordReader) Arguments
func (r *RecordReader) Arguments() int
Arguments are the arguments of EVENT: 0 to MaxArguments.
func (*RecordReader) Begin
func (r *RecordReader) Begin() int64
Begin is the beginning of the interval of ALERT, METRICS, TRAFFIC or PROFILE, ms.
func (*RecordReader) BucketCount
func (r *RecordReader) BucketCount() int64
BucketCount are the observations of the bucket read.
func (*RecordReader) BucketIndex
func (r *RecordReader) BucketIndex() int
BucketIndex is the index of the bucket read.
func (*RecordReader) CallerFrame
func (r *RecordReader) CallerFrame() int64
CallerFrame is the frame of the caller in its process, or its span.
func (*RecordReader) CallerInstance
func (r *RecordReader) CallerInstance() uuid.UUID
CallerInstance is the instance of the caller; zero — a caller without the SDK.
func (*RecordReader) CallerTrace
func (r *RecordReader) CallerTrace() uuid.UUID
CallerTrace is the trace of the caller.
func (*RecordReader) ClockBucket
func (r *RecordReader) ClockBucket() int64
ClockBucket is the clock of the bucket of CLOCK, ms.
func (*RecordReader) ClockLocal
func (r *RecordReader) ClockLocal() int64
ClockLocal is the local clock less that of the bucket, ms.
func (*RecordReader) Criticals
func (r *RecordReader) Criticals() int64
Criticals are the observations of ALERT beyond the critical threshold.
func (*RecordReader) Depth
func (r *RecordReader) Depth() int
Depth is the depth of the frame of BEGIN.
func (*RecordReader) Duration
func (r *RecordReader) Duration() int64
Duration is the duration of END or of a check, ns.
func (*RecordReader) End
func (r *RecordReader) End() int64
End is the end of the interval, ms.
func (*RecordReader) ExceptionClass
func (r *RecordReader) ExceptionClass() *TextSlot
ExceptionClass is the class of the exception read.
func (*RecordReader) ExceptionCut
func (r *RecordReader) ExceptionCut() bool
ExceptionCut tells that causes or suppressed exceptions of the exception read were cut at the limits of the SDK.
func (*RecordReader) ExceptionDepth
func (r *RecordReader) ExceptionDepth() int
ExceptionDepth is the depth of the exception read: 0 for the exception of the record.
func (*RecordReader) ExceptionFrames
func (r *RecordReader) ExceptionFrames() int
ExceptionFrames are the frames of the exception read.
func (*RecordReader) ExceptionMessage
func (r *RecordReader) ExceptionMessage() *TextSlot
ExceptionMessage is the message of the exception read; null without one.
func (*RecordReader) ExceptionRole
func (r *RecordReader) ExceptionRole() int
ExceptionRole is the role of the exception read: ExceptionRoot, ExceptionCausedBy or ExceptionSuppressed.
func (*RecordReader) Finish
func (r *RecordReader) Finish()
Finish skips what was not read and checks that the body ends where it was read to.
func (*RecordReader) FrameClass
func (r *RecordReader) FrameClass() *TextSlot
FrameClass is the class of the frame read.
func (*RecordReader) FrameDelta
func (r *RecordReader) FrameDelta() int64
FrameDelta is the number of the record less that of its frame (EVENT in a frame, END) or of the parent (BEGIN; 0 for a root).
func (*RecordReader) FrameFile
func (r *RecordReader) FrameFile() *TextSlot
FrameFile is the file of the frame read; empty when unknown.
func (*RecordReader) FrameLine
func (r *RecordReader) FrameLine() int
FrameLine is the line of the frame read: -1 unknown, -2 a native method.
func (*RecordReader) FrameMethod
func (r *RecordReader) FrameMethod() *TextSlot
FrameMethod is the method of the frame read.
func (*RecordReader) GapBytes
func (r *RecordReader) GapBytes() int64
GapBytes are the bytes of GAP.
func (*RecordReader) GapReason
func (r *RecordReader) GapReason() int
GapReason is the reason of GAP.
func (*RecordReader) GapRecords
func (r *RecordReader) GapRecords() int64
GapRecords are the records of GAP.
func (*RecordReader) GapSegments
func (r *RecordReader) GapSegments() int64
GapSegments are the segments of GAP.
func (*RecordReader) HasCaller
func (r *RecordReader) HasCaller() bool
HasCaller tells that BEGIN has a caller in another process; it skips the tags not read.
func (*RecordReader) HasException
func (r *RecordReader) HasException() bool
HasException tells that the record carries an exception.
func (*RecordReader) InFrame
func (r *RecordReader) InFrame() bool
InFrame tells that EVENT happened in a frame.
func (*RecordReader) Level
func (r *RecordReader) Level() api.Level
Level is the level of EVENT.
func (*RecordReader) Message
func (r *RecordReader) Message() *TextSlot
Message is the template of EVENT or the message of HEALTH_CHANGE.
func (*RecordReader) Metric
func (r *RecordReader) Metric() int
Metric is the number of the metric of ALERT.
func (*RecordReader) NextBucket
func (r *RecordReader) NextBucket() bool
NextBucket reads the next bucket of the histogram of the snapshot or the edge read: false when none is left.
func (*RecordReader) NextEdge
func (r *RecordReader) NextEdge() *Edge
NextEdge is the next edge of TRAFFIC, its buckets not read yet; nil when none is left.
func (*RecordReader) NextException
func (r *RecordReader) NextException() bool
NextException reads the next exception of the tree, in pre-order: the exception of the record, its cause and the cause's tree, then the suppressed ones and theirs — the depth and the role tell where it is; false when none is left. It skips the tags not read.
func (*RecordReader) NextFrame
func (r *RecordReader) NextFrame() bool
NextFrame reads the next frame of the exception read: false when none is left.
func (*RecordReader) NextRow
func (r *RecordReader) NextRow() *Row
NextRow is the next row of PROFILE; nil when none is left.
func (*RecordReader) NextSnapshot
func (r *RecordReader) NextSnapshot() *Snapshot
NextSnapshot is the next snapshot of METRICS, its buckets not read yet; nil when none is left.
func (*RecordReader) NextTag
func (r *RecordReader) NextTag() bool
NextTag reads the next tag — the last added first, as the body holds them: false when none is left.
func (*RecordReader) Path
func (r *RecordReader) Path(index int) *TextSlot
Path is a level of the path: project, module, area, system and, for BEGIN and health, the component; empty beyond.
func (*RecordReader) Period
func (r *RecordReader) Period() int64
Period is the period of the samples of PROFILE, ns.
func (*RecordReader) Point
func (r *RecordReader) Point(time int64) *Value
Point is the point of TRACK: a value of the kind TRACK_POINT — the track, the place — its time of the fix that of the record less the difference the record keeps (format.md §9c), from the real time of the record (time − late), ms; valid until the reader reads on.
func (*RecordReader) Profile
func (r *RecordReader) Profile() profile.Kind
Profile is the kind of PROFILE.
func (*RecordReader) Reset
func (r *RecordReader) Reset(typ int, body []byte, from int, to int) *RecordReader
Reset reads the head of a body of a given type: the bytes from..to. The flag of a late record is ignored.
func (*RecordReader) Severity
func (r *RecordReader) Severity() alert.Severity
Severity is the severity of a check or an alert.
func (*RecordReader) Size
func (r *RecordReader) Size() int
Size is the count of snapshots, edges or rows.
func (*RecordReader) TagKey
func (r *RecordReader) TagKey() *TextSlot
TagKey is the key of the tag read.
func (*RecordReader) TagValue
func (r *RecordReader) TagValue() *TextSlot
TagValue is the value of the tag read: always a string (format.md §4.2).
func (*RecordReader) Tags
func (r *RecordReader) Tags() int
Tags are the tags not read yet.
func (*RecordReader) Thread
func (r *RecordReader) Thread() *TextSlot
Thread is the name of the thread; empty without a thread.
func (*RecordReader) ThreadID
func (r *RecordReader) ThreadID() int64
ThreadID is the number of the thread of BEGIN, EVENT or END; 0 — none (a goroutine has none).
func (*RecordReader) Type
func (r *RecordReader) Type() int
Type is the type of the record, without the flag of a late one.
func (*RecordReader) Unassessed
func (r *RecordReader) Unassessed() int64
Unassessed are the observations of ALERT without thresholds.
func (*RecordReader) Warnings
func (r *RecordReader) Warnings() int64
Warnings are the observations of ALERT beyond the warning threshold.
type Registry
type Registry interface {
// Text is the string of a number of the dictionary; false when it is not registered.
Text(id int) (string, bool)
// Frames are the frames of a number of a stack trace; false when it is not registered.
Frames(id int) ([]api.StackFrame, bool)
}
Registry is where a RecordReader finds the strings and the stack traces the bodies refer to by number: the registries of the pipeline (pipeline.Pipeline.Reader) or of a segment.
type Row
type Row struct {
// Node is the number of the node of the stack; 0 — the others.
Node int
// Truncated tells that the stack was cut.
Truncated bool
// Count are the samples.
Count int64
// Value is the value: ns or bytes.
Value int64
// Type is the type allocated, for a profile of allocations.
Type TextSlot
}
Row is a row of PROFILE as a RecordReader read it, the view reused.
type Snapshot
type Snapshot struct {
// Metric is the number of the metric.
Metric int
// Count are the observations.
Count int64
// Sum is the sum.
Sum int64
// Min is the least.
Min int64
// Max is the greatest.
Max int64
// Last is the last.
Last int64
// Rejected are the observations rejected.
Rejected int64
// Severity is the severity of the interval.
Severity alert.Severity
// Warnings are the observations beyond the warning threshold.
Warnings int64
// Criticals are the observations beyond the critical threshold.
Criticals int64
// Unassessed are the observations without thresholds.
Unassessed int64
// Limited are the observations of a percentage.
Limited int64
// LimitMin is the least limit.
LimitMin int64
// LimitMax is the greatest limit.
LimitMax int64
// Buckets are the buckets of the histogram (RecordReader.NextBucket).
Buckets int
}
Snapshot is a snapshot of METRICS as a RecordReader read it, the view reused (api.Snapshot holds the same).
type TextSlot
type TextSlot struct {
// contains filtered or unexported fields
}
TextSlot is a string a RecordReader read, without a copy: a string of the dictionary of the process, or bytes of UTF-8 inside the body — a view valid until the reader reads on. String makes a string of the bytes (it allocates for inline bytes); AppendTo and Bytes do not — TextSlot of the Java SDK.
func (*TextSlot) AppendTo
func (t *TextSlot) AppendTo(target []byte) []byte
AppendTo appends the bytes of the text to a slice.
func (*TextSlot) Bytes
func (t *TextSlot) Bytes() []byte
Bytes are the bytes of UTF-8 of an inline text, nil for a string of the dictionary; valid until the reader reads on.
func (*TextSlot) Cut
func (t *TextSlot) Cut() bool
Cut tells that a string value was cut to the limit of the SDK.
func (*TextSlot) Equal
func (t *TextSlot) Equal(other string) bool
Equal tells whether the text is a given string, without allocating.
func (*TextSlot) ID
func (t *TextSlot) ID() int
ID is the number of the string in the dictionary of the process, -1 for a text that is not one.
func (*TextSlot) Inline
func (t *TextSlot) Inline() bool
Inline tells that the text is bytes of the body (Bytes), not a string of the dictionary.
func (*TextSlot) IsEmpty
func (t *TextSlot) IsEmpty() bool
IsEmpty tells that the text has no characters.
func (*TextSlot) IsNull
func (t *TextSlot) IsNull() bool
IsNull tells that there was no string at all: a null value, an exception without a message.
func (*TextSlot) String
func (t *TextSlot) String() string
String is the text as a string: a copy of inline bytes, the string itself otherwise.
type Value
type Value struct {
// contains filtered or unexported fields
}
Value is a value a RecordReader read — an argument or the value of a tag — as numbers and views, valid until the reader reads on: Bits for the primitives, TextSlot and Type for strings, enums, objects and zones, UUID, the seconds, nanoseconds and offset of the times, Magnitude for big numbers and blobs. Arg makes the api.Arg, allocating.
func (*Value) Accuracy
func (v *Value) Accuracy() int64
Accuracy is the accuracy of a TRACK_POINT, millimetres, or util.Unknown.
func (*Value) Altitude
func (v *Value) Altitude() int64
Altitude is the altitude of a LOCATION or a TRACK_POINT over the WGS84 ellipsoid, millimetres, or util.Unknown.
func (*Value) Arg
func (v *Value) Arg() api.Arg
Arg is the value as the API holds it, decoded again from its bytes: it allocates. A value out of the range of its kind panics with a *Error.
func (*Value) Attachment
func (v *Value) Attachment() *api.Attachment
Attachment is the attachment of a value (Separate), made now: that of a BLOB or an IMAGE, that of the whole of a cut STRING (of the type api.AttachmentText, without an identifier); nil for any other value.
func (*Value) Bits
func (v *Value) Bits() uint64
Bits are the bits of a primitive: 0 or 1, a UTF-16 unit, an int64 or uint64, the bits of a float64; 0 for a reference.
func (*Value) Float64
func (v *Value) Float64() float64
Float64 is the value of DOUBLE.
func (*Value) Heading
func (v *Value) Heading() int64
Heading is the heading of a TRACK_POINT, 0.01 degrees, or util.Unknown.
func (*Value) IsNull
func (v *Value) IsNull() bool
IsNull tells that the value is null.
func (*Value) Kind
func (v *Value) Kind() api.ArgumentKind
Kind is the kind of the value.
func (*Value) Latitude
func (v *Value) Latitude() int64
Latitude is the latitude of a LOCATION or a TRACK_POINT, 1e-7 degrees; 0 for other kinds.
func (*Value) Longitude
func (v *Value) Longitude() int64
Longitude is the longitude of a LOCATION or a TRACK_POINT, 1e-7 degrees; 0 for other kinds.
func (*Value) Magnitude
func (v *Value) Magnitude() []byte
Magnitude are the bytes of BIG_INTEGER and BIG_DECIMAL, the data of BLOB and IMAGE (the SHA-256 of one that is Separate); valid until the reader reads on.
func (*Value) Nanos
func (v *Value) Nanos() int64
Nanos are the nanoseconds of a time.
func (*Value) Offset
func (v *Value) Offset() int32
Offset is the offset of a time from UTC, seconds; the scale of BIG_DECIMAL.
func (*Value) Pack
func (v *Value) Pack() int64
Pack is the pack of an attachment (Separate), from 1; 0 — kept nowhere.
func (*Value) PackOffset
func (v *Value) PackOffset() int64
PackOffset is the offset of an attachment in its pack.
func (*Value) Seconds
func (v *Value) Seconds() int64
Seconds are the seconds of INSTANT, DURATION and the dates and times with a date (days for LOCAL_DATE).
func (*Value) Separate
func (v *Value) Separate() bool
Separate tells whether a BLOB, an IMAGE or the whole of a cut STRING is an *api.Attachment, in a pack of attachments or kept nowhere (Pack 0): its Magnitude is the SHA-256 of its content, none if kept nowhere.
func (*Value) Size
func (v *Value) Size() int64
Size is the size of the content of a BLOB or an IMAGE, of the whole UTF-8 of a STRING in a pack of attachments, bytes.
func (*Value) Speed
func (v *Value) Speed() int64
Speed is the speed of a TRACK_POINT, millimetres a second, or util.Unknown.
func (*Value) Text
func (v *Value) Text() *TextSlot
Text is the text of STRING and OBJECT, the name of ENUM, the zone of ZONED_DATE_TIME, the track of TRACK_POINT; null for a null value.
func (*Value) Time
func (v *Value) Time() int64
Time is the time of the fix of a TRACK_POINT, ms of the epoch; 0 for other kinds.
func (*Value) Type
func (v *Value) Type() *TextSlot
Type is the type of ENUM and OBJECT, the media type of BLOB and IMAGE.
func (*Value) UUID
func (v *Value) UUID() uuid.UUID
UUID is the value of UUID, the identifier of BLOB and IMAGE.