Skip to content

feat(reports): support composable mix-and-match data functions per canned report #365

Description

@thecaffiend

Background

A canned report is tied to exactly one data function today. Config carries a single data_function block, _create_canned_report (capeinfra/meta/capemeta.py) builds one Lambda and stores its ARN under the scalar data_function key in the canned-report DDB table, and get_canned_report (assets/api/capi/handlers/get_canned_report.py) invokes that one ARN and renders its returned dict.

The report payload shape is already flexible (a free-form dict passed straight to the template), so a single function can return many query results. But we want to be able to compose a report from a collection of small, independently maintained data functions. Small composable functions also fit Lambda's default per-invocation timeout better than one function running many queries serially.

Scope

  • Config schema: allow a report to declare a list of data functions instead of a single data_function.
  • capemeta.py: build N Lambdas per report and persist N ARNs; the stored canned-report meta currently uses a scalar data_function field.
  • Canned-report DDB contract + capepy: CannedReportTable.get_report reads the scalar data_function; storing/reading a list likely requires a capepy change or a new field.
  • Handler: get_canned_report must invoke each data function and merge payloads with a namespacing scheme to avoid key collisions.
  • Invocation model: invoke the data functions concurrently to actually realize the timeout benefit; serial invocation of N small Lambdas is slower and costlier than one Lambda running N queries.

Notes

Refs #363

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Almost highest priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions