agenta 0.48.8__py3-none-any.whl → 0.48.10__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.

Potentially problematic release.


This version of agenta might be problematic. Click here for more details.

Files changed (297) hide show
  1. agenta/__init__.py +3 -2
  2. agenta/client/Readme.md +258 -80
  3. agenta/client/__init__.py +205 -29
  4. agenta/client/backend/__init__.py +461 -0
  5. agenta/client/backend/access_control/__init__.py +2 -0
  6. agenta/client/backend/access_control/client.py +53 -73
  7. agenta/client/backend/access_control/raw_client.py +180 -0
  8. agenta/client/backend/admin/__init__.py +2 -0
  9. agenta/client/backend/admin/client.py +473 -268
  10. agenta/client/backend/admin/raw_client.py +1017 -0
  11. agenta/client/backend/api_keys/__init__.py +2 -0
  12. agenta/client/backend/api_keys/client.py +43 -276
  13. agenta/client/backend/api_keys/raw_client.py +364 -0
  14. agenta/client/backend/apps/__init__.py +2 -0
  15. agenta/client/backend/apps/client.py +132 -895
  16. agenta/client/backend/apps/raw_client.py +1516 -0
  17. agenta/client/backend/bases/__init__.py +2 -0
  18. agenta/client/backend/bases/client.py +33 -73
  19. agenta/client/backend/bases/raw_client.py +179 -0
  20. agenta/client/backend/billing/__init__.py +3 -0
  21. agenta/client/backend/billing/client.py +564 -0
  22. agenta/client/backend/billing/raw_client.py +805 -0
  23. agenta/client/backend/client.py +1268 -0
  24. agenta/client/backend/configs/__init__.py +2 -0
  25. agenta/client/backend/configs/client.py +49 -361
  26. agenta/client/backend/configs/raw_client.py +402 -0
  27. agenta/client/backend/containers/__init__.py +1 -3
  28. agenta/client/backend/containers/client.py +25 -548
  29. agenta/client/backend/containers/raw_client.py +112 -0
  30. agenta/client/backend/core/__init__.py +5 -0
  31. agenta/client/backend/core/api_error.py +12 -6
  32. agenta/client/backend/core/client_wrapper.py +4 -4
  33. agenta/client/backend/core/file.py +1 -3
  34. agenta/client/backend/core/force_multipart.py +16 -0
  35. agenta/client/backend/core/http_client.py +78 -34
  36. agenta/client/backend/core/http_response.py +55 -0
  37. agenta/client/backend/core/jsonable_encoder.py +0 -1
  38. agenta/client/backend/core/pydantic_utilities.py +88 -113
  39. agenta/client/backend/core/serialization.py +9 -3
  40. agenta/client/backend/environment.py +7 -0
  41. agenta/client/backend/environments/__init__.py +2 -0
  42. agenta/client/backend/environments/client.py +43 -79
  43. agenta/client/backend/environments/raw_client.py +193 -0
  44. agenta/client/backend/errors/__init__.py +2 -0
  45. agenta/client/backend/errors/unprocessable_entity_error.py +8 -2
  46. agenta/client/backend/evals/__init__.py +3 -0
  47. agenta/client/backend/evals/client.py +1042 -0
  48. agenta/client/backend/evals/raw_client.py +1549 -0
  49. agenta/client/backend/evaluations/__init__.py +2 -0
  50. agenta/client/backend/evaluations/client.py +106 -590
  51. agenta/client/backend/evaluations/raw_client.py +1344 -0
  52. agenta/client/backend/evaluators/__init__.py +2 -0
  53. agenta/client/backend/evaluators/client.py +99 -516
  54. agenta/client/backend/evaluators/raw_client.py +1182 -0
  55. agenta/client/backend/human_evaluations/__init__.py +2 -0
  56. agenta/client/backend/human_evaluations/client.py +120 -680
  57. agenta/client/backend/human_evaluations/raw_client.py +1577 -0
  58. agenta/client/backend/observability/__init__.py +14 -2
  59. agenta/client/backend/observability/client.py +185 -341
  60. agenta/client/backend/observability/raw_client.py +943 -0
  61. agenta/client/backend/observability/types/__init__.py +10 -2
  62. agenta/client/backend/observability/types/{format.py → fetch_trace_by_id_request_trace_id.py} +1 -1
  63. agenta/client/backend/observability/types/fetch_trace_by_id_response.py +15 -0
  64. agenta/client/backend/observability/types/query_analytics_response.py +2 -1
  65. agenta/client/backend/observability/types/query_traces_response.py +7 -3
  66. agenta/client/backend/organization/__init__.py +2 -0
  67. agenta/client/backend/organization/client.py +105 -361
  68. agenta/client/backend/organization/raw_client.py +774 -0
  69. agenta/client/backend/raw_client.py +1432 -0
  70. agenta/client/backend/scopes/__init__.py +2 -0
  71. agenta/client/backend/scopes/client.py +31 -45
  72. agenta/client/backend/scopes/raw_client.py +105 -0
  73. agenta/client/backend/testsets/__init__.py +14 -0
  74. agenta/client/backend/testsets/client.py +1098 -653
  75. agenta/client/backend/testsets/raw_client.py +2348 -0
  76. agenta/client/backend/testsets/types/__init__.py +17 -0
  77. agenta/client/backend/testsets/types/create_testset_from_file_request_file_type.py +7 -0
  78. agenta/client/backend/testsets/types/fetch_testset_to_file_request_file_type.py +7 -0
  79. agenta/client/backend/testsets/types/update_testset_from_file_request_file_type.py +7 -0
  80. agenta/client/backend/tracing/__init__.py +7 -0
  81. agenta/client/backend/tracing/client.py +782 -0
  82. agenta/client/backend/tracing/raw_client.py +1223 -0
  83. agenta/client/backend/tracing/types/__init__.py +8 -0
  84. agenta/client/backend/{types/variant_action_enum.py → tracing/types/fetch_trace_request_trace_id.py} +1 -1
  85. agenta/client/backend/tracing/types/remove_trace_request_trace_id.py +5 -0
  86. agenta/client/backend/types/__init__.py +153 -26
  87. agenta/client/backend/types/account_request.py +24 -0
  88. agenta/client/backend/types/account_response.py +5 -7
  89. agenta/client/backend/types/agenta_node_dto.py +13 -13
  90. agenta/client/backend/types/agenta_node_dto_nodes_value.py +1 -0
  91. agenta/client/backend/types/agenta_nodes_response.py +14 -8
  92. agenta/client/backend/types/agenta_root_dto.py +16 -8
  93. agenta/client/backend/types/agenta_roots_response.py +16 -8
  94. agenta/client/backend/types/agenta_tree_dto.py +16 -8
  95. agenta/client/backend/types/agenta_trees_response.py +16 -8
  96. agenta/client/backend/types/aggregated_result.py +5 -7
  97. agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -0
  98. agenta/client/backend/types/analytics_response.py +4 -6
  99. agenta/client/backend/types/annotation.py +50 -0
  100. agenta/client/backend/types/annotation_create.py +39 -0
  101. agenta/client/backend/types/annotation_edit.py +31 -0
  102. agenta/client/backend/types/annotation_kind.py +5 -0
  103. agenta/client/backend/types/{uri.py → annotation_link.py} +6 -7
  104. agenta/client/backend/types/{provider_key_dto.py → annotation_link_response.py} +6 -7
  105. agenta/client/backend/types/annotation_query.py +40 -0
  106. agenta/client/backend/types/annotation_query_request.py +20 -0
  107. agenta/client/backend/types/annotation_reference.py +21 -0
  108. agenta/client/backend/types/annotation_references.py +22 -0
  109. agenta/client/backend/types/{docker_env_vars.py → annotation_response.py} +6 -7
  110. agenta/client/backend/types/annotation_source.py +5 -0
  111. agenta/client/backend/types/annotations_response.py +24 -0
  112. agenta/client/backend/types/app.py +3 -5
  113. agenta/client/backend/types/app_variant_response.py +3 -6
  114. agenta/client/backend/types/app_variant_revision.py +5 -6
  115. agenta/client/backend/types/artifact.py +44 -0
  116. agenta/client/backend/types/base_output.py +3 -5
  117. agenta/client/backend/types/body_fetch_workflow_revision.py +21 -0
  118. agenta/client/backend/types/body_import_testset.py +3 -5
  119. agenta/client/backend/types/bucket_dto.py +4 -6
  120. agenta/client/backend/types/collect_status_response.py +3 -5
  121. agenta/client/backend/types/config_db.py +3 -5
  122. agenta/client/backend/types/config_dto.py +5 -7
  123. agenta/client/backend/types/config_response_model.py +5 -7
  124. agenta/client/backend/types/correct_answer.py +3 -5
  125. agenta/client/backend/types/create_app_output.py +3 -5
  126. agenta/client/backend/types/custom_model_settings_dto.py +3 -5
  127. agenta/client/backend/types/custom_provider_dto.py +6 -9
  128. agenta/client/backend/types/custom_provider_kind.py +5 -5
  129. agenta/client/backend/types/custom_provider_settings_dto.py +3 -5
  130. agenta/client/backend/types/data.py +2 -1
  131. agenta/client/backend/types/delete_evaluation.py +3 -5
  132. agenta/client/backend/types/environment_output.py +3 -5
  133. agenta/client/backend/types/environment_output_extended.py +4 -6
  134. agenta/client/backend/types/environment_revision.py +5 -5
  135. agenta/client/backend/types/error.py +3 -5
  136. agenta/client/backend/types/evaluation.py +6 -8
  137. agenta/client/backend/types/evaluation_scenario.py +5 -7
  138. agenta/client/backend/types/evaluation_scenario_input.py +3 -5
  139. agenta/client/backend/types/evaluation_scenario_output.py +4 -6
  140. agenta/client/backend/types/evaluation_scenario_result.py +4 -6
  141. agenta/client/backend/types/evaluator.py +31 -12
  142. agenta/client/backend/types/evaluator_config.py +3 -5
  143. agenta/client/backend/types/evaluator_flags.py +21 -0
  144. agenta/client/backend/types/evaluator_mapping_output_interface.py +3 -5
  145. agenta/client/backend/types/evaluator_output_interface.py +3 -5
  146. agenta/client/backend/types/evaluator_query.py +32 -0
  147. agenta/client/backend/types/evaluator_query_request.py +30 -0
  148. agenta/client/backend/types/evaluator_request.py +20 -0
  149. agenta/client/backend/types/evaluator_response.py +21 -0
  150. agenta/client/backend/types/evaluators_response.py +21 -0
  151. agenta/client/backend/types/exception_dto.py +3 -5
  152. agenta/client/backend/types/{o_tel_spans_response.py → extended_o_tel_tracing_response.py} +5 -7
  153. agenta/client/backend/types/focus.py +5 -0
  154. agenta/client/backend/types/format.py +5 -0
  155. agenta/client/backend/types/full_json_input.py +34 -0
  156. agenta/client/backend/types/full_json_output.py +29 -0
  157. agenta/client/backend/types/get_config_response.py +3 -5
  158. agenta/client/backend/types/{header_dto.py → header.py} +4 -6
  159. agenta/client/backend/types/http_validation_error.py +4 -6
  160. agenta/client/backend/types/human_evaluation.py +3 -5
  161. agenta/client/backend/types/human_evaluation_scenario.py +4 -6
  162. agenta/client/backend/types/human_evaluation_scenario_input.py +3 -5
  163. agenta/client/backend/types/human_evaluation_scenario_output.py +3 -5
  164. agenta/client/backend/types/invite_request.py +4 -6
  165. agenta/client/backend/types/legacy_analytics_response.py +4 -6
  166. agenta/client/backend/types/legacy_data_point.py +3 -5
  167. agenta/client/backend/types/legacy_evaluator.py +26 -0
  168. agenta/client/backend/types/legacy_scope_request.py +4 -6
  169. agenta/client/backend/types/legacy_scopes_response.py +3 -5
  170. agenta/client/backend/types/legacy_subscription_request.py +19 -0
  171. agenta/client/backend/types/legacy_user_request.py +5 -7
  172. agenta/client/backend/types/legacy_user_response.py +3 -5
  173. agenta/client/backend/types/lifecycle_dto.py +3 -5
  174. agenta/client/backend/types/link_dto.py +4 -6
  175. agenta/client/backend/types/list_api_keys_response.py +3 -5
  176. agenta/client/backend/types/llm_run_rate_limit.py +3 -5
  177. agenta/client/backend/types/meta_request.py +30 -0
  178. agenta/client/backend/types/metrics_dto.py +3 -5
  179. agenta/client/backend/types/new_testset.py +3 -5
  180. agenta/client/backend/types/node_dto.py +4 -6
  181. agenta/client/backend/types/o_tel_context_dto.py +3 -5
  182. agenta/client/backend/types/o_tel_event.py +35 -0
  183. agenta/client/backend/types/o_tel_event_dto.py +3 -5
  184. agenta/client/backend/types/o_tel_extra_dto.py +4 -6
  185. agenta/client/backend/types/o_tel_flat_span.py +56 -0
  186. agenta/client/backend/types/o_tel_flat_span_input_end_time.py +6 -0
  187. agenta/client/backend/types/o_tel_flat_span_input_start_time.py +6 -0
  188. agenta/client/backend/types/o_tel_flat_span_output_end_time.py +6 -0
  189. agenta/client/backend/types/o_tel_flat_span_output_start_time.py +6 -0
  190. agenta/client/backend/types/o_tel_link.py +34 -0
  191. agenta/client/backend/types/o_tel_link_dto.py +4 -6
  192. agenta/client/backend/types/o_tel_links_response.py +22 -0
  193. agenta/client/backend/types/o_tel_span.py +58 -0
  194. agenta/client/backend/types/o_tel_span_dto.py +8 -10
  195. agenta/client/backend/types/o_tel_span_input_end_time.py +6 -0
  196. agenta/client/backend/types/o_tel_span_input_spans_value.py +7 -0
  197. agenta/client/backend/types/o_tel_span_input_start_time.py +6 -0
  198. agenta/client/backend/types/o_tel_span_output_end_time.py +6 -0
  199. agenta/client/backend/types/o_tel_span_output_spans_value.py +30 -0
  200. agenta/client/backend/types/o_tel_span_output_start_time.py +6 -0
  201. agenta/client/backend/types/o_tel_spans_tree.py +22 -0
  202. agenta/client/backend/types/o_tel_spans_tree_input_spans_value.py +7 -0
  203. agenta/client/backend/types/o_tel_spans_tree_output_spans_value.py +5 -0
  204. agenta/client/backend/types/o_tel_status_code.py +1 -1
  205. agenta/client/backend/types/o_tel_tracing_data_response.py +22 -0
  206. agenta/client/backend/types/o_tel_tracing_request.py +22 -0
  207. agenta/client/backend/types/o_tel_tracing_response.py +27 -0
  208. agenta/client/backend/types/organization.py +3 -5
  209. agenta/client/backend/types/organization_details.py +3 -5
  210. agenta/client/backend/types/organization_membership_request.py +5 -7
  211. agenta/client/backend/types/organization_output.py +3 -5
  212. agenta/client/backend/types/organization_request.py +3 -5
  213. agenta/client/backend/types/parent_dto.py +3 -5
  214. agenta/client/backend/types/permission.py +11 -0
  215. agenta/client/backend/types/plan.py +14 -0
  216. agenta/client/backend/types/project_membership_request.py +5 -7
  217. agenta/client/backend/types/project_request.py +4 -6
  218. agenta/client/backend/types/project_scope.py +5 -7
  219. agenta/client/backend/types/projects_response.py +3 -5
  220. agenta/client/backend/types/recursive_types.py +23 -0
  221. agenta/client/backend/types/reference.py +18 -5
  222. agenta/client/backend/types/reference_dto.py +4 -5
  223. agenta/client/backend/types/reference_request_model.py +4 -5
  224. agenta/client/backend/types/result.py +4 -6
  225. agenta/client/backend/types/root_dto.py +3 -5
  226. agenta/client/backend/types/scopes_response_model.py +4 -6
  227. agenta/client/backend/types/secret_dto.py +5 -7
  228. agenta/client/backend/types/secret_response_dto.py +11 -11
  229. agenta/client/backend/types/simple_evaluation_output.py +4 -6
  230. agenta/client/backend/types/span_dto.py +18 -14
  231. agenta/client/backend/types/span_dto_nodes_value.py +1 -1
  232. agenta/client/backend/types/standard_provider_dto.py +5 -7
  233. agenta/client/backend/types/standard_provider_settings_dto.py +3 -5
  234. agenta/client/backend/types/status_dto.py +4 -6
  235. agenta/client/backend/types/tags_request.py +30 -0
  236. agenta/client/backend/types/test_set_output_response.py +5 -7
  237. agenta/client/backend/types/test_set_simple_response.py +3 -5
  238. agenta/client/backend/types/testcase_response.py +33 -0
  239. agenta/client/backend/types/testset.py +46 -0
  240. agenta/client/backend/types/testset_request.py +20 -0
  241. agenta/client/backend/types/testset_response.py +21 -0
  242. agenta/client/backend/types/testsets_response.py +21 -0
  243. agenta/client/backend/types/time_dto.py +3 -5
  244. agenta/client/backend/types/timestamp.py +6 -0
  245. agenta/client/backend/types/tree_dto.py +4 -6
  246. agenta/client/backend/types/update_app_output.py +3 -5
  247. agenta/client/backend/types/user_request.py +3 -5
  248. agenta/client/backend/types/validation_error.py +4 -6
  249. agenta/client/backend/types/workflow_artifact.py +45 -0
  250. agenta/client/backend/types/workflow_data.py +20 -0
  251. agenta/client/backend/types/workflow_flags.py +21 -0
  252. agenta/client/backend/types/workflow_request.py +20 -0
  253. agenta/client/backend/types/workflow_response.py +21 -0
  254. agenta/client/backend/types/workflow_revision.py +57 -0
  255. agenta/client/backend/types/workflow_revision_request.py +20 -0
  256. agenta/client/backend/types/workflow_revision_response.py +21 -0
  257. agenta/client/backend/types/workflow_revisions_response.py +21 -0
  258. agenta/client/backend/types/workflow_variant.py +48 -0
  259. agenta/client/backend/types/workflow_variant_request.py +20 -0
  260. agenta/client/backend/types/workflow_variant_response.py +21 -0
  261. agenta/client/backend/types/workflow_variants_response.py +21 -0
  262. agenta/client/backend/types/workflows_response.py +21 -0
  263. agenta/client/backend/types/workspace.py +3 -5
  264. agenta/client/backend/types/workspace_member_response.py +4 -6
  265. agenta/client/backend/types/workspace_membership_request.py +5 -7
  266. agenta/client/backend/types/workspace_permission.py +5 -7
  267. agenta/client/backend/types/workspace_request.py +4 -6
  268. agenta/client/backend/types/workspace_response.py +4 -6
  269. agenta/client/backend/variants/__init__.py +2 -0
  270. agenta/client/backend/variants/client.py +306 -1651
  271. agenta/client/backend/variants/raw_client.py +2482 -0
  272. agenta/client/backend/variants/types/__init__.py +2 -0
  273. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +1 -0
  274. agenta/client/backend/vault/__init__.py +2 -0
  275. agenta/client/backend/vault/client.py +69 -323
  276. agenta/client/backend/vault/raw_client.py +616 -0
  277. agenta/client/backend/workflows/__init__.py +3 -0
  278. agenta/client/backend/workflows/client.py +2398 -0
  279. agenta/client/backend/workflows/raw_client.py +3639 -0
  280. agenta/client/backend/workspace/__init__.py +2 -0
  281. agenta/client/backend/workspace/client.py +46 -147
  282. agenta/client/backend/workspace/raw_client.py +376 -0
  283. agenta/client/types.py +4 -0
  284. agenta/sdk/decorators/tracing.py +2 -4
  285. agenta/sdk/tracing/processors.py +26 -39
  286. agenta/sdk/types.py +28 -1
  287. {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/METADATA +1 -1
  288. agenta-0.48.10.dist-info/RECORD +362 -0
  289. agenta/client/backend/containers/types/__init__.py +0 -5
  290. agenta/client/backend/containers/types/container_templates_response.py +0 -6
  291. agenta/client/backend/types/image.py +0 -25
  292. agenta/client/backend/types/provider_kind.py +0 -21
  293. agenta/client/backend/types/template.py +0 -23
  294. agenta/client/backend/types/template_image_info.py +0 -29
  295. agenta/client/backend/types/variant_action.py +0 -22
  296. agenta-0.48.8.dist-info/RECORD +0 -255
  297. {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1223 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..core.serialization import convert_and_respect_annotation_metadata
13
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
14
+ from ..types.focus import Focus
15
+ from ..types.format import Format
16
+ from ..types.http_validation_error import HttpValidationError
17
+ from ..types.o_tel_flat_span import OTelFlatSpan
18
+ from ..types.o_tel_links_response import OTelLinksResponse
19
+ from ..types.o_tel_spans_tree import OTelSpansTree
20
+ from ..types.o_tel_tracing_response import OTelTracingResponse
21
+ from .types.fetch_trace_request_trace_id import FetchTraceRequestTraceId
22
+ from .types.remove_trace_request_trace_id import RemoveTraceRequestTraceId
23
+
24
+ # this is used as the default value for optional parameters
25
+ OMIT = typing.cast(typing.Any, ...)
26
+
27
+
28
+ class RawTracingClient:
29
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
30
+ self._client_wrapper = client_wrapper
31
+
32
+ def add_trace(
33
+ self,
34
+ *,
35
+ spans: typing.Optional[typing.Sequence[OTelFlatSpan]] = OMIT,
36
+ traces: typing.Optional[
37
+ typing.Dict[str, typing.Optional[OTelSpansTree]]
38
+ ] = OMIT,
39
+ request_options: typing.Optional[RequestOptions] = None,
40
+ ) -> HttpResponse[OTelLinksResponse]:
41
+ """
42
+ Parameters
43
+ ----------
44
+ spans : typing.Optional[typing.Sequence[OTelFlatSpan]]
45
+
46
+ traces : typing.Optional[typing.Dict[str, typing.Optional[OTelSpansTree]]]
47
+
48
+ request_options : typing.Optional[RequestOptions]
49
+ Request-specific configuration.
50
+
51
+ Returns
52
+ -------
53
+ HttpResponse[OTelLinksResponse]
54
+ Successful Response
55
+ """
56
+ _response = self._client_wrapper.httpx_client.request(
57
+ "preview/tracing/traces/",
58
+ method="POST",
59
+ json={
60
+ "spans": convert_and_respect_annotation_metadata(
61
+ object_=spans,
62
+ annotation=typing.Sequence[OTelFlatSpan],
63
+ direction="write",
64
+ ),
65
+ "traces": convert_and_respect_annotation_metadata(
66
+ object_=traces,
67
+ annotation=typing.Dict[str, typing.Optional[OTelSpansTree]],
68
+ direction="write",
69
+ ),
70
+ },
71
+ headers={
72
+ "content-type": "application/json",
73
+ },
74
+ request_options=request_options,
75
+ omit=OMIT,
76
+ )
77
+ try:
78
+ if 200 <= _response.status_code < 300:
79
+ _data = typing.cast(
80
+ OTelLinksResponse,
81
+ parse_obj_as(
82
+ type_=OTelLinksResponse, # type: ignore
83
+ object_=_response.json(),
84
+ ),
85
+ )
86
+ return HttpResponse(response=_response, data=_data)
87
+ if _response.status_code == 422:
88
+ raise UnprocessableEntityError(
89
+ headers=dict(_response.headers),
90
+ body=typing.cast(
91
+ HttpValidationError,
92
+ parse_obj_as(
93
+ type_=HttpValidationError, # type: ignore
94
+ object_=_response.json(),
95
+ ),
96
+ ),
97
+ )
98
+ _response_json = _response.json()
99
+ except JSONDecodeError:
100
+ raise ApiError(
101
+ status_code=_response.status_code,
102
+ headers=dict(_response.headers),
103
+ body=_response.text,
104
+ )
105
+ raise ApiError(
106
+ status_code=_response.status_code,
107
+ headers=dict(_response.headers),
108
+ body=_response_json,
109
+ )
110
+
111
+ def edit_trace(
112
+ self,
113
+ *,
114
+ spans: typing.Optional[typing.Sequence[OTelFlatSpan]] = OMIT,
115
+ traces: typing.Optional[
116
+ typing.Dict[str, typing.Optional[OTelSpansTree]]
117
+ ] = OMIT,
118
+ request_options: typing.Optional[RequestOptions] = None,
119
+ ) -> HttpResponse[OTelLinksResponse]:
120
+ """
121
+ Parameters
122
+ ----------
123
+ spans : typing.Optional[typing.Sequence[OTelFlatSpan]]
124
+
125
+ traces : typing.Optional[typing.Dict[str, typing.Optional[OTelSpansTree]]]
126
+
127
+ request_options : typing.Optional[RequestOptions]
128
+ Request-specific configuration.
129
+
130
+ Returns
131
+ -------
132
+ HttpResponse[OTelLinksResponse]
133
+ Successful Response
134
+ """
135
+ _response = self._client_wrapper.httpx_client.request(
136
+ "preview/tracing/traces/",
137
+ method="PUT",
138
+ json={
139
+ "spans": convert_and_respect_annotation_metadata(
140
+ object_=spans,
141
+ annotation=typing.Sequence[OTelFlatSpan],
142
+ direction="write",
143
+ ),
144
+ "traces": convert_and_respect_annotation_metadata(
145
+ object_=traces,
146
+ annotation=typing.Dict[str, typing.Optional[OTelSpansTree]],
147
+ direction="write",
148
+ ),
149
+ },
150
+ headers={
151
+ "content-type": "application/json",
152
+ },
153
+ request_options=request_options,
154
+ omit=OMIT,
155
+ )
156
+ try:
157
+ if 200 <= _response.status_code < 300:
158
+ _data = typing.cast(
159
+ OTelLinksResponse,
160
+ parse_obj_as(
161
+ type_=OTelLinksResponse, # type: ignore
162
+ object_=_response.json(),
163
+ ),
164
+ )
165
+ return HttpResponse(response=_response, data=_data)
166
+ if _response.status_code == 422:
167
+ raise UnprocessableEntityError(
168
+ headers=dict(_response.headers),
169
+ body=typing.cast(
170
+ HttpValidationError,
171
+ parse_obj_as(
172
+ type_=HttpValidationError, # type: ignore
173
+ object_=_response.json(),
174
+ ),
175
+ ),
176
+ )
177
+ _response_json = _response.json()
178
+ except JSONDecodeError:
179
+ raise ApiError(
180
+ status_code=_response.status_code,
181
+ headers=dict(_response.headers),
182
+ body=_response.text,
183
+ )
184
+ raise ApiError(
185
+ status_code=_response.status_code,
186
+ headers=dict(_response.headers),
187
+ body=_response_json,
188
+ )
189
+
190
+ def fetch_trace(
191
+ self,
192
+ trace_id: FetchTraceRequestTraceId,
193
+ *,
194
+ request_options: typing.Optional[RequestOptions] = None,
195
+ ) -> HttpResponse[OTelTracingResponse]:
196
+ """
197
+ Parameters
198
+ ----------
199
+ trace_id : FetchTraceRequestTraceId
200
+
201
+ request_options : typing.Optional[RequestOptions]
202
+ Request-specific configuration.
203
+
204
+ Returns
205
+ -------
206
+ HttpResponse[OTelTracingResponse]
207
+ Successful Response
208
+ """
209
+ _response = self._client_wrapper.httpx_client.request(
210
+ f"preview/tracing/traces/{jsonable_encoder(trace_id)}",
211
+ method="GET",
212
+ request_options=request_options,
213
+ )
214
+ try:
215
+ if 200 <= _response.status_code < 300:
216
+ _data = typing.cast(
217
+ OTelTracingResponse,
218
+ parse_obj_as(
219
+ type_=OTelTracingResponse, # type: ignore
220
+ object_=_response.json(),
221
+ ),
222
+ )
223
+ return HttpResponse(response=_response, data=_data)
224
+ if _response.status_code == 422:
225
+ raise UnprocessableEntityError(
226
+ headers=dict(_response.headers),
227
+ body=typing.cast(
228
+ HttpValidationError,
229
+ parse_obj_as(
230
+ type_=HttpValidationError, # type: ignore
231
+ object_=_response.json(),
232
+ ),
233
+ ),
234
+ )
235
+ _response_json = _response.json()
236
+ except JSONDecodeError:
237
+ raise ApiError(
238
+ status_code=_response.status_code,
239
+ headers=dict(_response.headers),
240
+ body=_response.text,
241
+ )
242
+ raise ApiError(
243
+ status_code=_response.status_code,
244
+ headers=dict(_response.headers),
245
+ body=_response_json,
246
+ )
247
+
248
+ def remove_trace(
249
+ self,
250
+ trace_id: RemoveTraceRequestTraceId,
251
+ *,
252
+ request_options: typing.Optional[RequestOptions] = None,
253
+ ) -> HttpResponse[OTelLinksResponse]:
254
+ """
255
+ Parameters
256
+ ----------
257
+ trace_id : RemoveTraceRequestTraceId
258
+
259
+ request_options : typing.Optional[RequestOptions]
260
+ Request-specific configuration.
261
+
262
+ Returns
263
+ -------
264
+ HttpResponse[OTelLinksResponse]
265
+ Successful Response
266
+ """
267
+ _response = self._client_wrapper.httpx_client.request(
268
+ f"preview/tracing/traces/{jsonable_encoder(trace_id)}",
269
+ method="DELETE",
270
+ request_options=request_options,
271
+ )
272
+ try:
273
+ if 200 <= _response.status_code < 300:
274
+ _data = typing.cast(
275
+ OTelLinksResponse,
276
+ parse_obj_as(
277
+ type_=OTelLinksResponse, # type: ignore
278
+ object_=_response.json(),
279
+ ),
280
+ )
281
+ return HttpResponse(response=_response, data=_data)
282
+ if _response.status_code == 422:
283
+ raise UnprocessableEntityError(
284
+ headers=dict(_response.headers),
285
+ body=typing.cast(
286
+ HttpValidationError,
287
+ parse_obj_as(
288
+ type_=HttpValidationError, # type: ignore
289
+ object_=_response.json(),
290
+ ),
291
+ ),
292
+ )
293
+ _response_json = _response.json()
294
+ except JSONDecodeError:
295
+ raise ApiError(
296
+ status_code=_response.status_code,
297
+ headers=dict(_response.headers),
298
+ body=_response.text,
299
+ )
300
+ raise ApiError(
301
+ status_code=_response.status_code,
302
+ headers=dict(_response.headers),
303
+ body=_response_json,
304
+ )
305
+
306
+ def query_spans(
307
+ self,
308
+ *,
309
+ filter: str,
310
+ focus: typing.Optional[Focus] = None,
311
+ format: typing.Optional[Format] = None,
312
+ oldest: typing.Optional[str] = None,
313
+ newest: typing.Optional[str] = None,
314
+ limit: typing.Optional[int] = None,
315
+ request_options: typing.Optional[RequestOptions] = None,
316
+ ) -> HttpResponse[OTelTracingResponse]:
317
+ """
318
+ Parameters
319
+ ----------
320
+ filter : str
321
+
322
+ focus : typing.Optional[Focus]
323
+
324
+ format : typing.Optional[Format]
325
+
326
+ oldest : typing.Optional[str]
327
+
328
+ newest : typing.Optional[str]
329
+
330
+ limit : typing.Optional[int]
331
+
332
+ request_options : typing.Optional[RequestOptions]
333
+ Request-specific configuration.
334
+
335
+ Returns
336
+ -------
337
+ HttpResponse[OTelTracingResponse]
338
+ Successful Response
339
+ """
340
+ _response = self._client_wrapper.httpx_client.request(
341
+ "preview/tracing/spans/",
342
+ method="GET",
343
+ params={
344
+ "focus": focus,
345
+ "format": format,
346
+ "oldest": oldest,
347
+ "newest": newest,
348
+ "limit": limit,
349
+ "filter": filter,
350
+ },
351
+ request_options=request_options,
352
+ )
353
+ try:
354
+ if 200 <= _response.status_code < 300:
355
+ _data = typing.cast(
356
+ OTelTracingResponse,
357
+ parse_obj_as(
358
+ type_=OTelTracingResponse, # type: ignore
359
+ object_=_response.json(),
360
+ ),
361
+ )
362
+ return HttpResponse(response=_response, data=_data)
363
+ if _response.status_code == 422:
364
+ raise UnprocessableEntityError(
365
+ headers=dict(_response.headers),
366
+ body=typing.cast(
367
+ HttpValidationError,
368
+ parse_obj_as(
369
+ type_=HttpValidationError, # type: ignore
370
+ object_=_response.json(),
371
+ ),
372
+ ),
373
+ )
374
+ _response_json = _response.json()
375
+ except JSONDecodeError:
376
+ raise ApiError(
377
+ status_code=_response.status_code,
378
+ headers=dict(_response.headers),
379
+ body=_response.text,
380
+ )
381
+ raise ApiError(
382
+ status_code=_response.status_code,
383
+ headers=dict(_response.headers),
384
+ body=_response_json,
385
+ )
386
+
387
+ def ingest_spans(
388
+ self,
389
+ *,
390
+ spans: typing.Optional[typing.Sequence[OTelFlatSpan]] = OMIT,
391
+ traces: typing.Optional[
392
+ typing.Dict[str, typing.Optional[OTelSpansTree]]
393
+ ] = OMIT,
394
+ request_options: typing.Optional[RequestOptions] = None,
395
+ ) -> HttpResponse[OTelLinksResponse]:
396
+ """
397
+ Parameters
398
+ ----------
399
+ spans : typing.Optional[typing.Sequence[OTelFlatSpan]]
400
+
401
+ traces : typing.Optional[typing.Dict[str, typing.Optional[OTelSpansTree]]]
402
+
403
+ request_options : typing.Optional[RequestOptions]
404
+ Request-specific configuration.
405
+
406
+ Returns
407
+ -------
408
+ HttpResponse[OTelLinksResponse]
409
+ Successful Response
410
+ """
411
+ _response = self._client_wrapper.httpx_client.request(
412
+ "preview/tracing/spans/",
413
+ method="POST",
414
+ json={
415
+ "spans": convert_and_respect_annotation_metadata(
416
+ object_=spans,
417
+ annotation=typing.Sequence[OTelFlatSpan],
418
+ direction="write",
419
+ ),
420
+ "traces": convert_and_respect_annotation_metadata(
421
+ object_=traces,
422
+ annotation=typing.Dict[str, typing.Optional[OTelSpansTree]],
423
+ direction="write",
424
+ ),
425
+ },
426
+ headers={
427
+ "content-type": "application/json",
428
+ },
429
+ request_options=request_options,
430
+ omit=OMIT,
431
+ )
432
+ try:
433
+ if 200 <= _response.status_code < 300:
434
+ _data = typing.cast(
435
+ OTelLinksResponse,
436
+ parse_obj_as(
437
+ type_=OTelLinksResponse, # type: ignore
438
+ object_=_response.json(),
439
+ ),
440
+ )
441
+ return HttpResponse(response=_response, data=_data)
442
+ if _response.status_code == 422:
443
+ raise UnprocessableEntityError(
444
+ headers=dict(_response.headers),
445
+ body=typing.cast(
446
+ HttpValidationError,
447
+ parse_obj_as(
448
+ type_=HttpValidationError, # type: ignore
449
+ object_=_response.json(),
450
+ ),
451
+ ),
452
+ )
453
+ _response_json = _response.json()
454
+ except JSONDecodeError:
455
+ raise ApiError(
456
+ status_code=_response.status_code,
457
+ headers=dict(_response.headers),
458
+ body=_response.text,
459
+ )
460
+ raise ApiError(
461
+ status_code=_response.status_code,
462
+ headers=dict(_response.headers),
463
+ body=_response_json,
464
+ )
465
+
466
+ def ingest_spans_rpc(
467
+ self,
468
+ *,
469
+ spans: typing.Optional[typing.Sequence[OTelFlatSpan]] = OMIT,
470
+ traces: typing.Optional[
471
+ typing.Dict[str, typing.Optional[OTelSpansTree]]
472
+ ] = OMIT,
473
+ request_options: typing.Optional[RequestOptions] = None,
474
+ ) -> HttpResponse[OTelLinksResponse]:
475
+ """
476
+ Parameters
477
+ ----------
478
+ spans : typing.Optional[typing.Sequence[OTelFlatSpan]]
479
+
480
+ traces : typing.Optional[typing.Dict[str, typing.Optional[OTelSpansTree]]]
481
+
482
+ request_options : typing.Optional[RequestOptions]
483
+ Request-specific configuration.
484
+
485
+ Returns
486
+ -------
487
+ HttpResponse[OTelLinksResponse]
488
+ Successful Response
489
+ """
490
+ _response = self._client_wrapper.httpx_client.request(
491
+ "preview/tracing/spans/ingest",
492
+ method="POST",
493
+ json={
494
+ "spans": convert_and_respect_annotation_metadata(
495
+ object_=spans,
496
+ annotation=typing.Sequence[OTelFlatSpan],
497
+ direction="write",
498
+ ),
499
+ "traces": convert_and_respect_annotation_metadata(
500
+ object_=traces,
501
+ annotation=typing.Dict[str, typing.Optional[OTelSpansTree]],
502
+ direction="write",
503
+ ),
504
+ },
505
+ headers={
506
+ "content-type": "application/json",
507
+ },
508
+ request_options=request_options,
509
+ omit=OMIT,
510
+ )
511
+ try:
512
+ if 200 <= _response.status_code < 300:
513
+ _data = typing.cast(
514
+ OTelLinksResponse,
515
+ parse_obj_as(
516
+ type_=OTelLinksResponse, # type: ignore
517
+ object_=_response.json(),
518
+ ),
519
+ )
520
+ return HttpResponse(response=_response, data=_data)
521
+ if _response.status_code == 422:
522
+ raise UnprocessableEntityError(
523
+ headers=dict(_response.headers),
524
+ body=typing.cast(
525
+ HttpValidationError,
526
+ parse_obj_as(
527
+ type_=HttpValidationError, # type: ignore
528
+ object_=_response.json(),
529
+ ),
530
+ ),
531
+ )
532
+ _response_json = _response.json()
533
+ except JSONDecodeError:
534
+ raise ApiError(
535
+ status_code=_response.status_code,
536
+ headers=dict(_response.headers),
537
+ body=_response.text,
538
+ )
539
+ raise ApiError(
540
+ status_code=_response.status_code,
541
+ headers=dict(_response.headers),
542
+ body=_response_json,
543
+ )
544
+
545
+ def query_spans_rpc(
546
+ self,
547
+ *,
548
+ filter: str,
549
+ focus: typing.Optional[Focus] = None,
550
+ format: typing.Optional[Format] = None,
551
+ oldest: typing.Optional[str] = None,
552
+ newest: typing.Optional[str] = None,
553
+ limit: typing.Optional[int] = None,
554
+ request_options: typing.Optional[RequestOptions] = None,
555
+ ) -> HttpResponse[OTelTracingResponse]:
556
+ """
557
+ Parameters
558
+ ----------
559
+ filter : str
560
+
561
+ focus : typing.Optional[Focus]
562
+
563
+ format : typing.Optional[Format]
564
+
565
+ oldest : typing.Optional[str]
566
+
567
+ newest : typing.Optional[str]
568
+
569
+ limit : typing.Optional[int]
570
+
571
+ request_options : typing.Optional[RequestOptions]
572
+ Request-specific configuration.
573
+
574
+ Returns
575
+ -------
576
+ HttpResponse[OTelTracingResponse]
577
+ Successful Response
578
+ """
579
+ _response = self._client_wrapper.httpx_client.request(
580
+ "preview/tracing/spans/query",
581
+ method="POST",
582
+ params={
583
+ "focus": focus,
584
+ "format": format,
585
+ "oldest": oldest,
586
+ "newest": newest,
587
+ "limit": limit,
588
+ "filter": filter,
589
+ },
590
+ request_options=request_options,
591
+ )
592
+ try:
593
+ if 200 <= _response.status_code < 300:
594
+ _data = typing.cast(
595
+ OTelTracingResponse,
596
+ parse_obj_as(
597
+ type_=OTelTracingResponse, # type: ignore
598
+ object_=_response.json(),
599
+ ),
600
+ )
601
+ return HttpResponse(response=_response, data=_data)
602
+ if _response.status_code == 422:
603
+ raise UnprocessableEntityError(
604
+ headers=dict(_response.headers),
605
+ body=typing.cast(
606
+ HttpValidationError,
607
+ parse_obj_as(
608
+ type_=HttpValidationError, # type: ignore
609
+ object_=_response.json(),
610
+ ),
611
+ ),
612
+ )
613
+ _response_json = _response.json()
614
+ except JSONDecodeError:
615
+ raise ApiError(
616
+ status_code=_response.status_code,
617
+ headers=dict(_response.headers),
618
+ body=_response.text,
619
+ )
620
+ raise ApiError(
621
+ status_code=_response.status_code,
622
+ headers=dict(_response.headers),
623
+ body=_response_json,
624
+ )
625
+
626
+
627
+ class AsyncRawTracingClient:
628
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
629
+ self._client_wrapper = client_wrapper
630
+
631
+ async def add_trace(
632
+ self,
633
+ *,
634
+ spans: typing.Optional[typing.Sequence[OTelFlatSpan]] = OMIT,
635
+ traces: typing.Optional[
636
+ typing.Dict[str, typing.Optional[OTelSpansTree]]
637
+ ] = OMIT,
638
+ request_options: typing.Optional[RequestOptions] = None,
639
+ ) -> AsyncHttpResponse[OTelLinksResponse]:
640
+ """
641
+ Parameters
642
+ ----------
643
+ spans : typing.Optional[typing.Sequence[OTelFlatSpan]]
644
+
645
+ traces : typing.Optional[typing.Dict[str, typing.Optional[OTelSpansTree]]]
646
+
647
+ request_options : typing.Optional[RequestOptions]
648
+ Request-specific configuration.
649
+
650
+ Returns
651
+ -------
652
+ AsyncHttpResponse[OTelLinksResponse]
653
+ Successful Response
654
+ """
655
+ _response = await self._client_wrapper.httpx_client.request(
656
+ "preview/tracing/traces/",
657
+ method="POST",
658
+ json={
659
+ "spans": convert_and_respect_annotation_metadata(
660
+ object_=spans,
661
+ annotation=typing.Sequence[OTelFlatSpan],
662
+ direction="write",
663
+ ),
664
+ "traces": convert_and_respect_annotation_metadata(
665
+ object_=traces,
666
+ annotation=typing.Dict[str, typing.Optional[OTelSpansTree]],
667
+ direction="write",
668
+ ),
669
+ },
670
+ headers={
671
+ "content-type": "application/json",
672
+ },
673
+ request_options=request_options,
674
+ omit=OMIT,
675
+ )
676
+ try:
677
+ if 200 <= _response.status_code < 300:
678
+ _data = typing.cast(
679
+ OTelLinksResponse,
680
+ parse_obj_as(
681
+ type_=OTelLinksResponse, # type: ignore
682
+ object_=_response.json(),
683
+ ),
684
+ )
685
+ return AsyncHttpResponse(response=_response, data=_data)
686
+ if _response.status_code == 422:
687
+ raise UnprocessableEntityError(
688
+ headers=dict(_response.headers),
689
+ body=typing.cast(
690
+ HttpValidationError,
691
+ parse_obj_as(
692
+ type_=HttpValidationError, # type: ignore
693
+ object_=_response.json(),
694
+ ),
695
+ ),
696
+ )
697
+ _response_json = _response.json()
698
+ except JSONDecodeError:
699
+ raise ApiError(
700
+ status_code=_response.status_code,
701
+ headers=dict(_response.headers),
702
+ body=_response.text,
703
+ )
704
+ raise ApiError(
705
+ status_code=_response.status_code,
706
+ headers=dict(_response.headers),
707
+ body=_response_json,
708
+ )
709
+
710
+ async def edit_trace(
711
+ self,
712
+ *,
713
+ spans: typing.Optional[typing.Sequence[OTelFlatSpan]] = OMIT,
714
+ traces: typing.Optional[
715
+ typing.Dict[str, typing.Optional[OTelSpansTree]]
716
+ ] = OMIT,
717
+ request_options: typing.Optional[RequestOptions] = None,
718
+ ) -> AsyncHttpResponse[OTelLinksResponse]:
719
+ """
720
+ Parameters
721
+ ----------
722
+ spans : typing.Optional[typing.Sequence[OTelFlatSpan]]
723
+
724
+ traces : typing.Optional[typing.Dict[str, typing.Optional[OTelSpansTree]]]
725
+
726
+ request_options : typing.Optional[RequestOptions]
727
+ Request-specific configuration.
728
+
729
+ Returns
730
+ -------
731
+ AsyncHttpResponse[OTelLinksResponse]
732
+ Successful Response
733
+ """
734
+ _response = await self._client_wrapper.httpx_client.request(
735
+ "preview/tracing/traces/",
736
+ method="PUT",
737
+ json={
738
+ "spans": convert_and_respect_annotation_metadata(
739
+ object_=spans,
740
+ annotation=typing.Sequence[OTelFlatSpan],
741
+ direction="write",
742
+ ),
743
+ "traces": convert_and_respect_annotation_metadata(
744
+ object_=traces,
745
+ annotation=typing.Dict[str, typing.Optional[OTelSpansTree]],
746
+ direction="write",
747
+ ),
748
+ },
749
+ headers={
750
+ "content-type": "application/json",
751
+ },
752
+ request_options=request_options,
753
+ omit=OMIT,
754
+ )
755
+ try:
756
+ if 200 <= _response.status_code < 300:
757
+ _data = typing.cast(
758
+ OTelLinksResponse,
759
+ parse_obj_as(
760
+ type_=OTelLinksResponse, # type: ignore
761
+ object_=_response.json(),
762
+ ),
763
+ )
764
+ return AsyncHttpResponse(response=_response, data=_data)
765
+ if _response.status_code == 422:
766
+ raise UnprocessableEntityError(
767
+ headers=dict(_response.headers),
768
+ body=typing.cast(
769
+ HttpValidationError,
770
+ parse_obj_as(
771
+ type_=HttpValidationError, # type: ignore
772
+ object_=_response.json(),
773
+ ),
774
+ ),
775
+ )
776
+ _response_json = _response.json()
777
+ except JSONDecodeError:
778
+ raise ApiError(
779
+ status_code=_response.status_code,
780
+ headers=dict(_response.headers),
781
+ body=_response.text,
782
+ )
783
+ raise ApiError(
784
+ status_code=_response.status_code,
785
+ headers=dict(_response.headers),
786
+ body=_response_json,
787
+ )
788
+
789
+ async def fetch_trace(
790
+ self,
791
+ trace_id: FetchTraceRequestTraceId,
792
+ *,
793
+ request_options: typing.Optional[RequestOptions] = None,
794
+ ) -> AsyncHttpResponse[OTelTracingResponse]:
795
+ """
796
+ Parameters
797
+ ----------
798
+ trace_id : FetchTraceRequestTraceId
799
+
800
+ request_options : typing.Optional[RequestOptions]
801
+ Request-specific configuration.
802
+
803
+ Returns
804
+ -------
805
+ AsyncHttpResponse[OTelTracingResponse]
806
+ Successful Response
807
+ """
808
+ _response = await self._client_wrapper.httpx_client.request(
809
+ f"preview/tracing/traces/{jsonable_encoder(trace_id)}",
810
+ method="GET",
811
+ request_options=request_options,
812
+ )
813
+ try:
814
+ if 200 <= _response.status_code < 300:
815
+ _data = typing.cast(
816
+ OTelTracingResponse,
817
+ parse_obj_as(
818
+ type_=OTelTracingResponse, # type: ignore
819
+ object_=_response.json(),
820
+ ),
821
+ )
822
+ return AsyncHttpResponse(response=_response, data=_data)
823
+ if _response.status_code == 422:
824
+ raise UnprocessableEntityError(
825
+ headers=dict(_response.headers),
826
+ body=typing.cast(
827
+ HttpValidationError,
828
+ parse_obj_as(
829
+ type_=HttpValidationError, # type: ignore
830
+ object_=_response.json(),
831
+ ),
832
+ ),
833
+ )
834
+ _response_json = _response.json()
835
+ except JSONDecodeError:
836
+ raise ApiError(
837
+ status_code=_response.status_code,
838
+ headers=dict(_response.headers),
839
+ body=_response.text,
840
+ )
841
+ raise ApiError(
842
+ status_code=_response.status_code,
843
+ headers=dict(_response.headers),
844
+ body=_response_json,
845
+ )
846
+
847
+ async def remove_trace(
848
+ self,
849
+ trace_id: RemoveTraceRequestTraceId,
850
+ *,
851
+ request_options: typing.Optional[RequestOptions] = None,
852
+ ) -> AsyncHttpResponse[OTelLinksResponse]:
853
+ """
854
+ Parameters
855
+ ----------
856
+ trace_id : RemoveTraceRequestTraceId
857
+
858
+ request_options : typing.Optional[RequestOptions]
859
+ Request-specific configuration.
860
+
861
+ Returns
862
+ -------
863
+ AsyncHttpResponse[OTelLinksResponse]
864
+ Successful Response
865
+ """
866
+ _response = await self._client_wrapper.httpx_client.request(
867
+ f"preview/tracing/traces/{jsonable_encoder(trace_id)}",
868
+ method="DELETE",
869
+ request_options=request_options,
870
+ )
871
+ try:
872
+ if 200 <= _response.status_code < 300:
873
+ _data = typing.cast(
874
+ OTelLinksResponse,
875
+ parse_obj_as(
876
+ type_=OTelLinksResponse, # type: ignore
877
+ object_=_response.json(),
878
+ ),
879
+ )
880
+ return AsyncHttpResponse(response=_response, data=_data)
881
+ if _response.status_code == 422:
882
+ raise UnprocessableEntityError(
883
+ headers=dict(_response.headers),
884
+ body=typing.cast(
885
+ HttpValidationError,
886
+ parse_obj_as(
887
+ type_=HttpValidationError, # type: ignore
888
+ object_=_response.json(),
889
+ ),
890
+ ),
891
+ )
892
+ _response_json = _response.json()
893
+ except JSONDecodeError:
894
+ raise ApiError(
895
+ status_code=_response.status_code,
896
+ headers=dict(_response.headers),
897
+ body=_response.text,
898
+ )
899
+ raise ApiError(
900
+ status_code=_response.status_code,
901
+ headers=dict(_response.headers),
902
+ body=_response_json,
903
+ )
904
+
905
+ async def query_spans(
906
+ self,
907
+ *,
908
+ filter: str,
909
+ focus: typing.Optional[Focus] = None,
910
+ format: typing.Optional[Format] = None,
911
+ oldest: typing.Optional[str] = None,
912
+ newest: typing.Optional[str] = None,
913
+ limit: typing.Optional[int] = None,
914
+ request_options: typing.Optional[RequestOptions] = None,
915
+ ) -> AsyncHttpResponse[OTelTracingResponse]:
916
+ """
917
+ Parameters
918
+ ----------
919
+ filter : str
920
+
921
+ focus : typing.Optional[Focus]
922
+
923
+ format : typing.Optional[Format]
924
+
925
+ oldest : typing.Optional[str]
926
+
927
+ newest : typing.Optional[str]
928
+
929
+ limit : typing.Optional[int]
930
+
931
+ request_options : typing.Optional[RequestOptions]
932
+ Request-specific configuration.
933
+
934
+ Returns
935
+ -------
936
+ AsyncHttpResponse[OTelTracingResponse]
937
+ Successful Response
938
+ """
939
+ _response = await self._client_wrapper.httpx_client.request(
940
+ "preview/tracing/spans/",
941
+ method="GET",
942
+ params={
943
+ "focus": focus,
944
+ "format": format,
945
+ "oldest": oldest,
946
+ "newest": newest,
947
+ "limit": limit,
948
+ "filter": filter,
949
+ },
950
+ request_options=request_options,
951
+ )
952
+ try:
953
+ if 200 <= _response.status_code < 300:
954
+ _data = typing.cast(
955
+ OTelTracingResponse,
956
+ parse_obj_as(
957
+ type_=OTelTracingResponse, # type: ignore
958
+ object_=_response.json(),
959
+ ),
960
+ )
961
+ return AsyncHttpResponse(response=_response, data=_data)
962
+ if _response.status_code == 422:
963
+ raise UnprocessableEntityError(
964
+ headers=dict(_response.headers),
965
+ body=typing.cast(
966
+ HttpValidationError,
967
+ parse_obj_as(
968
+ type_=HttpValidationError, # type: ignore
969
+ object_=_response.json(),
970
+ ),
971
+ ),
972
+ )
973
+ _response_json = _response.json()
974
+ except JSONDecodeError:
975
+ raise ApiError(
976
+ status_code=_response.status_code,
977
+ headers=dict(_response.headers),
978
+ body=_response.text,
979
+ )
980
+ raise ApiError(
981
+ status_code=_response.status_code,
982
+ headers=dict(_response.headers),
983
+ body=_response_json,
984
+ )
985
+
986
+ async def ingest_spans(
987
+ self,
988
+ *,
989
+ spans: typing.Optional[typing.Sequence[OTelFlatSpan]] = OMIT,
990
+ traces: typing.Optional[
991
+ typing.Dict[str, typing.Optional[OTelSpansTree]]
992
+ ] = OMIT,
993
+ request_options: typing.Optional[RequestOptions] = None,
994
+ ) -> AsyncHttpResponse[OTelLinksResponse]:
995
+ """
996
+ Parameters
997
+ ----------
998
+ spans : typing.Optional[typing.Sequence[OTelFlatSpan]]
999
+
1000
+ traces : typing.Optional[typing.Dict[str, typing.Optional[OTelSpansTree]]]
1001
+
1002
+ request_options : typing.Optional[RequestOptions]
1003
+ Request-specific configuration.
1004
+
1005
+ Returns
1006
+ -------
1007
+ AsyncHttpResponse[OTelLinksResponse]
1008
+ Successful Response
1009
+ """
1010
+ _response = await self._client_wrapper.httpx_client.request(
1011
+ "preview/tracing/spans/",
1012
+ method="POST",
1013
+ json={
1014
+ "spans": convert_and_respect_annotation_metadata(
1015
+ object_=spans,
1016
+ annotation=typing.Sequence[OTelFlatSpan],
1017
+ direction="write",
1018
+ ),
1019
+ "traces": convert_and_respect_annotation_metadata(
1020
+ object_=traces,
1021
+ annotation=typing.Dict[str, typing.Optional[OTelSpansTree]],
1022
+ direction="write",
1023
+ ),
1024
+ },
1025
+ headers={
1026
+ "content-type": "application/json",
1027
+ },
1028
+ request_options=request_options,
1029
+ omit=OMIT,
1030
+ )
1031
+ try:
1032
+ if 200 <= _response.status_code < 300:
1033
+ _data = typing.cast(
1034
+ OTelLinksResponse,
1035
+ parse_obj_as(
1036
+ type_=OTelLinksResponse, # type: ignore
1037
+ object_=_response.json(),
1038
+ ),
1039
+ )
1040
+ return AsyncHttpResponse(response=_response, data=_data)
1041
+ if _response.status_code == 422:
1042
+ raise UnprocessableEntityError(
1043
+ headers=dict(_response.headers),
1044
+ body=typing.cast(
1045
+ HttpValidationError,
1046
+ parse_obj_as(
1047
+ type_=HttpValidationError, # type: ignore
1048
+ object_=_response.json(),
1049
+ ),
1050
+ ),
1051
+ )
1052
+ _response_json = _response.json()
1053
+ except JSONDecodeError:
1054
+ raise ApiError(
1055
+ status_code=_response.status_code,
1056
+ headers=dict(_response.headers),
1057
+ body=_response.text,
1058
+ )
1059
+ raise ApiError(
1060
+ status_code=_response.status_code,
1061
+ headers=dict(_response.headers),
1062
+ body=_response_json,
1063
+ )
1064
+
1065
+ async def ingest_spans_rpc(
1066
+ self,
1067
+ *,
1068
+ spans: typing.Optional[typing.Sequence[OTelFlatSpan]] = OMIT,
1069
+ traces: typing.Optional[
1070
+ typing.Dict[str, typing.Optional[OTelSpansTree]]
1071
+ ] = OMIT,
1072
+ request_options: typing.Optional[RequestOptions] = None,
1073
+ ) -> AsyncHttpResponse[OTelLinksResponse]:
1074
+ """
1075
+ Parameters
1076
+ ----------
1077
+ spans : typing.Optional[typing.Sequence[OTelFlatSpan]]
1078
+
1079
+ traces : typing.Optional[typing.Dict[str, typing.Optional[OTelSpansTree]]]
1080
+
1081
+ request_options : typing.Optional[RequestOptions]
1082
+ Request-specific configuration.
1083
+
1084
+ Returns
1085
+ -------
1086
+ AsyncHttpResponse[OTelLinksResponse]
1087
+ Successful Response
1088
+ """
1089
+ _response = await self._client_wrapper.httpx_client.request(
1090
+ "preview/tracing/spans/ingest",
1091
+ method="POST",
1092
+ json={
1093
+ "spans": convert_and_respect_annotation_metadata(
1094
+ object_=spans,
1095
+ annotation=typing.Sequence[OTelFlatSpan],
1096
+ direction="write",
1097
+ ),
1098
+ "traces": convert_and_respect_annotation_metadata(
1099
+ object_=traces,
1100
+ annotation=typing.Dict[str, typing.Optional[OTelSpansTree]],
1101
+ direction="write",
1102
+ ),
1103
+ },
1104
+ headers={
1105
+ "content-type": "application/json",
1106
+ },
1107
+ request_options=request_options,
1108
+ omit=OMIT,
1109
+ )
1110
+ try:
1111
+ if 200 <= _response.status_code < 300:
1112
+ _data = typing.cast(
1113
+ OTelLinksResponse,
1114
+ parse_obj_as(
1115
+ type_=OTelLinksResponse, # type: ignore
1116
+ object_=_response.json(),
1117
+ ),
1118
+ )
1119
+ return AsyncHttpResponse(response=_response, data=_data)
1120
+ if _response.status_code == 422:
1121
+ raise UnprocessableEntityError(
1122
+ headers=dict(_response.headers),
1123
+ body=typing.cast(
1124
+ HttpValidationError,
1125
+ parse_obj_as(
1126
+ type_=HttpValidationError, # type: ignore
1127
+ object_=_response.json(),
1128
+ ),
1129
+ ),
1130
+ )
1131
+ _response_json = _response.json()
1132
+ except JSONDecodeError:
1133
+ raise ApiError(
1134
+ status_code=_response.status_code,
1135
+ headers=dict(_response.headers),
1136
+ body=_response.text,
1137
+ )
1138
+ raise ApiError(
1139
+ status_code=_response.status_code,
1140
+ headers=dict(_response.headers),
1141
+ body=_response_json,
1142
+ )
1143
+
1144
+ async def query_spans_rpc(
1145
+ self,
1146
+ *,
1147
+ filter: str,
1148
+ focus: typing.Optional[Focus] = None,
1149
+ format: typing.Optional[Format] = None,
1150
+ oldest: typing.Optional[str] = None,
1151
+ newest: typing.Optional[str] = None,
1152
+ limit: typing.Optional[int] = None,
1153
+ request_options: typing.Optional[RequestOptions] = None,
1154
+ ) -> AsyncHttpResponse[OTelTracingResponse]:
1155
+ """
1156
+ Parameters
1157
+ ----------
1158
+ filter : str
1159
+
1160
+ focus : typing.Optional[Focus]
1161
+
1162
+ format : typing.Optional[Format]
1163
+
1164
+ oldest : typing.Optional[str]
1165
+
1166
+ newest : typing.Optional[str]
1167
+
1168
+ limit : typing.Optional[int]
1169
+
1170
+ request_options : typing.Optional[RequestOptions]
1171
+ Request-specific configuration.
1172
+
1173
+ Returns
1174
+ -------
1175
+ AsyncHttpResponse[OTelTracingResponse]
1176
+ Successful Response
1177
+ """
1178
+ _response = await self._client_wrapper.httpx_client.request(
1179
+ "preview/tracing/spans/query",
1180
+ method="POST",
1181
+ params={
1182
+ "focus": focus,
1183
+ "format": format,
1184
+ "oldest": oldest,
1185
+ "newest": newest,
1186
+ "limit": limit,
1187
+ "filter": filter,
1188
+ },
1189
+ request_options=request_options,
1190
+ )
1191
+ try:
1192
+ if 200 <= _response.status_code < 300:
1193
+ _data = typing.cast(
1194
+ OTelTracingResponse,
1195
+ parse_obj_as(
1196
+ type_=OTelTracingResponse, # type: ignore
1197
+ object_=_response.json(),
1198
+ ),
1199
+ )
1200
+ return AsyncHttpResponse(response=_response, data=_data)
1201
+ if _response.status_code == 422:
1202
+ raise UnprocessableEntityError(
1203
+ headers=dict(_response.headers),
1204
+ body=typing.cast(
1205
+ HttpValidationError,
1206
+ parse_obj_as(
1207
+ type_=HttpValidationError, # type: ignore
1208
+ object_=_response.json(),
1209
+ ),
1210
+ ),
1211
+ )
1212
+ _response_json = _response.json()
1213
+ except JSONDecodeError:
1214
+ raise ApiError(
1215
+ status_code=_response.status_code,
1216
+ headers=dict(_response.headers),
1217
+ body=_response.text,
1218
+ )
1219
+ raise ApiError(
1220
+ status_code=_response.status_code,
1221
+ headers=dict(_response.headers),
1222
+ body=_response_json,
1223
+ )