Commit 5b419d3
Better root span management (#999)
* Introduced `start_trace` and `end_trace` functions for user-managed tracing, allowing concurrent traces.
* Enhance tracing functionality by introducing new decorators and improving session handling. Added `trace`, `session`, `agent`, `task`, `workflow`, and `operation` decorators for better instrumentation. Updated `log_trace_url` to include titles for improved logging context. Refactored `Client` initialization trace name and adjusted end trace state handling. Improved error handling during trace logging in `TracingCore` and removed deprecated session decorator usage.
* cleanup
* Enhance `init` function in AgentOps SDK by adding new parameters: `tags`, `auto_init`, `skip_auto_end_session`, and `fail_safe`. Updated documentation to reflect changes and merged `tags` with `default_tags` for improved session management. Refactored client initialization to accommodate new options.
* Refactor legacy session handling by replacing `LegacySession` with `Session` in `agentops` module. This change improves code clarity and aligns with the updated session management approach.
* Enhance unit tests for URL logging in TracingCore and InternalSpanProcessor. Added tests for start and end trace URL logging, handling failures gracefully, and verifying root span tracking. Improved test coverage for session decorators and ensured proper handling of unsampled spans. Refactored existing tests for clarity and consistency.
* Refactor CrewAI workflow instrumentation to enhance span management and attribute tracking. Updated span creation to use dynamic workflow names and improved error handling. Adjusted span kinds from CLIENT to INTERNAL for better clarity in tracing. Streamlined attribute setting for agents and tasks, ensuring accurate logging of results and metrics.
* Refactor force_flush method in TracingCore to remove timeout parameter, simplifying the flush process. Updated logging to indicate completion of the flush operation.
* Refactor Client initialization logic to clarify re-initialization conditions for the API key. Only trigger a warning if a different non-None API key is provided during re-initialization, enhancing the clarity of client behavior.
* Refactor Client initialization to support backward compatibility with legacy session wrapper. Update unit tests to enhance coverage for new session management functionality, including explicit trace handling and decorator behavior. Ensure proper integration between new and legacy APIs for session and trace management.
* Improve authentication error handling in Client and V3Client. Added exception handling for token fetching and response processing, ensuring clearer error logging and re-raising of exceptions for better testability. Updated integration tests to reset client state between tests.
* Refactor integration tests for session concurrency to improve isolation and error handling. Mock API client and tracing core to avoid real authentication during tests. Simplify concurrency test descriptions and ensure proper cleanup of client state between tests.
* Enhance trace management by updating end_trace function to allow ending all active traces when no context is provided. Refactor end_all_sessions to utilize the new end_trace functionality, ensuring legacy global state is cleared. Introduce thread-safe handling of active traces in TracingCore with locking mechanisms for improved concurrency.
* Enhance trace ID handling in TracingCore by adding exception handling for invalid trace IDs. This ensures robustness when dealing with mocked spans or non-integer trace IDs, improving overall trace management reliability.
* revert crewai
* Enhance tracing functionality by adding `trace_name` parameter to configuration and initialization. This allows for customizable trace/session naming, improving trace management and clarity in logs. Updated relevant classes and methods to utilize the new parameter.
* Remove unused span variables in entity decorator function to streamline code and improve clarity.
---------
Co-authored-by: Pratyush Shukla <[email protected]>1 parent bd397dd commit 5b419d3
File tree
16 files changed
+1478
-704
lines changed- agentops
- client
- api/versions
- helpers
- instrumentation/crewai
- legacy
- sdk
- decorators
- semconv
- tests
- integration
- unit
- sdk
16 files changed
+1478
-704
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
| 85 | + | |
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
| |||
108 | 113 | | |
109 | 114 | | |
110 | 115 | | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
165 | 171 | | |
166 | 172 | | |
167 | 173 | | |
168 | | - | |
169 | | - | |
170 | 174 | | |
171 | 175 | | |
172 | 176 | | |
173 | 177 | | |
174 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
175 | 227 | | |
176 | 228 | | |
177 | 229 | | |
178 | 230 | | |
179 | 231 | | |
| 232 | + | |
| 233 | + | |
180 | 234 | | |
181 | 235 | | |
182 | 236 | | |
183 | 237 | | |
184 | 238 | | |
185 | | - | |
186 | 239 | | |
187 | 240 | | |
188 | 241 | | |
189 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
190 | 250 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
33 | 44 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
43 | 49 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 50 | + | |
53 | 51 | | |
54 | | - | |
55 | | - | |
| 52 | + | |
| 53 | + | |
56 | 54 | | |
57 | 55 | | |
0 commit comments