haiway 0.8.1__tar.gz → 0.8.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {haiway-0.8.1/src/haiway.egg-info → haiway-0.8.2}/PKG-INFO +1 -1
- {haiway-0.8.1 → haiway-0.8.2}/pyproject.toml +1 -1
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/context/access.py +0 -5
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/helpers/metrics.py +15 -20
- {haiway-0.8.1 → haiway-0.8.2/src/haiway.egg-info}/PKG-INFO +1 -1
- {haiway-0.8.1 → haiway-0.8.2}/LICENSE +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/README.md +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/setup.cfg +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/__init__.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/context/__init__.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/context/disposables.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/context/identifier.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/context/logging.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/context/metrics.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/context/state.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/context/tasks.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/context/types.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/helpers/__init__.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/helpers/asynchrony.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/helpers/caching.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/helpers/retries.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/helpers/throttling.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/helpers/timeouted.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/helpers/tracing.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/py.typed +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/state/__init__.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/state/attributes.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/state/path.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/state/requirement.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/state/structure.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/state/validation.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/types/__init__.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/types/frozen.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/types/missing.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/utils/__init__.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/utils/always.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/utils/env.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/utils/immutable.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/utils/logs.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/utils/mimic.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/utils/noop.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway/utils/queue.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway.egg-info/SOURCES.txt +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway.egg-info/dependency_links.txt +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway.egg-info/requires.txt +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/src/haiway.egg-info/top_level.txt +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/tests/test_async_queue.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/tests/test_attribute_path.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/tests/test_auto_retry.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/tests/test_cache.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/tests/test_context.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/tests/test_state.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/tests/test_streaming.py +0 -0
- {haiway-0.8.1 → haiway-0.8.2}/tests/test_timeout.py +0 -0
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
5
5
|
[project]
|
6
6
|
name = "haiway"
|
7
7
|
description = "Framework for dependency injection and state management within structured concurrency model."
|
8
|
-
version = "0.8.
|
8
|
+
version = "0.8.2"
|
9
9
|
readme = "README.md"
|
10
10
|
maintainers = [
|
11
11
|
{ name = "Kacper Kaliński", email = "kacper.kalinski@miquido.com" },
|
@@ -46,11 +46,6 @@ class ScopeContext:
|
|
46
46
|
self._state: tuple[State, ...] = state
|
47
47
|
self._disposables: Disposables | None = disposables
|
48
48
|
# pre-building metrics context to ensure nested context registering
|
49
|
-
if __debug__:
|
50
|
-
if self._identifier.is_root and metrics is None:
|
51
|
-
from haiway.helpers import MetricsLogger
|
52
|
-
|
53
|
-
metrics = MetricsLogger.handler()
|
54
49
|
self._metrics_context: MetricsContext = MetricsContext.scope(
|
55
50
|
self._identifier,
|
56
51
|
metrics=metrics,
|
@@ -1,19 +1,16 @@
|
|
1
1
|
from collections.abc import Sequence
|
2
2
|
from itertools import chain
|
3
3
|
from time import monotonic
|
4
|
-
from typing import Any,
|
4
|
+
from typing import Any, Self, cast, final
|
5
5
|
|
6
6
|
from haiway.context import MetricsHandler, ScopeIdentifier, ctx
|
7
7
|
from haiway.state import State
|
8
8
|
from haiway.types import MISSING, Missing
|
9
|
-
from haiway.utils import getenv_bool
|
10
9
|
|
11
10
|
__all_ = [
|
12
11
|
"MetricsLogger",
|
13
12
|
]
|
14
13
|
|
15
|
-
DEBUG_LOGGING: Final[bool] = getenv_bool("DEBUG_LOGGING", __debug__)
|
16
|
-
|
17
14
|
|
18
15
|
class MetricsScopeStore:
|
19
16
|
def __init__(
|
@@ -96,13 +93,12 @@ class MetricsLogger:
|
|
96
93
|
metrics[type(metric)] = current.__add__(metric) # pyright: ignore[reportUnknownMemberType, reportAttributeAccessIssue]
|
97
94
|
|
98
95
|
metrics[type(metric)] = metric
|
99
|
-
if
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
):
|
105
|
-
ctx.log_info(f"Recorded metric:\n⎡ {type(metric).__qualname__}:{log}\n⌊")
|
96
|
+
if log := _state_log(
|
97
|
+
metric,
|
98
|
+
list_items_limit=self.items_limit,
|
99
|
+
redact_content=self.redact_content,
|
100
|
+
):
|
101
|
+
ctx.log_debug(f"Recorded metric:\n⎡ {type(metric).__qualname__}:{log}\n⌊")
|
106
102
|
|
107
103
|
def enter_scope[Metric: State](
|
108
104
|
self,
|
@@ -118,7 +114,7 @@ class MetricsLogger:
|
|
118
114
|
self.scopes[key].nested.append(scope_metrics)
|
119
115
|
return
|
120
116
|
|
121
|
-
ctx.
|
117
|
+
ctx.log_debug(
|
122
118
|
"Attempting to enter nested scope metrics without entering its parent first"
|
123
119
|
)
|
124
120
|
|
@@ -130,14 +126,13 @@ class MetricsLogger:
|
|
130
126
|
assert scope in self.scopes # nosec: B101
|
131
127
|
self.scopes[scope].exited = monotonic()
|
132
128
|
|
133
|
-
if
|
134
|
-
if
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
)
|
140
|
-
ctx.log_info(f"Metrics summary:\n{log}")
|
129
|
+
if scope.is_root and self.scopes[scope].finished:
|
130
|
+
if log := _tree_log(
|
131
|
+
self.scopes[scope],
|
132
|
+
list_items_limit=self.items_limit,
|
133
|
+
redact_content=self.redact_content,
|
134
|
+
):
|
135
|
+
ctx.log_debug(f"Metrics summary:\n{log}")
|
141
136
|
|
142
137
|
|
143
138
|
def _tree_log(
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|