8000 Improve Gauge typing for param multiprocess_mode · prometheus/client_python@af20d77 · GitHub
[go: up one dir, main page]

Skip to content

Commit af20d77

Browse files
committed
Improve Gauge typing for param multiprocess_mode
Signed-off-by: rafsaf <rafal.safin12@gmail.com>
1 parent c72c4f3 commit af20d77

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

prometheus_client/metrics.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23
from threading import Lock
34
import time
45
import types
@@ -17,6 +18,9 @@
1718
from .samples import Exemplar, Sample
1819
from .utils import floatToGoString, INF
1920

21+
if sys.version_info >= (3, 8, 0):
22+
from typing import Literal
23+
2024
T = TypeVar('T', bound='MetricWrapperBase')
2125
F = TypeVar("F", bound=Callable[..., Any])
2226

@@ -357,7 +361,7 @@ def __init__(self,
357361
unit: str = '',
358362
registry: Optional[CollectorRegistry] = REGISTRY,
359363
_labelvalues: Optional[Sequence[str]] = None,
360-
multiprocess_mode: str = 'all',
364+
multiprocess_mode: "Literal['all', 'liveall', 'min', 'livemin', 'max', 'livemax', 'sum', 'livesum']" = 'all',
361365
):
362366
self._multiprocess_mode = multiprocess_mode
363367
if multiprocess_mode not in self._MULTIPROC_MODES:

0 commit comments

Comments
 (0)
0