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

Merge branch '8-update-repo-level-docs-and-release-0-3-0' into 'main'

Resolve "Update repo level docs and release 0.3.0"

Closes #8

See merge request subcom/mquery!6
parents fa2dd0b5 ac7004cb
No related tags found
1 merge request!6Resolve "Update repo level docs and release 0.3.0"
Pipeline #14359 passed with stages
in 1 minute and 10 seconds
......@@ -2,6 +2,34 @@
All notable changes to this project will be documented in this file.
## [0.3.0] - 2023-12-19
### Bug Fixes
- Make Duration struct's fields public
### Documentation
- Update and add missing docs
- Update README
### Features
- Type conversion utilities with parallel processing
### Miscellaneous Tasks
- Use latest rust images
- Add tags
- Include clippy component for linting
- Bump version to 0.3.0
- Generate changelog for v0.3.0
### Refactor
- Replace external error type with an internal one in pub API
- Replace external PromqlResult type with internal Data type
## [0.2.0] - 2023-12-14
### Features
......
......@@ -344,9 +344,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "hyper"
version = "0.14.27"
version = "0.14.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468"
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
dependencies = [
"bytes",
"futures-channel",
......@@ -359,7 +359,7 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite",
"socket2 0.4.10",
"socket2",
"tokio",
"tower-service",
"tracing",
......@@ -487,7 +487,7 @@ dependencies = [
[[package]]
name = "mquery"
version = "0.2.0"
version = "0.3.0"
dependencies = [
"dotenv",
"enum-as-inner",
......@@ -680,9 +680,9 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.11.22"
version = "0.11.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b"
checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41"
dependencies = [
"base64",
"bytes",
......@@ -825,16 +825,6 @@ dependencies = [
"autocfg",
]
[[package]]
name = "socket2"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "socket2"
version = "0.5.5"
......@@ -945,7 +935,7 @@ dependencies = [
"mio",
"num_cpus",
"pin-project-lite",
"socket2 0.5.5",
"socket2",
"tokio-macros",
"windows-sys 0.48.0",
]
......@@ -1146,28 +1136,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.48.0"
......
[package]
name = "mquery"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
......
# 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
```rust
......@@ -20,6 +28,9 @@ async fn main() {
.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
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
- [ ] Query Builder
- [x] Basic queries
- [ ] Operators
- [x] Binary Operators
- [x] Vector matching
- [ ] Aggregation operators
- [ ] Functions
- [ ] Runtime 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
- [ ] 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