Skip to content

Billing: Implement usage-based pricing logic #5

@cuevaio

Description

@cuevaio

Description

Implement runtime measurement and billing calculation for code executions.

Billing Rules

  • Minimum 1 second billed per request
  • Additional time billed in 0.5s intervals
  • Always round up to nearest 0.5s

Tasks

  • Implement runtime measurement (using startTime + Date.now() approach or Lambda metadata)
  • Enforce minimum 1 second billing per request
  • Implement 0.5s interval billing for additional time
  • Implement rounding up to nearest 0.5s
  • Store computed cost per execution in logs/metadata

Examples

Actual Runtime Billed Duration
0.1s 1.0s
1.0s 1.0s
1.2s 1.5s
2.0s 2.0s
2.3s 2.5s

Acceptance Criteria

  • All executions are properly measured and billed
  • Billing follows the defined rounding rules
  • Cost data is persisted for reporting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions