Skip to content
Snippets Groups Projects
Commit b49870dd authored by Maaz Ahmed's avatar Maaz Ahmed
Browse files

doc: update README

parent fa2dd0b5
No related branches found
No related tags found
1 merge request!6Resolve "Update repo level docs and release 0.3.0"
# mquery # mquery
A Rust library for handling PROMQL (and possibly MetricsQL) queries. `mquery`, short for (M)etrics Query, is a Rust library for handling PROMQL (and possibly MetricsQL) queries.
The library internally uses `prometheus-http-query` crate. As the name suggests, mquery is mainly focused on dealing with metrics queries and the resulting data, and nothing else. The aforementioned library is better suited when functionality related to the full HTTP API offered by Prometheus and other compatible solutions is required.
The library supports raw queries (strings) as well as typed queries (builder API). The builder API is provided through the type `Metric` and `Scalar` types found in the `query` module. Note that the builder API doesn't prevent you from writing invalid queries, it only helps you avoid errors to a certain degree.
Any additional utilities related to handling and processing the query data can be found in the `utils` module which is placed under the `utils` feature flag.
A compile time query validation like the one found in the `sqlx` crate is on the roadmap.
## Usage Example ## Usage Example
```rust ```rust
...@@ -20,6 +28,9 @@ async fn main() { ...@@ -20,6 +28,9 @@ async fn main() {
.expect("operation failed"); .expect("operation failed");
} }
``` ```
# Debugging
When you keep getting the error `Client(ClientError("failed to parse response from server due to invalid media type"))` and cannot figure out what might be wrong, it is likely that the server URL is the culprit. Ensure that only the base URL to the server is passed to the `QueryManager` which shouldn't contain the API endpoint path like `/api/v1/query`.
# Testing # Testing
Requires a local Victoria Metrics server running at `http://127.0.0.1:8428/` for the integration tests to work. Requires a local Victoria Metrics server running at `http://127.0.0.1:8428/` for the integration tests to work.
...@@ -28,8 +39,13 @@ Requires a local Victoria Metrics server running at `http://127.0.0.1:8428/` for ...@@ -28,8 +39,13 @@ Requires a local Victoria Metrics server running at `http://127.0.0.1:8428/` for
- [ ] Query Builder - [ ] Query Builder
- [x] Basic queries - [x] Basic queries
- [ ] Operators - [ ] Operators
- [x] Binary Operators
- [x] Vector matching
- [ ] Aggregation operators
- [ ] Functions - [ ] Functions
- [ ] Runtime syntax checking - [ ] Runtime syntax checking
- [ ] Compile time syntax checking - [ ] Compile time syntax checking
- [ ] Deserialize to custom data types (with the help of proc-macros?) - [x] ~~Deserialize~~ Convert to custom data types
- [ ] ORM-like API to build queries using user defined types (derive macro)
- [ ] Encapsulated raw queries with methods for constructing interpolated versions - [ ] Encapsulated raw queries with methods for constructing interpolated versions
- [ ] Processing multiple queries at once
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment