#prometheus #time-series #gorilla #read-write #chunkenc

rusty-chunkenc

A Rust implementation of Prometheus' chunkenc library

2 releases

0.1.1 Sep 30, 2024
0.1.0 Sep 13, 2024

#456 in Encoding

Download history 94/week @ 2024-09-08 49/week @ 2024-09-15 15/week @ 2024-09-22 204/week @ 2024-09-29 7/week @ 2024-10-06

292 downloads per month

Apache-2.0

84KB
2K SLoC

rusty-chunkenc

Crates.io Documentation License

A Rust implementation of Prometheus' chunkenc library.

Features

  • Parse Prometheus XOR-encoded chunks (that are heavily inspired by Gorilla).
  • Serialise time series to Prometheus XOR-encoded chunks.
  • Read Prometheus' cold data directly from the disk.
  • Also comes with utilities to read and write varint, uvarint, varbit, varbit_ts, and varbit_xor numbers.

Why?

Prometheus uses XOR Chunks in its remote read API, and I wanted to understand how they work in detail. This crate enables SensApp to stream data to Prometheus. SensApp is written in Rust, and I wanted a chunkenc Rust implementation.

Also, writing a parser and a serialiser did sound fun.

License

Apache 2.0. Check the LICENSE file for more details.

Contributing

Feel free to report issues, contribute, or ask questions about this project.

Acknowledgements

This project is ported from Prometheus' chunkenc, that used go-tzs, that is based on the Gorilla paper. The parsing heavily relies on nom.

The project supports the Smart Building Hub research infrastructure project, which is funded by the Norwegian Research Council.

Dependencies

~1.4–2.1MB
~43K SLoC