- Make sure you have a valid access token based on this guide
- Paste your token in config.py under
OPERATE_FIRST_TOKEN
- Validate that the
THANOS_URL
in config.py directs to the correct server - Make sure all the packages in the requirements file installed on your environment
- thanos_api_client.py - A wrapper class to PrometheusConnect that adds convenient methods for fetching Prometheus data
- preprocess_thanos.py - Demonstration of fetching prometheus data using our wrapper class, exporting it to csv or plotting it to a graph.
- preprocess_thanos.py - configure the arguments of
start_preprocessing
method and run preprocess_thanos.py - thanos_api_client - Consists of the wrapper methods we built over the Prometheus client.
ThanosConnect
- Connects to the Thanos server based on the provided token.build_query
- A query for the Thanos server consists of two parts - metrics name and labels config. This method formulates a valid query for the server based on the given labels-config and metrics-name.range_query
our custom built-in function that queries the server (usage example is provided inpreprocess_thanos.py
)metric_data_to_df
- A parser method that converts the received metric data into Pandas Dataframe object.query_label_values
- Returns all possible values of a given label. We implemented this function based on the official documentation. For more information can check this link