{"id":20188542,"url":"https://github.com/jiacai2050/prom-remote-api","last_synced_at":"2025-04-10T06:51:00.263Z","repository":{"id":65322202,"uuid":"589211245","full_name":"jiacai2050/prom-remote-api","owner":"jiacai2050","description":"Prometheus remote storage API for Rust","archived":false,"fork":false,"pushed_at":"2023-05-27T12:16:55.000Z","size":94,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T07:56:54.483Z","etag":null,"topics":["prometheus","prometheus-monitoring-solution","remote-storage","rust","rust-api"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/prom-remote-api","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jiacai2050.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-01-15T12:58:24.000Z","updated_at":"2024-01-02T12:41:53.000Z","dependencies_parsed_at":"2024-01-15T01:08:02.171Z","dependency_job_id":"f55468eb-ee05-4b0c-ae79-a009c8e4ad17","html_url":"https://github.com/jiacai2050/prom-remote-api","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"f73668a1c3c0d0d835a2b40287d6f02312193e1c"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fprom-remote-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fprom-remote-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fprom-remote-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fprom-remote-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jiacai2050","download_url":"https://codeload.github.com/jiacai2050/prom-remote-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248173852,"owners_count":21059595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["prometheus","prometheus-monitoring-solution","remote-storage","rust","rust-api"],"created_at":"2024-11-14T03:29:35.468Z","updated_at":"2025-04-10T06:51:00.216Z","avatar_url":"https://github.com/jiacai2050.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prom-remote-api\n\n[![Crates.io](https://img.shields.io/crates/v/prom-remote-api.svg)](https://crates.io/crates/prom-remote-api)\n[![docs.rs](https://img.shields.io/docsrs/prom-remote-api/latest)](https://docs.rs/prom-remote-api)\n[![](https://github.com/jiacai2050/prom-remote-api/actions/workflows/ci.yml/badge.svg)](https://github.com/jiacai2050/prom-remote-api/actions/workflows/ci.yml)\n\n\nPrometheus [remote storage](https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations) API for Rust.\n\n## Usage\n\nThere are two interfaces in Prometheus remote storage API: write/read.\n\nBoth interfaces use a snappy-compressed protocol buffer encoding over HTTP.\n\nThis crate provides:\n- Rust-binding to [prometheus remote storage protocol buffer definitions](https://github.com/prometheus/prometheus/blob/main/prompb/remote.proto)\n- Various web framework utils to serve the remote wire protocols, which are controlled by corresponding feature-gates. Available features:\n  - `warp`\n  - `actix`\n  - more web framework will be added\n\nAny third-party storage can integrate with Prometheus by implementing `RemoteStorage` trait.\n\n```rust\npub trait RemoteStorage: Sync {\n    type Err: Send;\n    type Context: Send + Sync;\n\n    /// Write samples to remote storage.\n    async fn write(\u0026self, ctx: Self::Context, req: WriteRequest) -\u003e Result\u003c(), Self::Err\u003e;\n\n    /// Process one query within [ReadRequest](crate::types::ReadRequest).\n    ///\n    /// Note: Prometheus remote protocol sends multiple queries by default,\n    /// use [read](crate::types::RemoteStorage::read) to serve ReadRequest.\n    async fn process_query(\n        \u0026self,\n        ctx: \u0026Self::Context,\n        q: Query,\n    ) -\u003e Result\u003cQueryResult, Self::Err\u003e;\n\n    /// Read samples from remote storage.\n    ///\n    /// [ReadRequest](crate::types::ReadRequest) may contain more than one sub [queries](crate::types::Query).\n    async fn read(\n        \u0026self,\n        ctx: Self::Context,\n        req: ReadRequest,\n    ) -\u003e Result\u003cReadResponse, Self::Err\u003e {\n        let results = futures::future::join_all(\n            req.queries\n                .into_iter()\n                .map(|q| async { self.process_query(\u0026ctx, q).await }),\n        )\n        .await\n        .into_iter()\n        .collect::\u003cResult\u003cVec\u003c_\u003e, Self::Err\u003e\u003e()?;\n\n        Ok(ReadResponse { results })\n    }\n}\n```\n\nSee [warp-demo.rs](examples/warp-demo.rs), [actix-demo.rs](examples/actix-demo.rs) to learn how to build a remote storage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiacai2050%2Fprom-remote-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiacai2050%2Fprom-remote-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiacai2050%2Fprom-remote-api/lists"}