Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
Alexander
266ccdbf65 feat(web): added metric to the timeseries view type 2024-12-03 12:01:58 +01:00
Alexander
63a59bc7c9 feat(web): fixed an issue in if statement 2024-12-03 11:56:20 +01:00
Alexander
92a36f1b94 feat(web): added small integrations improvements 2024-12-03 11:49:56 +01:00
2 changed files with 7 additions and 2 deletions

View file

@ -188,7 +188,7 @@ def search2_series(data: schemas.SessionsSearchPayloadSchema, project_id: int, d
sessions = []
with pg_client.PostgresClient() as cur:
if metric_type == schemas.MetricType.TIMESERIES:
if view_type == schemas.MetricTimeseriesViewType.LINE_CHART:
if view_type in {item.value for item in schemas.MetricTimeseriesViewType}: #if view_type == schemas.MetricTimeseriesViewType.LINE_CHART:
if metric_of == schemas.MetricOfTimeseries.SESSION_COUNT:
# main_query = cur.mogrify(f"""WITH full_sessions AS (SELECT DISTINCT ON(s.session_id) s.session_id, s.start_ts
main_query = cur.mogrify(f"""WITH full_sessions AS (SELECT s.session_id, s.start_ts
@ -234,7 +234,7 @@ def search2_series(data: schemas.SessionsSearchPayloadSchema, project_id: int, d
logger.warning(data.model_dump_json())
logger.warning("--------------------")
raise err
if view_type == schemas.MetricTimeseriesViewType.LINE_CHART:
if view_type in {item.value for item in schemas.MetricTimeseriesViewType}: #if view_type == schemas.MetricTimeseriesViewType.LINE_CHART:
sessions = cur.fetchall()
else:
sessions = cur.fetchone()["count"]

View file

@ -895,6 +895,11 @@ class CardSeriesSchema(BaseModel):
class MetricTimeseriesViewType(str, Enum):
LINE_CHART = "lineChart"
AREA_CHART = "areaChart"
BAR_CHART = "barChart"
PIE_CHART = "pieChart"
PROGRESS_CHART = "progressChart"
TABLE_CHART = "table"
METRIC_CHART = "metric"
class MetricTableViewType(str, Enum):