Skip to content

Commit

Permalink
mute health endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshhewabi committed Jul 29, 2024
1 parent e04a710 commit 6b8fe33
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/routes/pride.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from models.upload import Upload
from sqlalchemy import text
from sqlalchemy.orm import Session, joinedload
import typing as t

from models.analysiscollection import AnalysisCollection
from models.dbsequence import DBSequence
Expand All @@ -35,6 +36,24 @@
config = configparser.ConfigParser()


class EndpointFilter(logging.Filter):
def __init__(
self,
path: str,
*args: t.Any,
**kwargs: t.Any,
):
super().__init__(*args, **kwargs)
self._path = path

def filter(self, record: logging.LogRecord) -> bool:
return record.getMessage().find(self._path) == -1


# Filter out /endpoint
logging.getLogger("uvicorn.access").addFilter(EndpointFilter(path="/health"))


@pride_router.get("/health", tags=["Admin"])
async def health(session: Session = Depends(get_session)):
"""
Expand Down

0 comments on commit 6b8fe33

Please sign in to comment.