unrealon 1.0.9__py3-none-any.whl → 1.1.1__py3-none-any.whl
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.
- unrealon/__init__.py +23 -21
- unrealon-1.1.1.dist-info/METADATA +722 -0
- unrealon-1.1.1.dist-info/RECORD +82 -0
- {unrealon-1.0.9.dist-info → unrealon-1.1.1.dist-info}/WHEEL +1 -1
- unrealon-1.1.1.dist-info/entry_points.txt +9 -0
- {unrealon-1.0.9.dist-info → unrealon-1.1.1.dist-info/licenses}/LICENSE +1 -1
- unrealon_bridge/__init__.py +114 -0
- unrealon_bridge/cli.py +316 -0
- unrealon_bridge/client/__init__.py +93 -0
- unrealon_bridge/client/base.py +78 -0
- unrealon_bridge/client/commands.py +89 -0
- unrealon_bridge/client/connection.py +90 -0
- unrealon_bridge/client/events.py +65 -0
- unrealon_bridge/client/health.py +38 -0
- unrealon_bridge/client/html_parser.py +146 -0
- unrealon_bridge/client/logging.py +139 -0
- unrealon_bridge/client/proxy.py +70 -0
- unrealon_bridge/client/scheduler.py +450 -0
- unrealon_bridge/client/session.py +70 -0
- unrealon_bridge/configs/__init__.py +14 -0
- unrealon_bridge/configs/bridge_config.py +212 -0
- unrealon_bridge/configs/bridge_config.yaml +39 -0
- unrealon_bridge/models/__init__.py +138 -0
- unrealon_bridge/models/base.py +28 -0
- unrealon_bridge/models/command.py +41 -0
- unrealon_bridge/models/events.py +40 -0
- unrealon_bridge/models/html_parser.py +79 -0
- unrealon_bridge/models/logging.py +55 -0
- unrealon_bridge/models/parser.py +63 -0
- unrealon_bridge/models/proxy.py +41 -0
- unrealon_bridge/models/requests.py +95 -0
- unrealon_bridge/models/responses.py +88 -0
- unrealon_bridge/models/scheduler.py +592 -0
- unrealon_bridge/models/session.py +28 -0
- unrealon_bridge/server/__init__.py +91 -0
- unrealon_bridge/server/base.py +171 -0
- unrealon_bridge/server/handlers/__init__.py +23 -0
- unrealon_bridge/server/handlers/command.py +110 -0
- unrealon_bridge/server/handlers/html_parser.py +139 -0
- unrealon_bridge/server/handlers/logging.py +95 -0
- unrealon_bridge/server/handlers/parser.py +95 -0
- unrealon_bridge/server/handlers/proxy.py +75 -0
- unrealon_bridge/server/handlers/scheduler.py +545 -0
- unrealon_bridge/server/handlers/session.py +66 -0
- unrealon_browser/__init__.py +61 -18
- unrealon_browser/{src/cli → cli}/browser_cli.py +6 -13
- unrealon_browser/{src/cli → cli}/cookies_cli.py +5 -1
- unrealon_browser/{src/core → core}/browser_manager.py +2 -2
- unrealon_browser/{src/managers → managers}/captcha.py +1 -1
- unrealon_browser/{src/managers → managers}/cookies.py +1 -1
- unrealon_browser/managers/logger_bridge.py +231 -0
- unrealon_browser/{src/managers → managers}/profile.py +1 -1
- unrealon_driver/__init__.py +73 -19
- unrealon_driver/browser/__init__.py +8 -0
- unrealon_driver/browser/config.py +74 -0
- unrealon_driver/browser/manager.py +416 -0
- unrealon_driver/exceptions.py +28 -0
- unrealon_driver/parser/__init__.py +55 -0
- unrealon_driver/parser/cli_manager.py +141 -0
- unrealon_driver/parser/daemon_manager.py +227 -0
- unrealon_driver/parser/managers/__init__.py +46 -0
- unrealon_driver/parser/managers/browser.py +51 -0
- unrealon_driver/parser/managers/config.py +281 -0
- unrealon_driver/parser/managers/error.py +412 -0
- unrealon_driver/parser/managers/html.py +732 -0
- unrealon_driver/parser/managers/logging.py +609 -0
- unrealon_driver/parser/managers/result.py +321 -0
- unrealon_driver/parser/parser_manager.py +628 -0
- unrealon/sdk_config.py +0 -88
- unrealon-1.0.9.dist-info/METADATA +0 -810
- unrealon-1.0.9.dist-info/RECORD +0 -246
- unrealon_browser/pyproject.toml +0 -182
- unrealon_browser/src/__init__.py +0 -62
- unrealon_browser/src/managers/logger_bridge.py +0 -395
- unrealon_driver/README.md +0 -204
- unrealon_driver/pyproject.toml +0 -187
- unrealon_driver/src/__init__.py +0 -90
- unrealon_driver/src/cli/__init__.py +0 -10
- unrealon_driver/src/cli/main.py +0 -66
- unrealon_driver/src/cli/simple.py +0 -510
- unrealon_driver/src/config/__init__.py +0 -11
- unrealon_driver/src/config/auto_config.py +0 -478
- unrealon_driver/src/core/__init__.py +0 -18
- unrealon_driver/src/core/exceptions.py +0 -289
- unrealon_driver/src/core/parser.py +0 -638
- unrealon_driver/src/dto/__init__.py +0 -66
- unrealon_driver/src/dto/cli.py +0 -119
- unrealon_driver/src/dto/config.py +0 -18
- unrealon_driver/src/dto/events.py +0 -237
- unrealon_driver/src/dto/execution.py +0 -313
- unrealon_driver/src/dto/services.py +0 -311
- unrealon_driver/src/execution/__init__.py +0 -23
- unrealon_driver/src/execution/daemon_mode.py +0 -317
- unrealon_driver/src/execution/interactive_mode.py +0 -88
- unrealon_driver/src/execution/modes.py +0 -45
- unrealon_driver/src/execution/scheduled_mode.py +0 -209
- unrealon_driver/src/execution/test_mode.py +0 -250
- unrealon_driver/src/logging/__init__.py +0 -24
- unrealon_driver/src/logging/driver_logger.py +0 -512
- unrealon_driver/src/services/__init__.py +0 -24
- unrealon_driver/src/services/browser_service.py +0 -726
- unrealon_driver/src/services/llm/__init__.py +0 -15
- unrealon_driver/src/services/llm/browser_llm_service.py +0 -363
- unrealon_driver/src/services/llm/llm.py +0 -195
- unrealon_driver/src/services/logger_service.py +0 -232
- unrealon_driver/src/services/metrics_service.py +0 -185
- unrealon_driver/src/services/scheduler_service.py +0 -489
- unrealon_driver/src/services/websocket_service.py +0 -362
- unrealon_driver/src/utils/__init__.py +0 -16
- unrealon_driver/src/utils/service_factory.py +0 -317
- unrealon_driver/src/utils/time_formatter.py +0 -338
- unrealon_llm/README.md +0 -44
- unrealon_llm/__init__.py +0 -26
- unrealon_llm/pyproject.toml +0 -154
- unrealon_llm/src/__init__.py +0 -228
- unrealon_llm/src/cli/__init__.py +0 -0
- unrealon_llm/src/core/__init__.py +0 -11
- unrealon_llm/src/core/smart_client.py +0 -438
- unrealon_llm/src/dto/__init__.py +0 -155
- unrealon_llm/src/dto/models/__init__.py +0 -0
- unrealon_llm/src/dto/models/config.py +0 -343
- unrealon_llm/src/dto/models/core.py +0 -328
- unrealon_llm/src/dto/models/enums.py +0 -123
- unrealon_llm/src/dto/models/html_analysis.py +0 -345
- unrealon_llm/src/dto/models/statistics.py +0 -473
- unrealon_llm/src/dto/models/translation.py +0 -383
- unrealon_llm/src/dto/models/type_conversion.py +0 -462
- unrealon_llm/src/dto/schemas/__init__.py +0 -0
- unrealon_llm/src/exceptions.py +0 -392
- unrealon_llm/src/llm_config/__init__.py +0 -20
- unrealon_llm/src/llm_config/logging_config.py +0 -178
- unrealon_llm/src/llm_logging/__init__.py +0 -42
- unrealon_llm/src/llm_logging/llm_events.py +0 -107
- unrealon_llm/src/llm_logging/llm_logger.py +0 -466
- unrealon_llm/src/managers/__init__.py +0 -15
- unrealon_llm/src/managers/cache_manager.py +0 -67
- unrealon_llm/src/managers/cost_manager.py +0 -107
- unrealon_llm/src/managers/request_manager.py +0 -298
- unrealon_llm/src/modules/__init__.py +0 -0
- unrealon_llm/src/modules/html_processor/__init__.py +0 -25
- unrealon_llm/src/modules/html_processor/base_processor.py +0 -415
- unrealon_llm/src/modules/html_processor/details_processor.py +0 -85
- unrealon_llm/src/modules/html_processor/listing_processor.py +0 -91
- unrealon_llm/src/modules/html_processor/models/__init__.py +0 -20
- unrealon_llm/src/modules/html_processor/models/processing_models.py +0 -40
- unrealon_llm/src/modules/html_processor/models/universal_model.py +0 -56
- unrealon_llm/src/modules/html_processor/processor.py +0 -102
- unrealon_llm/src/modules/llm/__init__.py +0 -0
- unrealon_llm/src/modules/translator/__init__.py +0 -0
- unrealon_llm/src/provider.py +0 -116
- unrealon_llm/src/utils/__init__.py +0 -95
- unrealon_llm/src/utils/common.py +0 -64
- unrealon_llm/src/utils/data_extractor.py +0 -188
- unrealon_llm/src/utils/html_cleaner.py +0 -767
- unrealon_llm/src/utils/language_detector.py +0 -308
- unrealon_llm/src/utils/models_cache.py +0 -592
- unrealon_llm/src/utils/smart_counter.py +0 -229
- unrealon_llm/src/utils/token_counter.py +0 -189
- unrealon_sdk/README.md +0 -25
- unrealon_sdk/__init__.py +0 -30
- unrealon_sdk/pyproject.toml +0 -231
- unrealon_sdk/src/__init__.py +0 -150
- unrealon_sdk/src/cli/__init__.py +0 -12
- unrealon_sdk/src/cli/commands/__init__.py +0 -22
- unrealon_sdk/src/cli/commands/benchmark.py +0 -42
- unrealon_sdk/src/cli/commands/diagnostics.py +0 -573
- unrealon_sdk/src/cli/commands/health.py +0 -46
- unrealon_sdk/src/cli/commands/integration.py +0 -498
- unrealon_sdk/src/cli/commands/reports.py +0 -43
- unrealon_sdk/src/cli/commands/security.py +0 -36
- unrealon_sdk/src/cli/commands/server.py +0 -483
- unrealon_sdk/src/cli/commands/servers.py +0 -56
- unrealon_sdk/src/cli/commands/tests.py +0 -55
- unrealon_sdk/src/cli/main.py +0 -126
- unrealon_sdk/src/cli/utils/reporter.py +0 -519
- unrealon_sdk/src/clients/openapi.yaml +0 -3347
- unrealon_sdk/src/clients/python_http/__init__.py +0 -3
- unrealon_sdk/src/clients/python_http/api_config.py +0 -228
- unrealon_sdk/src/clients/python_http/models/BaseModel.py +0 -12
- unrealon_sdk/src/clients/python_http/models/BroadcastDeliveryStats.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastMessage.py +0 -17
- unrealon_sdk/src/clients/python_http/models/BroadcastMessageRequest.py +0 -35
- unrealon_sdk/src/clients/python_http/models/BroadcastPriority.py +0 -10
- unrealon_sdk/src/clients/python_http/models/BroadcastResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/BroadcastResultResponse.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastTarget.py +0 -11
- unrealon_sdk/src/clients/python_http/models/ConnectionStats.py +0 -27
- unrealon_sdk/src/clients/python_http/models/ConnectionsResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/DeveloperMessageResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ErrorResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/HTTPValidationError.py +0 -16
- unrealon_sdk/src/clients/python_http/models/HealthResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/HealthStatus.py +0 -33
- unrealon_sdk/src/clients/python_http/models/LogLevel.py +0 -10
- unrealon_sdk/src/clients/python_http/models/LoggingRequest.py +0 -27
- unrealon_sdk/src/clients/python_http/models/LoggingResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/MaintenanceMode.py +0 -9
- unrealon_sdk/src/clients/python_http/models/MaintenanceModeRequest.py +0 -33
- unrealon_sdk/src/clients/python_http/models/MaintenanceStatusResponse.py +0 -39
- unrealon_sdk/src/clients/python_http/models/ParserCommandRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserMessageResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationRequest.py +0 -28
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserType.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyBlockRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyEndpointResponse.py +0 -20
- unrealon_sdk/src/clients/python_http/models/ProxyListResponse.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyProvider.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyPurchaseRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ProxyResponse.py +0 -47
- unrealon_sdk/src/clients/python_http/models/ProxyRotationRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ProxyStatus.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyUsageRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyUsageStatsResponse.py +0 -26
- unrealon_sdk/src/clients/python_http/models/ServiceRegistrationDto.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ServiceStatsResponse.py +0 -31
- unrealon_sdk/src/clients/python_http/models/SessionStartRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/SuccessResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/SystemNotificationResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ValidationError.py +0 -18
- unrealon_sdk/src/clients/python_http/models/ValidationErrorResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/WebSocketMetrics.py +0 -21
- unrealon_sdk/src/clients/python_http/models/__init__.py +0 -44
- unrealon_sdk/src/clients/python_http/services/None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/SocketLogging_service.py +0 -187
- unrealon_sdk/src/clients/python_http/services/SystemHealth_service.py +0 -119
- unrealon_sdk/src/clients/python_http/services/WebSocketAPI_service.py +0 -198
- unrealon_sdk/src/clients/python_http/services/__init__.py +0 -0
- unrealon_sdk/src/clients/python_http/services/admin_service.py +0 -125
- unrealon_sdk/src/clients/python_http/services/async_None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/async_ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/async_ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/async_SocketLogging_service.py +0 -189
- unrealon_sdk/src/clients/python_http/services/async_SystemHealth_service.py +0 -123
- unrealon_sdk/src/clients/python_http/services/async_WebSocketAPI_service.py +0 -200
- unrealon_sdk/src/clients/python_http/services/async_admin_service.py +0 -125
- unrealon_sdk/src/clients/python_websocket/__init__.py +0 -28
- unrealon_sdk/src/clients/python_websocket/client.py +0 -490
- unrealon_sdk/src/clients/python_websocket/events.py +0 -732
- unrealon_sdk/src/clients/python_websocket/example.py +0 -136
- unrealon_sdk/src/clients/python_websocket/types.py +0 -871
- unrealon_sdk/src/core/__init__.py +0 -64
- unrealon_sdk/src/core/client.py +0 -556
- unrealon_sdk/src/core/config.py +0 -465
- unrealon_sdk/src/core/exceptions.py +0 -239
- unrealon_sdk/src/core/metadata.py +0 -191
- unrealon_sdk/src/core/models.py +0 -142
- unrealon_sdk/src/core/types.py +0 -68
- unrealon_sdk/src/dto/__init__.py +0 -268
- unrealon_sdk/src/dto/authentication.py +0 -108
- unrealon_sdk/src/dto/cache.py +0 -208
- unrealon_sdk/src/dto/common.py +0 -19
- unrealon_sdk/src/dto/concurrency.py +0 -393
- unrealon_sdk/src/dto/events.py +0 -108
- unrealon_sdk/src/dto/health.py +0 -339
- unrealon_sdk/src/dto/load_balancing.py +0 -336
- unrealon_sdk/src/dto/logging.py +0 -230
- unrealon_sdk/src/dto/performance.py +0 -165
- unrealon_sdk/src/dto/rate_limiting.py +0 -295
- unrealon_sdk/src/dto/resource_pooling.py +0 -128
- unrealon_sdk/src/dto/structured_logging.py +0 -112
- unrealon_sdk/src/dto/task_scheduling.py +0 -121
- unrealon_sdk/src/dto/websocket.py +0 -55
- unrealon_sdk/src/enterprise/__init__.py +0 -59
- unrealon_sdk/src/enterprise/authentication.py +0 -401
- unrealon_sdk/src/enterprise/cache_manager.py +0 -578
- unrealon_sdk/src/enterprise/error_recovery.py +0 -494
- unrealon_sdk/src/enterprise/event_system.py +0 -549
- unrealon_sdk/src/enterprise/health_monitor.py +0 -747
- unrealon_sdk/src/enterprise/load_balancer.py +0 -964
- unrealon_sdk/src/enterprise/logging/__init__.py +0 -68
- unrealon_sdk/src/enterprise/logging/cleanup.py +0 -156
- unrealon_sdk/src/enterprise/logging/development.py +0 -744
- unrealon_sdk/src/enterprise/logging/service.py +0 -410
- unrealon_sdk/src/enterprise/multithreading_manager.py +0 -853
- unrealon_sdk/src/enterprise/performance_monitor.py +0 -539
- unrealon_sdk/src/enterprise/proxy_manager.py +0 -696
- unrealon_sdk/src/enterprise/rate_limiter.py +0 -652
- unrealon_sdk/src/enterprise/resource_pool.py +0 -763
- unrealon_sdk/src/enterprise/task_scheduler.py +0 -709
- unrealon_sdk/src/internal/__init__.py +0 -10
- unrealon_sdk/src/internal/command_router.py +0 -497
- unrealon_sdk/src/internal/connection_manager.py +0 -397
- unrealon_sdk/src/internal/http_client.py +0 -446
- unrealon_sdk/src/internal/websocket_client.py +0 -420
- unrealon_sdk/src/provider.py +0 -471
- unrealon_sdk/src/utils.py +0 -234
- /unrealon_browser/{src/cli → cli}/__init__.py +0 -0
- /unrealon_browser/{src/cli → cli}/interactive_mode.py +0 -0
- /unrealon_browser/{src/cli → cli}/main.py +0 -0
- /unrealon_browser/{src/core → core}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/config.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/core.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/dataclasses.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/detection.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/enums.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/statistics.py +0 -0
- /unrealon_browser/{src/managers → managers}/__init__.py +0 -0
- /unrealon_browser/{src/managers → managers}/stealth.py +0 -0
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Concurrency & Threading DTOs - Data Transfer Objects for multithreading system.
|
|
3
|
-
|
|
4
|
-
This module contains all Pydantic models and enums related to concurrency management,
|
|
5
|
-
separated from business logic for clean architecture and reusability.
|
|
6
|
-
|
|
7
|
-
Components:
|
|
8
|
-
- Thread pool management and load balancing models
|
|
9
|
-
- Task scheduling and priority queue models
|
|
10
|
-
- Resource pooling and lifecycle management
|
|
11
|
-
- Performance optimization and monitoring models
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
import uuid
|
|
15
|
-
from datetime import datetime, timezone, timedelta
|
|
16
|
-
from typing import Dict, List, Optional, Any, Union, Callable
|
|
17
|
-
from enum import Enum
|
|
18
|
-
from dataclasses import dataclass, field
|
|
19
|
-
|
|
20
|
-
from pydantic import BaseModel, Field, ConfigDict
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class ThreadPoolStrategy(str, Enum):
|
|
24
|
-
"""Thread pool management strategies."""
|
|
25
|
-
|
|
26
|
-
FIXED = "fixed" # Fixed number of threads
|
|
27
|
-
DYNAMIC = "dynamic" # Dynamic scaling based on load
|
|
28
|
-
ADAPTIVE = "adaptive" # ML-based adaptive scaling
|
|
29
|
-
ELASTIC = "elastic" # Cloud-style elastic scaling
|
|
30
|
-
CUSTOM = "custom" # Custom scaling algorithm
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class LoadBalancingStrategy(str, Enum):
|
|
34
|
-
"""Load balancing strategies for task distribution."""
|
|
35
|
-
|
|
36
|
-
ROUND_ROBIN = "round_robin" # Simple round-robin
|
|
37
|
-
LEAST_LOADED = "least_loaded" # Assign to least loaded thread
|
|
38
|
-
PERFORMANCE_BASED = "performance_based" # Based on historical performance
|
|
39
|
-
GEOGRAPHIC = "geographic" # Geographic proximity
|
|
40
|
-
RANDOM = "random" # Random assignment
|
|
41
|
-
WEIGHTED = "weighted" # Weighted distribution
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class TaskPriority(str, Enum):
|
|
45
|
-
"""Task priority levels."""
|
|
46
|
-
|
|
47
|
-
CRITICAL = "critical" # Highest priority - immediate execution
|
|
48
|
-
HIGH = "high" # High priority
|
|
49
|
-
NORMAL = "normal" # Normal priority
|
|
50
|
-
LOW = "low" # Low priority
|
|
51
|
-
BACKGROUND = "background" # Lowest priority - background tasks
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class TaskStatus(str, Enum):
|
|
55
|
-
"""Task execution status."""
|
|
56
|
-
|
|
57
|
-
PENDING = "pending" # Waiting in queue
|
|
58
|
-
RUNNING = "running" # Currently executing
|
|
59
|
-
COMPLETED = "completed" # Successfully completed
|
|
60
|
-
FAILED = "failed" # Failed with error
|
|
61
|
-
CANCELLED = "cancelled" # Cancelled before execution
|
|
62
|
-
TIMEOUT = "timeout" # Timed out during execution
|
|
63
|
-
RETRYING = "retrying" # Being retried after failure
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
class ResourceType(str, Enum):
|
|
67
|
-
"""Types of managed resources."""
|
|
68
|
-
|
|
69
|
-
CONNECTION = "connection" # Network connections
|
|
70
|
-
THREAD = "thread" # Thread resources
|
|
71
|
-
MEMORY = "memory" # Memory allocations
|
|
72
|
-
FILE_HANDLE = "file_handle" # File handles
|
|
73
|
-
DATABASE = "database" # Database connections
|
|
74
|
-
CACHE = "cache" # Cache resources
|
|
75
|
-
CUSTOM = "custom" # Custom resource type
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
class ResourceStatus(str, Enum):
|
|
79
|
-
"""Resource lifecycle status."""
|
|
80
|
-
|
|
81
|
-
AVAILABLE = "available" # Ready for use
|
|
82
|
-
IN_USE = "in_use" # Currently being used
|
|
83
|
-
RESERVED = "reserved" # Reserved for specific task
|
|
84
|
-
EXHAUSTED = "exhausted" # Resource limit reached
|
|
85
|
-
ERROR = "error" # Resource in error state
|
|
86
|
-
MAINTENANCE = "maintenance" # Under maintenance
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
class ConcurrencyEventType(str, Enum):
|
|
90
|
-
"""Concurrency monitoring event types."""
|
|
91
|
-
|
|
92
|
-
THREAD_CREATED = "thread_created"
|
|
93
|
-
THREAD_DESTROYED = "thread_destroyed"
|
|
94
|
-
THREAD_IDLE = "thread_idle"
|
|
95
|
-
THREAD_BUSY = "thread_busy"
|
|
96
|
-
TASK_QUEUED = "task_queued"
|
|
97
|
-
TASK_STARTED = "task_started"
|
|
98
|
-
TASK_COMPLETED = "task_completed"
|
|
99
|
-
TASK_FAILED = "task_failed"
|
|
100
|
-
DEADLOCK_DETECTED = "deadlock_detected"
|
|
101
|
-
RESOURCE_EXHAUSTED = "resource_exhausted"
|
|
102
|
-
POOL_SCALED = "pool_scaled"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
class ThreadPoolConfig(BaseModel):
|
|
106
|
-
"""Thread pool configuration model."""
|
|
107
|
-
|
|
108
|
-
model_config = ConfigDict(extra="forbid")
|
|
109
|
-
|
|
110
|
-
# Pool settings
|
|
111
|
-
pool_name: str = Field(..., description="Thread pool name")
|
|
112
|
-
strategy: ThreadPoolStrategy = Field(
|
|
113
|
-
default=ThreadPoolStrategy.DYNAMIC, description="Pool strategy"
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
# Size limits
|
|
117
|
-
min_threads: int = Field(default=2, description="Minimum number of threads")
|
|
118
|
-
max_threads: int = Field(default=50, description="Maximum number of threads")
|
|
119
|
-
core_threads: int = Field(default=5, description="Core number of threads")
|
|
120
|
-
|
|
121
|
-
# Scaling parameters
|
|
122
|
-
scale_up_threshold: float = Field(
|
|
123
|
-
default=0.8, description="Scale up when utilization > threshold"
|
|
124
|
-
)
|
|
125
|
-
scale_down_threshold: float = Field(
|
|
126
|
-
default=0.3, description="Scale down when utilization < threshold"
|
|
127
|
-
)
|
|
128
|
-
scale_up_factor: float = Field(default=1.5, description="Factor for scaling up")
|
|
129
|
-
scale_down_factor: float = Field(default=0.8, description="Factor for scaling down")
|
|
130
|
-
|
|
131
|
-
# Timing
|
|
132
|
-
thread_idle_timeout_seconds: float = Field(default=60.0, description="Thread idle timeout")
|
|
133
|
-
scaling_cooldown_seconds: float = Field(
|
|
134
|
-
default=30.0, description="Cooldown between scaling operations"
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
# Queue settings
|
|
138
|
-
max_queue_size: int = Field(default=1000, description="Maximum task queue size")
|
|
139
|
-
queue_timeout_seconds: float = Field(default=30.0, description="Queue timeout")
|
|
140
|
-
|
|
141
|
-
# Monitoring
|
|
142
|
-
enable_monitoring: bool = Field(default=True, description="Enable thread monitoring")
|
|
143
|
-
metrics_collection_interval: float = Field(
|
|
144
|
-
default=10.0, description="Metrics collection interval"
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
# Load balancing
|
|
148
|
-
load_balancing_strategy: LoadBalancingStrategy = Field(
|
|
149
|
-
default=LoadBalancingStrategy.LEAST_LOADED, description="Load balancing strategy"
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
class ThreadInfo(BaseModel):
|
|
154
|
-
"""Individual thread information model."""
|
|
155
|
-
|
|
156
|
-
model_config = ConfigDict(extra="forbid")
|
|
157
|
-
|
|
158
|
-
# Thread identification
|
|
159
|
-
thread_id: str = Field(..., description="Thread identifier")
|
|
160
|
-
thread_name: str = Field(..., description="Thread name")
|
|
161
|
-
pool_name: str = Field(..., description="Pool this thread belongs to")
|
|
162
|
-
|
|
163
|
-
# Status
|
|
164
|
-
is_alive: bool = Field(..., description="Whether thread is alive")
|
|
165
|
-
is_busy: bool = Field(default=False, description="Whether thread is executing task")
|
|
166
|
-
current_task_id: Optional[str] = Field(default=None, description="Currently executing task ID")
|
|
167
|
-
|
|
168
|
-
# Performance metrics
|
|
169
|
-
total_tasks_executed: int = Field(default=0, description="Total tasks executed")
|
|
170
|
-
avg_task_duration_ms: float = Field(default=0.0, description="Average task duration")
|
|
171
|
-
last_activity: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
172
|
-
|
|
173
|
-
# Resource usage
|
|
174
|
-
cpu_usage_percent: Optional[float] = Field(default=None, description="CPU usage percentage")
|
|
175
|
-
memory_usage_mb: Optional[float] = Field(default=None, description="Memory usage in MB")
|
|
176
|
-
|
|
177
|
-
# Timing
|
|
178
|
-
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
179
|
-
last_task_start: Optional[datetime] = Field(default=None, description="Last task start time")
|
|
180
|
-
last_task_end: Optional[datetime] = Field(default=None, description="Last task end time")
|
|
181
|
-
|
|
182
|
-
# Health
|
|
183
|
-
error_count: int = Field(default=0, description="Number of errors encountered")
|
|
184
|
-
last_error: Optional[str] = Field(default=None, description="Last error message")
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
class Task(BaseModel):
|
|
188
|
-
"""Task execution model."""
|
|
189
|
-
|
|
190
|
-
model_config = ConfigDict(extra="forbid")
|
|
191
|
-
|
|
192
|
-
# Task identification
|
|
193
|
-
task_id: str = Field(default_factory=lambda: str(uuid.uuid4()))
|
|
194
|
-
task_name: str = Field(..., description="Task name")
|
|
195
|
-
task_type: str = Field(..., description="Task type/category")
|
|
196
|
-
|
|
197
|
-
# Priority and scheduling
|
|
198
|
-
priority: TaskPriority = Field(default=TaskPriority.NORMAL, description="Task priority")
|
|
199
|
-
status: TaskStatus = Field(default=TaskStatus.PENDING, description="Task status")
|
|
200
|
-
|
|
201
|
-
# Execution context
|
|
202
|
-
assigned_thread_id: Optional[str] = Field(default=None, description="Assigned thread ID")
|
|
203
|
-
pool_name: Optional[str] = Field(default=None, description="Assigned pool name")
|
|
204
|
-
|
|
205
|
-
# Timing
|
|
206
|
-
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
207
|
-
scheduled_at: Optional[datetime] = Field(default=None, description="Scheduled execution time")
|
|
208
|
-
started_at: Optional[datetime] = Field(default=None, description="Actual start time")
|
|
209
|
-
completed_at: Optional[datetime] = Field(default=None, description="Completion time")
|
|
210
|
-
|
|
211
|
-
# Performance
|
|
212
|
-
estimated_duration_ms: Optional[float] = Field(default=None, description="Estimated duration")
|
|
213
|
-
actual_duration_ms: Optional[float] = Field(default=None, description="Actual duration")
|
|
214
|
-
timeout_seconds: Optional[float] = Field(default=None, description="Task timeout")
|
|
215
|
-
|
|
216
|
-
# Dependencies
|
|
217
|
-
dependencies: List[str] = Field(
|
|
218
|
-
default_factory=list, description="Task dependencies (task IDs)"
|
|
219
|
-
)
|
|
220
|
-
dependents: List[str] = Field(default_factory=list, description="Tasks depending on this one")
|
|
221
|
-
|
|
222
|
-
# Results and errors
|
|
223
|
-
result: Optional[Any] = Field(default=None, description="Task result")
|
|
224
|
-
error_message: Optional[str] = Field(default=None, description="Error message if failed")
|
|
225
|
-
retry_count: int = Field(default=0, description="Number of retry attempts")
|
|
226
|
-
max_retries: int = Field(default=3, description="Maximum retry attempts")
|
|
227
|
-
|
|
228
|
-
# Context and metadata
|
|
229
|
-
context: Dict[str, Any] = Field(default_factory=dict, description="Task context data")
|
|
230
|
-
tags: Dict[str, str] = Field(default_factory=dict, description="Task tags")
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
class ResourcePool(BaseModel):
|
|
234
|
-
"""Resource pool management model."""
|
|
235
|
-
|
|
236
|
-
model_config = ConfigDict(extra="forbid")
|
|
237
|
-
|
|
238
|
-
# Pool identification
|
|
239
|
-
pool_id: str = Field(..., description="Pool identifier")
|
|
240
|
-
pool_name: str = Field(..., description="Pool name")
|
|
241
|
-
resource_type: ResourceType = Field(..., description="Type of resources in pool")
|
|
242
|
-
|
|
243
|
-
# Pool configuration
|
|
244
|
-
min_size: int = Field(default=1, description="Minimum pool size")
|
|
245
|
-
max_size: int = Field(default=100, description="Maximum pool size")
|
|
246
|
-
current_size: int = Field(default=0, description="Current pool size")
|
|
247
|
-
|
|
248
|
-
# Resource status
|
|
249
|
-
available_resources: int = Field(default=0, description="Available resources")
|
|
250
|
-
in_use_resources: int = Field(default=0, description="Resources in use")
|
|
251
|
-
reserved_resources: int = Field(default=0, description="Reserved resources")
|
|
252
|
-
|
|
253
|
-
# Performance metrics
|
|
254
|
-
total_requests: int = Field(default=0, description="Total resource requests")
|
|
255
|
-
successful_acquisitions: int = Field(default=0, description="Successful acquisitions")
|
|
256
|
-
failed_acquisitions: int = Field(default=0, description="Failed acquisitions")
|
|
257
|
-
avg_acquisition_time_ms: float = Field(default=0.0, description="Average acquisition time")
|
|
258
|
-
|
|
259
|
-
# Health and lifecycle
|
|
260
|
-
status: ResourceStatus = Field(default=ResourceStatus.AVAILABLE, description="Pool status")
|
|
261
|
-
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
262
|
-
last_maintenance: Optional[datetime] = Field(default=None, description="Last maintenance time")
|
|
263
|
-
|
|
264
|
-
# Auto-management
|
|
265
|
-
auto_scale: bool = Field(default=True, description="Enable auto-scaling")
|
|
266
|
-
scale_threshold: float = Field(default=0.8, description="Scaling threshold")
|
|
267
|
-
idle_timeout_seconds: float = Field(default=300.0, description="Resource idle timeout")
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
class ConcurrencyMetrics(BaseModel):
|
|
271
|
-
"""Concurrency system metrics model."""
|
|
272
|
-
|
|
273
|
-
model_config = ConfigDict(extra="forbid")
|
|
274
|
-
|
|
275
|
-
# Thread pool metrics
|
|
276
|
-
total_threads: int = Field(default=0, description="Total number of threads")
|
|
277
|
-
active_threads: int = Field(default=0, description="Active threads")
|
|
278
|
-
idle_threads: int = Field(default=0, description="Idle threads")
|
|
279
|
-
thread_utilization_percent: float = Field(default=0.0, description="Thread utilization")
|
|
280
|
-
|
|
281
|
-
# Task metrics
|
|
282
|
-
total_tasks: int = Field(default=0, description="Total tasks processed")
|
|
283
|
-
pending_tasks: int = Field(default=0, description="Tasks in queue")
|
|
284
|
-
running_tasks: int = Field(default=0, description="Currently running tasks")
|
|
285
|
-
completed_tasks: int = Field(default=0, description="Completed tasks")
|
|
286
|
-
failed_tasks: int = Field(default=0, description="Failed tasks")
|
|
287
|
-
|
|
288
|
-
# Performance metrics
|
|
289
|
-
avg_task_duration_ms: float = Field(default=0.0, description="Average task duration")
|
|
290
|
-
avg_queue_wait_time_ms: float = Field(default=0.0, description="Average queue wait time")
|
|
291
|
-
throughput_tasks_per_second: float = Field(default=0.0, description="Tasks per second")
|
|
292
|
-
|
|
293
|
-
# Resource metrics
|
|
294
|
-
total_resource_pools: int = Field(default=0, description="Number of resource pools")
|
|
295
|
-
total_resources: int = Field(default=0, description="Total managed resources")
|
|
296
|
-
available_resources: int = Field(default=0, description="Available resources")
|
|
297
|
-
resource_utilization_percent: float = Field(default=0.0, description="Resource utilization")
|
|
298
|
-
|
|
299
|
-
# Error metrics
|
|
300
|
-
deadlock_count: int = Field(default=0, description="Detected deadlocks")
|
|
301
|
-
timeout_count: int = Field(default=0, description="Task timeouts")
|
|
302
|
-
error_rate_percent: float = Field(default=0.0, description="Overall error rate")
|
|
303
|
-
|
|
304
|
-
# System metrics
|
|
305
|
-
cpu_usage_percent: float = Field(default=0.0, description="System CPU usage")
|
|
306
|
-
memory_usage_mb: float = Field(default=0.0, description="System memory usage")
|
|
307
|
-
|
|
308
|
-
# Timing
|
|
309
|
-
measurement_start: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
310
|
-
measurement_end: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
311
|
-
collection_interval_seconds: float = Field(
|
|
312
|
-
default=60.0, description="Metrics collection interval"
|
|
313
|
-
)
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
class LoadBalancingDecision(BaseModel):
|
|
317
|
-
"""Load balancing decision model."""
|
|
318
|
-
|
|
319
|
-
model_config = ConfigDict(extra="forbid")
|
|
320
|
-
|
|
321
|
-
# Decision context
|
|
322
|
-
decision_id: str = Field(default_factory=lambda: str(uuid.uuid4()))
|
|
323
|
-
task_id: str = Field(..., description="Task being assigned")
|
|
324
|
-
strategy_used: LoadBalancingStrategy = Field(..., description="Strategy used for decision")
|
|
325
|
-
|
|
326
|
-
# Assignment result
|
|
327
|
-
selected_thread_id: str = Field(..., description="Selected thread ID")
|
|
328
|
-
selected_pool_name: str = Field(..., description="Selected pool name")
|
|
329
|
-
|
|
330
|
-
# Decision factors
|
|
331
|
-
thread_utilization: float = Field(..., description="Selected thread utilization")
|
|
332
|
-
load_score: float = Field(..., description="Load balancing score")
|
|
333
|
-
performance_history: Optional[float] = Field(default=None, description="Historical performance")
|
|
334
|
-
|
|
335
|
-
# Alternative options
|
|
336
|
-
alternative_threads: List[str] = Field(default_factory=list, description="Other thread options")
|
|
337
|
-
rejection_reasons: Dict[str, str] = Field(
|
|
338
|
-
default_factory=dict, description="Why others were rejected"
|
|
339
|
-
)
|
|
340
|
-
|
|
341
|
-
# Timing
|
|
342
|
-
decision_time_ms: float = Field(..., description="Time taken to make decision")
|
|
343
|
-
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
class DeadlockDetection(BaseModel):
|
|
347
|
-
"""Deadlock detection result model."""
|
|
348
|
-
|
|
349
|
-
model_config = ConfigDict(extra="forbid")
|
|
350
|
-
|
|
351
|
-
# Detection info
|
|
352
|
-
detection_id: str = Field(default_factory=lambda: str(uuid.uuid4()))
|
|
353
|
-
detected_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
354
|
-
|
|
355
|
-
# Deadlock details
|
|
356
|
-
involved_threads: List[str] = Field(..., description="Threads involved in deadlock")
|
|
357
|
-
involved_resources: List[str] = Field(..., description="Resources involved")
|
|
358
|
-
deadlock_chain: List[str] = Field(..., description="Chain of dependencies")
|
|
359
|
-
|
|
360
|
-
# Resolution
|
|
361
|
-
resolution_strategy: str = Field(..., description="Strategy used to resolve deadlock")
|
|
362
|
-
resolved: bool = Field(default=False, description="Whether deadlock was resolved")
|
|
363
|
-
resolved_at: Optional[datetime] = Field(default=None, description="Resolution time")
|
|
364
|
-
|
|
365
|
-
# Impact
|
|
366
|
-
affected_tasks: List[str] = Field(
|
|
367
|
-
default_factory=list, description="Tasks affected by deadlock"
|
|
368
|
-
)
|
|
369
|
-
resolution_time_ms: Optional[float] = Field(default=None, description="Time to resolve")
|
|
370
|
-
|
|
371
|
-
# Context
|
|
372
|
-
system_state: Dict[str, Any] = Field(default_factory=dict, description="System state snapshot")
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
__all__ = [
|
|
376
|
-
# Enums
|
|
377
|
-
"ThreadPoolStrategy",
|
|
378
|
-
"LoadBalancingStrategy",
|
|
379
|
-
"TaskPriority",
|
|
380
|
-
"TaskStatus",
|
|
381
|
-
"ResourceType",
|
|
382
|
-
"ResourceStatus",
|
|
383
|
-
"ConcurrencyEventType",
|
|
384
|
-
# Configuration models
|
|
385
|
-
"ThreadPoolConfig",
|
|
386
|
-
# Core models
|
|
387
|
-
"ThreadInfo",
|
|
388
|
-
"Task",
|
|
389
|
-
"ResourcePool",
|
|
390
|
-
"ConcurrencyMetrics",
|
|
391
|
-
"LoadBalancingDecision",
|
|
392
|
-
"DeadlockDetection",
|
|
393
|
-
]
|
unrealon_sdk/src/dto/events.py
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Event-related Data Transfer Objects
|
|
3
|
-
|
|
4
|
-
Custom DTO models for enterprise event system functionality.
|
|
5
|
-
These models provide type-safe event handling with validation.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from datetime import datetime, timezone
|
|
9
|
-
from typing import Dict, List, Optional
|
|
10
|
-
from enum import Enum
|
|
11
|
-
from dataclasses import dataclass, field
|
|
12
|
-
|
|
13
|
-
from pydantic import BaseModel, Field, ConfigDict
|
|
14
|
-
|
|
15
|
-
# Import auto-generated events for compatibility
|
|
16
|
-
from unrealon_sdk.src.clients.python_websocket.events import SocketEvent
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class EventPriority(str, Enum):
|
|
20
|
-
"""Event priority levels for processing order."""
|
|
21
|
-
|
|
22
|
-
LOW = "low"
|
|
23
|
-
NORMAL = "normal"
|
|
24
|
-
HIGH = "high"
|
|
25
|
-
CRITICAL = "critical"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class EventDeliveryStatus(str, Enum):
|
|
29
|
-
"""Event delivery status tracking."""
|
|
30
|
-
|
|
31
|
-
PENDING = "pending"
|
|
32
|
-
DELIVERED = "delivered"
|
|
33
|
-
FAILED = "failed"
|
|
34
|
-
RETRY = "retry"
|
|
35
|
-
EXPIRED = "expired"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class EventSubscriptionFilter(BaseModel):
|
|
39
|
-
"""Type-safe event subscription filters."""
|
|
40
|
-
|
|
41
|
-
model_config = ConfigDict(validate_assignment=True, extra="forbid")
|
|
42
|
-
|
|
43
|
-
event_types: Optional[List[SocketEvent]] = Field(None, description="Filter by event types")
|
|
44
|
-
source_pattern: Optional[str] = Field(None, description="Filter by source pattern")
|
|
45
|
-
priority_min: Optional[EventPriority] = Field(None, description="Minimum priority level")
|
|
46
|
-
correlation_id: Optional[str] = Field(None, description="Filter by correlation ID")
|
|
47
|
-
tags: Optional[List[str]] = Field(None, description="Filter by tags")
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class EventMetadata(BaseModel):
|
|
51
|
-
"""Structured event metadata with full type safety."""
|
|
52
|
-
|
|
53
|
-
model_config = ConfigDict(validate_assignment=True, extra="forbid")
|
|
54
|
-
|
|
55
|
-
event_id: str = Field(..., description="Unique event identifier")
|
|
56
|
-
correlation_id: str = Field(..., description="Request correlation ID")
|
|
57
|
-
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
58
|
-
source: str = Field(..., description="Event source identifier")
|
|
59
|
-
priority: EventPriority = Field(default=EventPriority.NORMAL)
|
|
60
|
-
tags: List[str] = Field(default_factory=list, description="Event tags for filtering")
|
|
61
|
-
retry_count: int = Field(default=0, description="Number of retry attempts")
|
|
62
|
-
expires_at: Optional[datetime] = Field(None, description="Event expiration time")
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
class EventDeliveryResult(BaseModel):
|
|
66
|
-
"""Event delivery tracking and results."""
|
|
67
|
-
|
|
68
|
-
model_config = ConfigDict(validate_assignment=True, extra="forbid")
|
|
69
|
-
|
|
70
|
-
delivery_id: str = Field(..., description="Unique delivery identifier")
|
|
71
|
-
event_id: str = Field(..., description="Event identifier")
|
|
72
|
-
subscription_id: str = Field(..., description="Subscription identifier")
|
|
73
|
-
status: EventDeliveryStatus = Field(..., description="Delivery status")
|
|
74
|
-
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
75
|
-
error_message: Optional[str] = Field(None, description="Error message if failed")
|
|
76
|
-
retry_count: int = Field(default=0, description="Retry attempts")
|
|
77
|
-
delivery_time_ms: Optional[float] = Field(None, description="Delivery time in milliseconds")
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@dataclass
|
|
81
|
-
class EventStatistics:
|
|
82
|
-
"""Event system performance statistics."""
|
|
83
|
-
|
|
84
|
-
total_events_published: int = 0
|
|
85
|
-
total_events_delivered: int = 0
|
|
86
|
-
total_delivery_failures: int = 0
|
|
87
|
-
active_subscriptions: int = 0
|
|
88
|
-
average_delivery_time_ms: float = 0.0
|
|
89
|
-
events_by_type: Dict[str, int] = field(default_factory=dict)
|
|
90
|
-
events_by_priority: Dict[str, int] = field(default_factory=dict)
|
|
91
|
-
|
|
92
|
-
@property
|
|
93
|
-
def success_rate(self) -> float:
|
|
94
|
-
"""Calculate delivery success rate."""
|
|
95
|
-
total_attempted = self.total_events_delivered + self.total_delivery_failures
|
|
96
|
-
if total_attempted == 0:
|
|
97
|
-
return 100.0
|
|
98
|
-
return (self.total_events_delivered / total_attempted) * 100.0
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
__all__ = [
|
|
102
|
-
"EventPriority",
|
|
103
|
-
"EventDeliveryStatus",
|
|
104
|
-
"EventSubscriptionFilter",
|
|
105
|
-
"EventMetadata",
|
|
106
|
-
"EventDeliveryResult",
|
|
107
|
-
"EventStatistics",
|
|
108
|
-
]
|