This project provides a Python client for interacting with the Gimlet's control plane to fetch metrics. The client sends a RangeQuery
request to the server and displays the resulting metric data in a formatted table.
- Connects to a gRPC server with SSL/TLS.
- Sends a
RangeQuery
request with custom query and time window parameters. - Displays metric data in a tabulated format.
- Python 3.6+
grpcio
andgrpcio-tools
packagestabulate
packagecolored
package
-
Clone the repository:
git clone https://github.com/gimletlabs/metricsample.py.git cd metricsample.py
-
Install the required packages:
pip install -r requirements.txt
- Set the GML_API_KEY environment variable with your API key:
export GML_API_KEY=your_api_key_here
- Run the client:
python client.py [--server_addr <server_address>] [--query <query>] [--relative <relative_time_window>]
--server_addr
: (Optional) The address of the gRPC server (e.g., app.gimletlabs.ai:443).--query
: (Optional) The PromQL query string (default: gml_gem_image_quality_brisque_score).--relative
: (Optional) The relative time window to query (default: 5m).
export GML_API_KEY=your_api_key_here
python client.py --server_addr app.gimletlabs.ai:443 --query "gml_gem_image_quality_brisque_score" --relative "10m"
- client.py: The main script that sends the gRPC request and displays the results.
- metricsreader/: Directory containing generated protobuf files.
This project is licensed under the Apache License. See the LICENSE file for details.