-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessages.py
More file actions
42 lines (38 loc) · 1.5 KB
/
messages.py
File metadata and controls
42 lines (38 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Message models for Superstream client communication."""
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional
from superclient import __version__ as _LIB_VERSION
@dataclass
class TopicConfiguration:
"""Configuration for a specific topic."""
topic_name: str
optimized_configuration: Dict[str, Any]
potential_reduction_percentage: float
daily_writes_bytes: int
@dataclass
class MetadataMessage:
"""Message for metadata communication."""
topics_configuration: List[TopicConfiguration]
report_interval_ms: Optional[int] = None
active: bool = True
@dataclass
class ClientMessage:
"""Base message for client communication."""
client_id: str
ip_address: str
type: str = "producer"
message_type: str = "client_stats"
version: str = field(default_factory=lambda: _LIB_VERSION)
topics: List[str] = field(default_factory=list)
original_configuration: Dict[str, Any] = field(default_factory=dict)
optimized_configuration: Dict[str, Any] = field(default_factory=dict)
environment_variables: Dict[str, str] = field(default_factory=dict)
hostname: str = ""
superstream_client_uid: str = ""
most_impactful_topic: str = ""
language: str = ""
error: str = ""
producer_metrics: Dict[str, Any] = field(default_factory=dict)
topic_metrics: Dict[str, Any] = field(default_factory=dict)
node_metrics: Dict[str, Any] = field(default_factory=dict)
app_info_metrics: Dict[str, Any] = field(default_factory=dict)