haiway 0.18.1__tar.gz → 0.18.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.18.1 → haiway-0.18.2}/PKG-INFO +1 -1
- {haiway-0.18.1 → haiway-0.18.2}/junit/test-results.xml +1 -1
- {haiway-0.18.1 → haiway-0.18.2}/pyproject.toml +1 -1
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/context/observability.py +12 -4
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/helpers/observability.py +4 -3
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/helpers/tracing.py +4 -5
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/opentelemetry/observability.py +7 -7
- {haiway-0.18.1 → haiway-0.18.2}/uv.lock +1 -1
- {haiway-0.18.1 → haiway-0.18.2}/.github/workflows/ci.yml +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/.github/workflows/publish.yml +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/.gitignore +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/LICENSE +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/Makefile +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/README.md +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/config/pre-push +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/.dockerignore +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/Dockerfile +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/Makefile +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/README.md +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/config/.env.example +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/config/unit.json +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/docker-compose.yml +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/pyproject.toml +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/features/__int__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/features/todos/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/features/todos/config.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/features/todos/state.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/features/todos/types.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/features/todos/user_tasks.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/integrations/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/integrations/postgres/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/integrations/postgres/client.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/integrations/postgres/config.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/integrations/postgres/state.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/integrations/postgres/types.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/migrations/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/migrations/__main__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/migrations/postgres/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/migrations/postgres/execution.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/migrations/postgres/migration_0.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/migrations/postgres/types.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/server/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/server/__main__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/server/application.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/server/config.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/server/middlewares/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/server/middlewares/context.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/server/routes/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/server/routes/technical.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/server/routes/todos.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/solutions/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/solutions/user_tasks/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/solutions/user_tasks/config.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/solutions/user_tasks/postgres.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/solutions/user_tasks/state.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/src/solutions/user_tasks/types.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/examples/fastAPI/uv.lock +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/guidelines/functionalities.md +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/guidelines/packages.md +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/context/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/context/access.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/context/disposables.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/context/identifier.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/context/state.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/context/tasks.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/context/types.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/helpers/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/helpers/asynchrony.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/helpers/caching.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/helpers/retries.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/helpers/throttling.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/helpers/timeouted.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/opentelemetry/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/py.typed +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/state/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/state/attributes.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/state/path.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/state/requirement.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/state/structure.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/state/validation.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/types/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/types/default.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/types/frozen.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/types/missing.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/always.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/collections.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/env.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/freezing.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/logs.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/mimic.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/noop.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/queue.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/src/haiway/utils/stream.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/__init__.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/test_async_queue.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/test_async_stream.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/test_attribute_path.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/test_auto_retry.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/test_cache.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/test_context.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/test_state.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/test_streaming.py +0 -0
- {haiway-0.18.1 → haiway-0.18.2}/tests/test_timeout.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: haiway
|
3
|
-
Version: 0.18.
|
3
|
+
Version: 0.18.2
|
4
4
|
Summary: Framework for dependency injection and state management within structured concurrency model.
|
5
5
|
Project-URL: Homepage, https://miquido.com
|
6
6
|
Project-URL: Repository, https://github.com/miquido/haiway.git
|
@@ -1 +1 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="88" time="1.
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="88" time="1.116" timestamp="2025-05-12T15:57:41.113378+00:00" hostname="pkrvmberfyhpb9w"><testcase classname="tests.test_async_queue" name="test_fails_when_stream_fails" time="0.001" /><testcase classname="tests.test_async_queue" name="test_cancels_when_iteration_cancels" time="0.001" /><testcase classname="tests.test_async_queue" name="test_ends_when_stream_ends" time="0.001" /><testcase classname="tests.test_async_queue" name="test_buffers_values_when_not_reading" time="0.001" /><testcase classname="tests.test_async_queue" name="test_delivers_buffer_when_streaming_fails" time="0.001" /><testcase classname="tests.test_async_queue" name="test_delivers_updates_when_sending" time="0.001" /><testcase classname="tests.test_async_queue" name="test_fails_when_sending_to_finished" time="0.001" /><testcase classname="tests.test_async_queue" name="test_ignores_when_finishing_when_finished" time="0.001" /><testcase classname="tests.test_async_stream" name="test_fails_when_stream_fails" time="0.001" /><testcase classname="tests.test_async_stream" name="test_cancels_when_iteration_cancels" time="0.001" /><testcase classname="tests.test_async_stream" name="test_ends_when_stream_ends" time="0.001" /><testcase classname="tests.test_async_stream" name="test_finishes_without_buffer" time="0.001" /><testcase classname="tests.test_async_stream" name="test_fails_without_buffer" time="0.001" /><testcase classname="tests.test_async_stream" name="test_delivers_updates_when_sending" time="0.001" /><testcase classname="tests.test_async_stream" name="test_ignores_when_sending_to_finished" time="0.001" /><testcase classname="tests.test_async_stream" name="test_ignores_when_sending_to_failed" time="0.001" /><testcase classname="tests.test_async_stream" name="test_ignores_when_finishing_when_finished" time="0.001" /><testcase classname="tests.test_async_stream" name="test_delivers_all_when_sending_async" time="0.001" /><testcase classname="tests.test_attribute_path" name="test_id_path_points_to_self" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_attribute_path_points_to_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_nested_attribute_path_points_to_nested_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_recursive_attribute_path_points_to_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_list_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_tuple_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_mixed_tuple_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_dict_item_path_points_to_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_id_path_set_updates_self" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_attribute_path_set_updates_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_nested_attribute_path_set_updates_nested_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_recursive_attribute_set_updates_attribute" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_list_item_path_set_updates_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_tuple_item_path_set_updates_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_mixed_tuple_item_set_updates_item" time="0.000" /><testcase classname="tests.test_attribute_path" name="test_dict_item_path_set_updates_item" time="0.000" /><testcase classname="tests.test_auto_retry" name="test_returns_value_without_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_retries_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_logs_issue_with_errors" time="0.007" /><testcase classname="tests.test_auto_retry" name="test_fails_with_exceeding_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_fails_with_cancellation" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_retries_with_selected_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_fails_with_not_selected_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_returns_value_without_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_retries_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_with_exceeding_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_with_cancellation" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_when_cancelled" time="0.021" /><testcase classname="tests.test_auto_retry" name="test_async_uses_delay_with_errors" time="0.102" /><testcase classname="tests.test_auto_retry" name="test_async_uses_computed_delay_with_errors" time="0.107" /><testcase classname="tests.test_auto_retry" name="test_async_logs_issue_with_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_retries_with_selected_errors" time="0.001" /><testcase classname="tests.test_auto_retry" name="test_async_fails_with_not_selected_errors" time="0.001" /><testcase classname="tests.test_cache" name="test_returns_cache_value_with_same_argument" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_fresh_value_with_different_argument" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_fresh_value_with_limit_exceed" time="0.000" /><testcase classname="tests.test_cache" name="test_returns_same_value_with_repeating_argument" time="0.000" /><testcase classname="tests.test_cache" name="test_fails_with_error" time="0.001" /><testcase classname="tests.test_cache" name="test_returns_fresh_value_with_expiration_time_exceed" time="0.021" /><testcase classname="tests.test_cache" name="test_async_returns_cache_value_with_same_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_fresh_value_with_different_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_fresh_value_with_limit_exceed" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_same_value_with_repeating_argument" time="0.001" /><testcase classname="tests.test_cache" name="test_async_returns_fresh_value_with_expiration_time_exceed" time="0.021" /><testcase classname="tests.test_cache" name="test_async_cancel_waiting_does_not_cancel_task" time="0.502" /><testcase classname="tests.test_cache" name="test_async_expiration_does_not_cancel_task" time="0.021" /><testcase classname="tests.test_cache" name="test_async_fails_with_error" time="0.001" /><testcase classname="tests.test_context" name="test_state_is_available_according_to_context" time="0.001" /><testcase classname="tests.test_context" name="test_state_update_updates_local_context" time="0.001" /><testcase classname="tests.test_context" name="test_exceptions_are_propagated" time="0.001" /><testcase classname="tests.test_state" name="test_basic_initializes_with_arguments" time="0.002" /><testcase classname="tests.test_state" name="test_basic_initializes_with_defaults" time="0.001" /><testcase classname="tests.test_state" name="test_basic_equals_checks_properties" time="0.000" /><testcase classname="tests.test_state" name="test_basic_initializes_with_arguments_and_defaults" time="0.000" /><testcase classname="tests.test_state" name="test_parametrized_initializes_with_proper_parameters" time="0.000" /><testcase classname="tests.test_state" name="test_nested_initializes_with_proper_arguments" time="0.001" /><testcase classname="tests.test_state" name="test_dict_skips_missing_properties" time="0.000" /><testcase classname="tests.test_state" name="test_initialization_allows_missing_properties" time="0.001" /><testcase classname="tests.test_state" name="test_generic_subtypes_validation" time="0.002" /><testcase classname="tests.test_state" name="test_copying_leaves_same_object" time="0.001" /><testcase classname="tests.test_streaming" name="test_fails_when_generator_fails" time="0.001" /><testcase classname="tests.test_streaming" name="test_cancels_when_iteration_cancels" time="0.001" /><testcase classname="tests.test_streaming" name="test_ends_when_generator_ends" time="0.001" /><testcase classname="tests.test_streaming" name="test_delivers_updates_when_generating" time="0.001" /><testcase classname="tests.test_streaming" name="test_streaming_context_variables_access_is_preserved" time="0.001" /><testcase classname="tests.test_streaming" name="test_nested_streaming_streams_correctly" time="0.001" /><testcase classname="tests.test_timeout" name="test_returns_result_when_returning_value" time="0.001" /><testcase classname="tests.test_timeout" name="test_raises_with_error" time="0.001" /><testcase classname="tests.test_timeout" name="test_raises_with_cancel" time="0.011" /><testcase classname="tests.test_timeout" name="test_raises_with_timeout" time="0.011" /></testsuite></testsuites>
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
5
5
|
[project]
|
6
6
|
name = "haiway"
|
7
7
|
description = "Framework for dependency injection and state management within structured concurrency model."
|
8
|
-
version = "0.18.
|
8
|
+
version = "0.18.2"
|
9
9
|
readme = "README.md"
|
10
10
|
maintainers = [
|
11
11
|
{ name = "Kacper Kaliński", email = "kacper.kalinski@miquido.com" },
|
@@ -10,9 +10,8 @@ from types import TracebackType
|
|
10
10
|
from typing import Any, Final, Protocol, Self, final, runtime_checkable
|
11
11
|
|
12
12
|
from haiway.context.identifier import ScopeIdentifier
|
13
|
-
|
14
|
-
# from haiway.context.logging import LoggerContext
|
15
13
|
from haiway.state import State
|
14
|
+
from haiway.types import MISSING, Missing
|
16
15
|
|
17
16
|
__all__ = (
|
18
17
|
"DEBUG",
|
@@ -46,7 +45,16 @@ INFO: Final[int] = ObservabilityLevel.INFO
|
|
46
45
|
DEBUG: Final[int] = ObservabilityLevel.DEBUG
|
47
46
|
|
48
47
|
type ObservabilityAttribute = (
|
49
|
-
Sequence[str]
|
48
|
+
Sequence[str]
|
49
|
+
| Sequence[float]
|
50
|
+
| Sequence[int]
|
51
|
+
| Sequence[bool]
|
52
|
+
| str
|
53
|
+
| float
|
54
|
+
| int
|
55
|
+
| bool
|
56
|
+
| None
|
57
|
+
| Missing
|
50
58
|
)
|
51
59
|
|
52
60
|
|
@@ -256,7 +264,7 @@ def _logger_observability(
|
|
256
264
|
logger.log(
|
257
265
|
INFO,
|
258
266
|
f"{scope.unique_name} Recorded attributes:"
|
259
|
-
f"\n{'\n'.join(
|
267
|
+
f"\n{'\n'.join(f'{k}: {v}' for k, v in attributes.items() if v is not None and v is not MISSING)}", # noqa: E501
|
260
268
|
)
|
261
269
|
|
262
270
|
def scope_entering[Metric: State](
|
@@ -1,10 +1,11 @@
|
|
1
|
-
from collections.abc import Sequence
|
2
1
|
from logging import Logger
|
3
2
|
from time import monotonic
|
4
3
|
from typing import Any
|
5
4
|
|
6
5
|
from haiway.context import Observability, ObservabilityLevel, ScopeIdentifier
|
6
|
+
from haiway.context.observability import ObservabilityAttribute
|
7
7
|
from haiway.state import State
|
8
|
+
from haiway.types import MISSING
|
8
9
|
|
9
10
|
__all__ = ("LoggerObservability",)
|
10
11
|
|
@@ -133,14 +134,14 @@ def LoggerObservability( # noqa: C901, PLR0915
|
|
133
134
|
def attributes_recording(
|
134
135
|
scope: ScopeIdentifier,
|
135
136
|
/,
|
136
|
-
**attributes:
|
137
|
+
**attributes: ObservabilityAttribute,
|
137
138
|
) -> None:
|
138
139
|
if not attributes:
|
139
140
|
return
|
140
141
|
|
141
142
|
attributes_str: str = (
|
142
143
|
f"{scope.unique_name} Attributes:"
|
143
|
-
f"\n{'\n'.join(
|
144
|
+
f"\n{'\n'.join(f'{k}: {v}' for k, v in attributes.items() if v is not None and v is not MISSING)}" # noqa: E501
|
144
145
|
)
|
145
146
|
if summarize_context: # store only for summary
|
146
147
|
scopes[scope.scope_id].store.append(attributes_str)
|
@@ -96,11 +96,10 @@ def _traced_sync[**Args, Result](
|
|
96
96
|
**kwargs: Args.kwargs,
|
97
97
|
) -> Result:
|
98
98
|
with ctx.scope(label):
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
for key, arg in kwargs.items()
|
103
|
-
ctx.attributes(**{key: f"{arg}"})
|
99
|
+
ctx.attributes(
|
100
|
+
**{f"[{idx}]": f"{arg}" for idx, arg in enumerate(args) if arg is not MISSING}
|
101
|
+
)
|
102
|
+
ctx.attributes(**{key: f"{arg}" for key, arg in kwargs.items() if arg is not MISSING})
|
104
103
|
|
105
104
|
try:
|
106
105
|
result: Result = function(*args, **kwargs)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import os
|
2
2
|
from collections.abc import Mapping
|
3
|
-
from typing import Any, Self, final
|
3
|
+
from typing import Any, Self, cast, final
|
4
4
|
|
5
5
|
from opentelemetry import metrics, trace
|
6
6
|
from opentelemetry._logs import get_logger, set_logger_provider
|
@@ -31,10 +31,9 @@ from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExport
|
|
31
31
|
from opentelemetry.trace import Span, StatusCode, Tracer
|
32
32
|
|
33
33
|
from haiway.context import Observability, ObservabilityLevel, ScopeIdentifier
|
34
|
-
|
35
|
-
###
|
36
34
|
from haiway.context.observability import ObservabilityAttribute
|
37
35
|
from haiway.state import State
|
36
|
+
from haiway.types import MISSING
|
38
37
|
|
39
38
|
__all__ = ("OpenTelemetry",)
|
40
39
|
|
@@ -168,10 +167,11 @@ class ScopeStore:
|
|
168
167
|
*,
|
169
168
|
value: ObservabilityAttribute,
|
170
169
|
) -> None:
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
170
|
+
if value is not None and value is not MISSING:
|
171
|
+
self.span.set_attribute(
|
172
|
+
name,
|
173
|
+
value=cast(Any, value),
|
174
|
+
)
|
175
175
|
|
176
176
|
|
177
177
|
@final
|
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
|
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
|