plexus.reports.blocks.cost_analysis module

class plexus.reports.blocks.cost_analysis.CostAnalysis(config: Dict[str, Any], params: Dict[str, Any] | None, api_client: PlexusDashboardClient)

Bases: BaseReportBlock

ReportBlock: Cost analysis over ScoreResults with summary or detail outputs.

Config:
  • scorecard (optional): id/key/name/externalId (any identifier)

  • score (optional): id/key/name/externalId (resolved within scorecard when provided)

  • hours (int, default 1): preferred time window

  • days (int, default 0): used when hours not provided

  • group_by (str|None): None | ‘scorecard’ | ‘score’ | ‘scorecard_score’

  • mode (str): ‘summary’ (default) or ‘detail’

  • breakdown (bool): when summary mode, include grouped summaries

DEFAULT_DESCRIPTION: str | None = 'ScoreResult cost metrics and breakdowns'
DEFAULT_NAME: str | None = 'Cost Analysis'
async generate() Tuple[Dict[str, Any] | None, str | None]

Generates the data for this report block asynchronously.

Access block configuration via self.config and report parameters via self.params. Use self.api_client for data fetching. Use self._log(“message”) to record log information.

Returns:
A tuple containing:
  • A dictionary containing the generated data (JSON-serializable), or None on failure.

  • A string containing concatenated log messages, or None if no logs.