Skip to content
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

fix(metrics): explicit type to single_metric ctx manager #865

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aws_lambda_powertools/metrics/metric.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import logging
from contextlib import contextmanager
from typing import Dict, Optional, Union
from typing import Dict, Optional, Union, Generator

from .base import MetricManager, MetricUnit

Expand Down Expand Up @@ -61,7 +61,7 @@ def add_metric(self, name: str, unit: Union[MetricUnit, str], value: float) -> N


@contextmanager
def single_metric(name: str, unit: MetricUnit, value: float, namespace: Optional[str] = None):
def single_metric(name: str, unit: MetricUnit, value: float, namespace: Optional[str] = None) -> Generator[SingleMetric, None, None]:
"""Context manager to simplify creation of a single metric

Example
Expand Down