Skip to content

Commit

Permalink
Updating base analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
Wh1isper committed Sep 12, 2023
1 parent f361754 commit 39d8ba1
Showing 1 changed file with 45 additions and 6 deletions.
51 changes: 45 additions & 6 deletions duetector/analyzer/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from typing import List, Optional
from typing import Any, Dict, List, Optional

from duetector.analyzer.models import AnalyzerBrief, Tracking
from duetector.config import Configuable
Expand Down Expand Up @@ -42,25 +42,64 @@ def get_all_collector_ids(self) -> List[str]:

def query(
self,
tracer: Optional[str] = None,
collector_id: Optional[str] = None,
tracers: Optional[List[str]] = None,
collector_ids: Optional[List[str]] = None,
start_datetime: Optional[datetime] = None,
end_datetime: Optional[datetime] = None,
start: int = 0,
limit: int = 20,
limit: int = 0,
columns: Optional[List[str]] = None,
where: Optional[Dict[str, Any]] = None,
distinct: bool = False,
order_by_asc: Optional[List[str]] = None,
order_by_desc: Optional[List[str]] = None,
) -> List[Tracking]:
"""
Query tracking data from storage.
Query all tracking records from database.
Args:
tracers (Optional[List[str]], optional): Tracer's name. Defaults to None, all tracers will be queried.
collector_ids (Optional[List[str]], optional): Collector id. Defaults to None, all collector id will be queried.
start_datetime (Optional[datetime], optional): Start time. Defaults to None.
end_datetime (Optional[datetime], optional): End time. Defaults to None.
start (int, optional): Start index. Defaults to 0.
limit (int, optional): Limit of records. Defaults to 20. ``0`` means no limit.
columns (Optional[List[str]], optional): Columns to query. Defaults to None, all columns will be queried.
where (Optional[Dict[str, Any]], optional): Where clause. Defaults to None.
distinct (bool, optional): Distinct. Defaults to False.
order_by_asc (Optional[List[str]], optional): Order by asc. Defaults to None.
order_by_desc (Optional[List[str]], optional): Order by desc. Defaults to None.
Returns:
List[duetector.analyzer.models.Tracking]: List of tracking records.
"""
raise NotImplementedError

def brief(
self,
tracers: Optional[List[str]] = None,
collector_ids: Optional[List[str]] = None,
start_datetime: Optional[datetime] = None,
end_datetime: Optional[datetime] = None,
with_details: bool = True,
distinct: bool = False,
) -> AnalyzerBrief:
"""
Get brief of analyzer.
Get a brief of this analyzer.
Args:
tracers (Optional[List[str]], optional):
Tracers. Defaults to None, all tracers will be queried.
If a specific tracer is not found, it will be ignored.
collector_ids (Optional[List[str]], optional):
Collector ids. Defaults to None, all collector ids will be queried.
If a specific collector id is not found, it will be ignored.
start_datetime (Optional[datetime], optional): Start time. Defaults to None.
end_datetime (Optional[datetime], optional): End time. Defaults to None.
with_details (bool, optional): With details. Defaults to True.
distinct (bool, optional): Distinct. Defaults to False.
Returns:
AnalyzerBrief: A brief of this analyzer.
"""
raise NotImplementedError

Expand Down

0 comments on commit 39d8ba1

Please sign in to comment.