Commit 6a8e7af
committed
refactor: reorganize session management into dedicated components
Split session logic into dedicated components for better separation of
concerns
and maintainability:
- Move session code to dedicated session/ module
- Split Session class into:
- Session: Data container with minimal public API
- SessionManager: Handles lifecycle and state management
- SessionApi: Handles API communication
- SessionTelemetry: Manages event recording and OTEL integration
Key fixes:
- Proper UUID and timestamp serialization in events
- Consistent API key header handling
- Correct token cost formatting in analytics
- Proper session ID inheritance
- Tags conversion and validation
- Event counts type handling
This refactor improves code organization while maintaining backward
compatibility
through the session/__init__.py module.
Signed-off-by: Teo <[email protected]>1 parent 8f92278 commit 6a8e7af
File tree
10 files changed
+665
-698
lines changed- agentops
- session
- telemetry/exporters
10 files changed
+665
-698
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
| 201 | + | |
| 202 | + | |
211 | 203 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 204 | + | |
221 | 205 | | |
222 | | - | |
223 | | - | |
224 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
225 | 210 | | |
| 211 | + | |
226 | 212 | | |
227 | 213 | | |
228 | | - | |
229 | | - | |
230 | 214 | | |
| 215 | + | |
| 216 | + | |
231 | 217 | | |
232 | 218 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
240 | 228 | | |
241 | | - | |
242 | 229 | | |
243 | 230 | | |
244 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | | - | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
| |||
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
118 | | - | |
119 | | - | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
122 | 125 | | |
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
128 | | - | |
129 | 131 | | |
130 | 132 | | |
131 | | - | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
0 commit comments