Module loki

Source

StructsΒ§

JsonStreamItem πŸ”’
LOKI_INIT_SCHEMAS πŸ”’
LokiJsonParser πŸ”’
LokiMiddleItem
This is the holder of the loki lines parsed from json or protobuf. The generic here is either serde_json::Value or Vec. Depending on the target destination, this can be converted to LokiRawItem or LokiPipeline.
LokiPbParser
LokiPipeline
This is the line item prepared for the pipeline engine.
LokiRawItem
This is the line item for the Loki raw ingestion. We’ll persist the line in its whole, set labels into tags, and structured metadata into a big JSON.
PbStreamItem

ConstantsΒ§

LABEL_KEY πŸ”’
LINES_KEY πŸ”’
LOKI_LINE_COLUMN πŸ”’
LOKI_LINE_COLUMN_NAME πŸ”’
LOKI_PIPELINE_LABEL_PREFIX πŸ”’
LOKI_PIPELINE_METADATA_PREFIX πŸ”’
LOKI_STRUCTURED_METADATA_COLUMN πŸ”’
LOKI_TABLE_NAME πŸ”’
STREAMS_KEY πŸ”’

FunctionsΒ§

extract_item πŸ”’
This is the flow of the Loki ingestion. +––––+ | bytes | +––––+ | +–––––––––––+–––––––––––+ | | | | JSON content type | PB content type | +–––––––––––+–––––––––––+ | | | | JsonStreamItem | PbStreamItem | | stream: serde_json | stream: adapter | +–––––––––––+–––––––––––+ | | | | MiddleItem<serde_json> | MiddleItem | +–––––––––––+–––––––––––+ \ / \ / \ / +–––––––––––+ | MiddleItem | +–––––––––––+ | +––––––––+––––––––+ | | +β€”β€”β€”β€”β€”β€”+ +β€”β€”β€”β€”β€”β€”β€”+ | LokiRawItem | | LokiPipelineItem | +β€”β€”β€”β€”β€”β€”+ +β€”β€”β€”β€”β€”β€”β€”+ | | +β€”β€”β€”β€”β€”β€”+ +β€”β€”β€”β€”β€”β€”β€”+ | Loki ingest | | run_pipeline | +β€”β€”β€”β€”β€”β€”+ +β€”β€”β€”β€”β€”β€”β€”+
init_row πŸ”’
loki_ingest
parse_loki_labels
since we’re hand-parsing the labels, if any error is encountered, we’ll just skip the label note: pub here for bench usage ref:
process_labels πŸ”’
prost_ts_to_nano πŸ”’