Skip to content

Commit

Permalink
Add api.v2/elasticsearch-health route helper, like PA has
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmwatson committed Aug 19, 2024
1 parent 89c12aa commit efa38d8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pmg/api/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from sqlalchemy.orm import defer, noload
from sqlalchemy.sql.expression import nullslast
from pmg.bill_tracker import produce_bill_tracker_json
from pmg import app
import requests

from pmg import cache, cache_key, should_skip_cache
from pmg.models import (
Expand Down Expand Up @@ -265,3 +267,10 @@ def bill_tracker():
def bill_tracker_update():
produce_bill_tracker_json()
return "/v2/bill-tracker JSON updated"


@api.route("/elasticsearch-health")
def elasticsearch_health():
r = requests.get("%s/_cluster/health?pretty=true" % app.config["ES_SERVER"])
r.raise_for_status()
return r.json()

0 comments on commit efa38d8

Please sign in to comment.