Skip to content

Static typing: @metrics.log_metrics decorator #4088

@ChrisHills463

Description

@ChrisHills463

Static type checker used

pyright/pylance

AWS Lambda function runtime

3.11

Powertools for AWS Lambda (Python) version

latest

Static type checker info

# error: Argument missing for parameter "context" (reportGeneralTypeIssues)

Code snippet

@metrics.log_metrics(capture_cold_start_metric=True)   # error: Argument missing for parameter "context" (reportGeneralTypeIssues)
def lambda_handler(event: dict, context: LambdaContext) -> dict:
    return app.resolve(event, context)

Possible Solution

This is a known issue with pyright (see pyright#3265). See also this Discord discussion.

Metadata

Metadata

Labels

typingStatic typing definition related issues (mypy, pyright, etc.)

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions