Skip to content

Commit

Permalink
init router metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
herve.le-bars committed Oct 5, 2024
1 parent 2a1b65c commit b67533e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions backend/bloom/routers/metrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from fastapi import APIRouter, Depends, Query
from redis import Redis
from bloom.config import settings
from bloom.container import UseCases
from pydantic import BaseModel, Field
from typing_extensions import Annotated, Literal
from datetime import datetime

router = APIRouter()
redis_client = Redis(host=settings.redis_host, port=settings.redis_port, db=0)

@router.get("/metrics/vessels-in-activity/total", tags=['metrics'])
def read_metrics_vessels_in_activity_total(start_at: datetime, end_at: datetime = None):
pass

@router.get("/metrics/zone-visited/total", tags=['metrics'])
def read_metrics_vessels_in_activity_total(start_at: datetime, end_at: datetime = None):
pass

@router.get("/metrics/vessels/{vessel_id}/visits/{visit_type}", tags=['metrics'])
def read_metrics_vessels_visits_by_visit_type(
vessel_id: int,
visit_type: str,
start_at: datetime,
end_at: datetime = None,
limit: int = 10,
orderBy: str = 'DESC'):
pass
3 changes: 3 additions & 0 deletions backend/bloom/services/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from fastapi import Request
from fastapi.security import APIKeyHeader

from bloom.routers.metrics import router as router_metrics

header_scheme = APIKeyHeader(name="x-key")

import redis
Expand All @@ -18,6 +20,7 @@


app = FastAPI()
app.include_router(router_metrics)

def check_apikey(key:str):
if key != settings.api_key :
Expand Down

0 comments on commit b67533e

Please sign in to comment.