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

change labels() method return type #58

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.6.0"
authors = [
{ name="Llandy Riveron Del Risco", email="[email protected]" },
]
dependencies = ["typing-extensions >= 4.0.0"]
description = "playing with metrics"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
4 changes: 3 additions & 1 deletion pytheus/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from dataclasses import dataclass
from typing import Callable, Dict, Generator, Iterable, Optional, Sequence, Tuple, Type, Union

from typing_extensions import Self

from pytheus.backends import get_backend
from pytheus.exceptions import (
BucketException,
Expand Down Expand Up @@ -202,7 +204,7 @@ def _raise_if_cannot_observe(self) -> None:
if not self._can_observe:
raise UnobservableMetricException

def labels(self, pytheus_labels_: Optional[Labels] = None, **kwargs: str) -> "_Metric":
def labels(self, pytheus_labels_: Optional[Labels] = None, **kwargs: str) -> Self:
"""
If no labels is passed to the call returns itself.
If there are already present labels, they will be updated with the passed labels_ and if
Expand Down
Loading