Skip to content

Commit

Permalink
Fix/tvl (#15)
Browse files Browse the repository at this point in the history
* fix: add build target

* fix: handle empty results from grafana more gracefully.
  • Loading branch information
crebsy committed Apr 21, 2023
1 parent 1347462 commit 1bd78a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: "3.7"

services:
yearn-exporter-api:
build: .
image: ghcr.io/yearn/yearn-exporter-api:${DOCKER_TAG:-latest}
ports:
- 127.0.0.1:${FLASK_RUN_PORT:-5000}:${FLASK_RUN_PORT:-5000}
Expand Down
6 changes: 5 additions & 1 deletion grafana.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ def get_for(key, ts, unit):


def _ds_parse_value(response):
data = response['results']['A']['frames'][0]['data']
frames = response['results']['A']['frames']
if len(frames) == 0:
return 0

data = frames[0]['data']
values = data['values'][1]
value = 0
for i in range(len(values)-1, -1, -1):
Expand Down

0 comments on commit 1bd78a2

Please sign in to comment.