Skip to content

Metrics: Problem with default dimension creation #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
to-mc opened this issue Jun 10, 2020 · 1 comment
Closed

Metrics: Problem with default dimension creation #75

to-mc opened this issue Jun 10, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@to-mc
Copy link
Contributor

to-mc commented Jun 10, 2020

When metrics are being emitted during function execution using the log_metrics decorator e.g.:

from aws_lambda_powertools.metrics import Metrics

metrics = Metrics(service="cart-service")

@metrics.log_metrics
def lambda_handler(event, context):
    metrics.add_metric(name="CartUpdated", unit="Count", value=1)

The function runs successfully on cold starts, but throws an error due to missing dimensions on subsequent executions.

What were you trying to accomplish?

Expected Behavior

The default "service" dimension should be added to every metric created, not just the first one.

Current Behavior

The default "service" dimension is only being added to the first metric serialized, causing schema validation errors

Environment

  • Powertools version used: 0.10.0
  • Packaging format (Layers, PyPi): PyPi
  • AWS Lambda function runtime: 3.8
@to-mc to-mc added bug Something isn't working triage Pending triage from maintainers labels Jun 10, 2020
@ghost ghost removed the triage Pending triage from maintainers label Jun 10, 2020
@to-mc
Copy link
Contributor Author

to-mc commented Jun 10, 2020

Fixed v0.10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant