Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Added additional metadata field on readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mjimenezp committed Feb 3, 2024
1 parent a7ac116 commit b539968
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions llama_hub/prometheus/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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.
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. Also can be added additional metadata to the values using the parameter additional_metadata.

Automatically adds to the metadata the timestamp value and create a document per value returned by the prometheus query.

Expand All @@ -21,11 +21,15 @@ query = ""
end_time = datetime.utcnow()
start_time = end_time - timedelta(hours=1)
metadata_fields = ['id', "host"]
additional_metadata = {
"collection_date": datetime.now().isoformat(),
}
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)
metadata_fields=metadata_fields,
additional_metadata=additional_metadata)
```

0 comments on commit b539968

Please sign in to comment.