This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Prometheus Loader | ||
|
||
This loader loads metrics from Prometheus. The user specifies a Prometheus instance to initialize the reader. They then specify the query, the date range, steps, Http parameters and which fields must be used as metadata. | ||
|
||
Automatically adds to the metadata the timestamp value and create a document per value returned by the prometheus query. | ||
|
||
## Usage | ||
|
||
Here's an example usage of the PrometheusReader. | ||
|
||
```python | ||
from llama_index import download_loader | ||
import os | ||
|
||
PrometheusReader = download_loader('PrometheusReader') | ||
|
||
endpoint = "<endpoint>" | ||
size = "<size>" | ||
# query_dict is passed into db.collection.find() | ||
query = "" | ||
end_time = datetime.utcnow() | ||
start_time = end_time - timedelta(hours=1) | ||
metadata_fields = ['id', "host"] | ||
reader = PrometheusReader(endpoint, size) | ||
documents = reader.load_data(query=query, | ||
start_time=start_time, | ||
end_time=end_time, | ||
step="1m", | ||
get_pararameters=None, | ||
metadata_fields=metadata_fields) | ||
``` |