Trait RemoteStorage

Source
pub trait RemoteStorage: Sync {
    type Err: Send;
    type Context: Send + Sync;

    // Required methods
    fn write<'life0, 'async_trait>(
        &'life0 self,
        ctx: Self::Context,
        req: WriteRequest,
    ) -> Pin<Box<dyn Future<Output = StdResult<(), Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn process_query<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Self::Context,
        q: Query,
    ) -> Pin<Box<dyn Future<Output = StdResult<QueryResult, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn read<'life0, 'async_trait>(
        &'life0 self,
        ctx: Self::Context,
        req: ReadRequest,
    ) -> Pin<Box<dyn Future<Output = StdResult<ReadResponse, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Remote storage is Prometheus’s solution for long-term storage.

Third-party storage can be integrated with Prometheus by implement this trait. https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations

Required Associated Types§

Source

type Err: Send

The type of failures yielded when write and read.

Source

type Context: Send + Sync

The type of request-scoped values provided for write and read.

Required Methods§

Source

fn write<'life0, 'async_trait>( &'life0 self, ctx: Self::Context, req: WriteRequest, ) -> Pin<Box<dyn Future<Output = StdResult<(), Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Write samples to remote storage.

Source

fn process_query<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 Self::Context, q: Query, ) -> Pin<Box<dyn Future<Output = StdResult<QueryResult, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Process one query within ReadRequest.

Note: Prometheus remote protocol sends multiple queries by default, use read to serve ReadRequest.

Provided Methods§

Source

fn read<'life0, 'async_trait>( &'life0 self, ctx: Self::Context, req: ReadRequest, ) -> Pin<Box<dyn Future<Output = StdResult<ReadResponse, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read samples from remote storage.

ReadRequest may contain more than one sub queries.

Implementors§