prom-remote-api 0.2.0

Prometheus remote storage API for Rust
Documentation

prom-remote-api

Crates.io docs.rs

Prometheus remote storage API for Rust.

Usage

There are two interfaces in Prometheus remote storage API: write/read.

Both interfaces use a snappy-compressed protocol buffer encoding over HTTP.

This crate provides:

Any third-party storage can integrate with Prometheus by implementing this RemoteStorage trait.

#[async_trait]
pub trait RemoteStorage {
    type Err;
    type Context;

    /// Write samples to remote storage
    async fn write(
        &self,
        ctx: Self::Context,
        req: WriteRequest,
    ) -> std::result::Result<(), Self::Err>;

    /// Read samples from remote storage,
    /// [ReadRequest](crate::types::ReadRequest) may contain more than one sub queries.
    async fn read(
        &self,
        ctx: Self::Context,
        req: ReadRequest,
    ) -> std::result::Result<ReadResponse, Self::Err>;
}

See simple.rs to learn how to build a remote storage with warp web framework.