aeri-python 4.0.0__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.
- aeri/__init__.py +72 -0
- aeri/_client/_validation.py +204 -0
- aeri/_client/attributes.py +188 -0
- aeri/_client/client.py +3761 -0
- aeri/_client/constants.py +65 -0
- aeri/_client/datasets.py +302 -0
- aeri/_client/environment_variables.py +158 -0
- aeri/_client/get_client.py +149 -0
- aeri/_client/observe.py +661 -0
- aeri/_client/propagation.py +475 -0
- aeri/_client/resource_manager.py +510 -0
- aeri/_client/span.py +1519 -0
- aeri/_client/span_filter.py +76 -0
- aeri/_client/span_processor.py +206 -0
- aeri/_client/utils.py +132 -0
- aeri/_task_manager/media_manager.py +331 -0
- aeri/_task_manager/media_upload_consumer.py +44 -0
- aeri/_task_manager/media_upload_queue.py +12 -0
- aeri/_task_manager/score_ingestion_consumer.py +208 -0
- aeri/_task_manager/task_manager.py +475 -0
- aeri/_utils/__init__.py +19 -0
- aeri/_utils/environment.py +34 -0
- aeri/_utils/error_logging.py +47 -0
- aeri/_utils/parse_error.py +99 -0
- aeri/_utils/prompt_cache.py +188 -0
- aeri/_utils/request.py +137 -0
- aeri/_utils/serializer.py +205 -0
- aeri/api/.fern/metadata.json +14 -0
- aeri/api/__init__.py +836 -0
- aeri/api/annotation_queues/__init__.py +82 -0
- aeri/api/annotation_queues/client.py +1111 -0
- aeri/api/annotation_queues/raw_client.py +2288 -0
- aeri/api/annotation_queues/types/__init__.py +84 -0
- aeri/api/annotation_queues/types/annotation_queue.py +28 -0
- aeri/api/annotation_queues/types/annotation_queue_assignment_request.py +16 -0
- aeri/api/annotation_queues/types/annotation_queue_item.py +34 -0
- aeri/api/annotation_queues/types/annotation_queue_object_type.py +26 -0
- aeri/api/annotation_queues/types/annotation_queue_status.py +22 -0
- aeri/api/annotation_queues/types/create_annotation_queue_assignment_response.py +18 -0
- aeri/api/annotation_queues/types/create_annotation_queue_item_request.py +25 -0
- aeri/api/annotation_queues/types/create_annotation_queue_request.py +20 -0
- aeri/api/annotation_queues/types/delete_annotation_queue_assignment_response.py +14 -0
- aeri/api/annotation_queues/types/delete_annotation_queue_item_response.py +15 -0
- aeri/api/annotation_queues/types/paginated_annotation_queue_items.py +17 -0
- aeri/api/annotation_queues/types/paginated_annotation_queues.py +17 -0
- aeri/api/annotation_queues/types/update_annotation_queue_item_request.py +15 -0
- aeri/api/blob_storage_integrations/__init__.py +73 -0
- aeri/api/blob_storage_integrations/client.py +550 -0
- aeri/api/blob_storage_integrations/raw_client.py +976 -0
- aeri/api/blob_storage_integrations/types/__init__.py +77 -0
- aeri/api/blob_storage_integrations/types/blob_storage_export_frequency.py +26 -0
- aeri/api/blob_storage_integrations/types/blob_storage_export_mode.py +26 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_deletion_response.py +14 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_file_type.py +26 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_response.py +64 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_status_response.py +50 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_type.py +26 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integrations_response.py +15 -0
- aeri/api/blob_storage_integrations/types/blob_storage_sync_status.py +47 -0
- aeri/api/blob_storage_integrations/types/create_blob_storage_integration_request.py +91 -0
- aeri/api/client.py +679 -0
- aeri/api/comments/__init__.py +44 -0
- aeri/api/comments/client.py +407 -0
- aeri/api/comments/raw_client.py +750 -0
- aeri/api/comments/types/__init__.py +46 -0
- aeri/api/comments/types/create_comment_request.py +47 -0
- aeri/api/comments/types/create_comment_response.py +17 -0
- aeri/api/comments/types/get_comments_response.py +17 -0
- aeri/api/commons/__init__.py +210 -0
- aeri/api/commons/errors/__init__.py +56 -0
- aeri/api/commons/errors/access_denied_error.py +12 -0
- aeri/api/commons/errors/error.py +12 -0
- aeri/api/commons/errors/method_not_allowed_error.py +12 -0
- aeri/api/commons/errors/not_found_error.py +12 -0
- aeri/api/commons/errors/unauthorized_error.py +12 -0
- aeri/api/commons/types/__init__.py +190 -0
- aeri/api/commons/types/base_score.py +90 -0
- aeri/api/commons/types/base_score_v1.py +70 -0
- aeri/api/commons/types/boolean_score.py +26 -0
- aeri/api/commons/types/boolean_score_v1.py +26 -0
- aeri/api/commons/types/categorical_score.py +26 -0
- aeri/api/commons/types/categorical_score_v1.py +26 -0
- aeri/api/commons/types/comment.py +36 -0
- aeri/api/commons/types/comment_object_type.py +30 -0
- aeri/api/commons/types/config_category.py +15 -0
- aeri/api/commons/types/correction_score.py +26 -0
- aeri/api/commons/types/create_score_value.py +5 -0
- aeri/api/commons/types/dataset.py +49 -0
- aeri/api/commons/types/dataset_item.py +58 -0
- aeri/api/commons/types/dataset_run.py +63 -0
- aeri/api/commons/types/dataset_run_item.py +40 -0
- aeri/api/commons/types/dataset_run_with_items.py +19 -0
- aeri/api/commons/types/dataset_status.py +22 -0
- aeri/api/commons/types/map_value.py +11 -0
- aeri/api/commons/types/model.py +125 -0
- aeri/api/commons/types/model_price.py +14 -0
- aeri/api/commons/types/model_usage_unit.py +42 -0
- aeri/api/commons/types/numeric_score.py +17 -0
- aeri/api/commons/types/numeric_score_v1.py +17 -0
- aeri/api/commons/types/observation.py +142 -0
- aeri/api/commons/types/observation_level.py +30 -0
- aeri/api/commons/types/observation_v2.py +235 -0
- aeri/api/commons/types/observations_view.py +89 -0
- aeri/api/commons/types/pricing_tier.py +91 -0
- aeri/api/commons/types/pricing_tier_condition.py +68 -0
- aeri/api/commons/types/pricing_tier_input.py +76 -0
- aeri/api/commons/types/pricing_tier_operator.py +42 -0
- aeri/api/commons/types/score.py +201 -0
- aeri/api/commons/types/score_config.py +66 -0
- aeri/api/commons/types/score_config_data_type.py +26 -0
- aeri/api/commons/types/score_data_type.py +30 -0
- aeri/api/commons/types/score_source.py +26 -0
- aeri/api/commons/types/score_v1.py +131 -0
- aeri/api/commons/types/session.py +25 -0
- aeri/api/commons/types/session_with_traces.py +15 -0
- aeri/api/commons/types/trace.py +84 -0
- aeri/api/commons/types/trace_with_details.py +43 -0
- aeri/api/commons/types/trace_with_full_details.py +45 -0
- aeri/api/commons/types/usage.py +59 -0
- aeri/api/core/__init__.py +111 -0
- aeri/api/core/api_error.py +23 -0
- aeri/api/core/client_wrapper.py +141 -0
- aeri/api/core/datetime_utils.py +30 -0
- aeri/api/core/enum.py +20 -0
- aeri/api/core/file.py +70 -0
- aeri/api/core/force_multipart.py +18 -0
- aeri/api/core/http_client.py +711 -0
- aeri/api/core/http_response.py +55 -0
- aeri/api/core/http_sse/__init__.py +48 -0
- aeri/api/core/http_sse/_api.py +114 -0
- aeri/api/core/http_sse/_decoders.py +66 -0
- aeri/api/core/http_sse/_exceptions.py +7 -0
- aeri/api/core/http_sse/_models.py +17 -0
- aeri/api/core/jsonable_encoder.py +102 -0
- aeri/api/core/pydantic_utilities.py +310 -0
- aeri/api/core/query_encoder.py +60 -0
- aeri/api/core/remove_none_from_dict.py +11 -0
- aeri/api/core/request_options.py +35 -0
- aeri/api/core/serialization.py +282 -0
- aeri/api/dataset_items/__init__.py +52 -0
- aeri/api/dataset_items/client.py +499 -0
- aeri/api/dataset_items/raw_client.py +973 -0
- aeri/api/dataset_items/types/__init__.py +50 -0
- aeri/api/dataset_items/types/create_dataset_item_request.py +37 -0
- aeri/api/dataset_items/types/delete_dataset_item_response.py +17 -0
- aeri/api/dataset_items/types/paginated_dataset_items.py +17 -0
- aeri/api/dataset_run_items/__init__.py +43 -0
- aeri/api/dataset_run_items/client.py +323 -0
- aeri/api/dataset_run_items/raw_client.py +547 -0
- aeri/api/dataset_run_items/types/__init__.py +44 -0
- aeri/api/dataset_run_items/types/create_dataset_run_item_request.py +51 -0
- aeri/api/dataset_run_items/types/paginated_dataset_run_items.py +17 -0
- aeri/api/datasets/__init__.py +55 -0
- aeri/api/datasets/client.py +661 -0
- aeri/api/datasets/raw_client.py +1368 -0
- aeri/api/datasets/types/__init__.py +53 -0
- aeri/api/datasets/types/create_dataset_request.py +31 -0
- aeri/api/datasets/types/delete_dataset_run_response.py +14 -0
- aeri/api/datasets/types/paginated_dataset_runs.py +17 -0
- aeri/api/datasets/types/paginated_datasets.py +17 -0
- aeri/api/health/__init__.py +44 -0
- aeri/api/health/client.py +112 -0
- aeri/api/health/errors/__init__.py +42 -0
- aeri/api/health/errors/service_unavailable_error.py +13 -0
- aeri/api/health/raw_client.py +227 -0
- aeri/api/health/types/__init__.py +40 -0
- aeri/api/health/types/health_response.py +30 -0
- aeri/api/ingestion/__init__.py +169 -0
- aeri/api/ingestion/client.py +221 -0
- aeri/api/ingestion/raw_client.py +293 -0
- aeri/api/ingestion/types/__init__.py +169 -0
- aeri/api/ingestion/types/base_event.py +27 -0
- aeri/api/ingestion/types/create_event_body.py +14 -0
- aeri/api/ingestion/types/create_event_event.py +15 -0
- aeri/api/ingestion/types/create_generation_body.py +40 -0
- aeri/api/ingestion/types/create_generation_event.py +15 -0
- aeri/api/ingestion/types/create_observation_event.py +15 -0
- aeri/api/ingestion/types/create_span_body.py +19 -0
- aeri/api/ingestion/types/create_span_event.py +15 -0
- aeri/api/ingestion/types/ingestion_error.py +17 -0
- aeri/api/ingestion/types/ingestion_event.py +155 -0
- aeri/api/ingestion/types/ingestion_response.py +17 -0
- aeri/api/ingestion/types/ingestion_success.py +15 -0
- aeri/api/ingestion/types/ingestion_usage.py +8 -0
- aeri/api/ingestion/types/observation_body.py +53 -0
- aeri/api/ingestion/types/observation_type.py +54 -0
- aeri/api/ingestion/types/open_ai_completion_usage_schema.py +26 -0
- aeri/api/ingestion/types/open_ai_response_usage_schema.py +24 -0
- aeri/api/ingestion/types/open_ai_usage.py +28 -0
- aeri/api/ingestion/types/optional_observation_body.py +36 -0
- aeri/api/ingestion/types/score_body.py +75 -0
- aeri/api/ingestion/types/score_event.py +15 -0
- aeri/api/ingestion/types/sdk_log_body.py +14 -0
- aeri/api/ingestion/types/sdk_log_event.py +15 -0
- aeri/api/ingestion/types/trace_body.py +36 -0
- aeri/api/ingestion/types/trace_event.py +15 -0
- aeri/api/ingestion/types/update_event_body.py +14 -0
- aeri/api/ingestion/types/update_generation_body.py +40 -0
- aeri/api/ingestion/types/update_generation_event.py +15 -0
- aeri/api/ingestion/types/update_observation_event.py +15 -0
- aeri/api/ingestion/types/update_span_body.py +19 -0
- aeri/api/ingestion/types/update_span_event.py +15 -0
- aeri/api/ingestion/types/usage_details.py +10 -0
- aeri/api/legacy/__init__.py +61 -0
- aeri/api/legacy/client.py +105 -0
- aeri/api/legacy/metrics_v1/__init__.py +40 -0
- aeri/api/legacy/metrics_v1/client.py +214 -0
- aeri/api/legacy/metrics_v1/raw_client.py +322 -0
- aeri/api/legacy/metrics_v1/types/__init__.py +40 -0
- aeri/api/legacy/metrics_v1/types/metrics_response.py +19 -0
- aeri/api/legacy/observations_v1/__init__.py +43 -0
- aeri/api/legacy/observations_v1/client.py +523 -0
- aeri/api/legacy/observations_v1/raw_client.py +759 -0
- aeri/api/legacy/observations_v1/types/__init__.py +44 -0
- aeri/api/legacy/observations_v1/types/observations.py +17 -0
- aeri/api/legacy/observations_v1/types/observations_views.py +17 -0
- aeri/api/legacy/raw_client.py +13 -0
- aeri/api/legacy/score_v1/__init__.py +43 -0
- aeri/api/legacy/score_v1/client.py +329 -0
- aeri/api/legacy/score_v1/raw_client.py +545 -0
- aeri/api/legacy/score_v1/types/__init__.py +44 -0
- aeri/api/legacy/score_v1/types/create_score_request.py +75 -0
- aeri/api/legacy/score_v1/types/create_score_response.py +17 -0
- aeri/api/llm_connections/__init__.py +55 -0
- aeri/api/llm_connections/client.py +311 -0
- aeri/api/llm_connections/raw_client.py +541 -0
- aeri/api/llm_connections/types/__init__.py +53 -0
- aeri/api/llm_connections/types/llm_adapter.py +38 -0
- aeri/api/llm_connections/types/llm_connection.py +77 -0
- aeri/api/llm_connections/types/paginated_llm_connections.py +17 -0
- aeri/api/llm_connections/types/upsert_llm_connection_request.py +69 -0
- aeri/api/media/__init__.py +58 -0
- aeri/api/media/client.py +427 -0
- aeri/api/media/raw_client.py +739 -0
- aeri/api/media/types/__init__.py +56 -0
- aeri/api/media/types/get_media_response.py +55 -0
- aeri/api/media/types/get_media_upload_url_request.py +51 -0
- aeri/api/media/types/get_media_upload_url_response.py +28 -0
- aeri/api/media/types/media_content_type.py +232 -0
- aeri/api/media/types/patch_media_body.py +43 -0
- aeri/api/metrics/__init__.py +40 -0
- aeri/api/metrics/client.py +422 -0
- aeri/api/metrics/raw_client.py +530 -0
- aeri/api/metrics/types/__init__.py +40 -0
- aeri/api/metrics/types/metrics_v2response.py +19 -0
- aeri/api/models/__init__.py +43 -0
- aeri/api/models/client.py +523 -0
- aeri/api/models/raw_client.py +993 -0
- aeri/api/models/types/__init__.py +44 -0
- aeri/api/models/types/create_model_request.py +103 -0
- aeri/api/models/types/paginated_models.py +17 -0
- aeri/api/observations/__init__.py +43 -0
- aeri/api/observations/client.py +522 -0
- aeri/api/observations/raw_client.py +641 -0
- aeri/api/observations/types/__init__.py +44 -0
- aeri/api/observations/types/observations_v2meta.py +21 -0
- aeri/api/observations/types/observations_v2response.py +28 -0
- aeri/api/opentelemetry/__init__.py +67 -0
- aeri/api/opentelemetry/client.py +276 -0
- aeri/api/opentelemetry/raw_client.py +291 -0
- aeri/api/opentelemetry/types/__init__.py +65 -0
- aeri/api/opentelemetry/types/otel_attribute.py +27 -0
- aeri/api/opentelemetry/types/otel_attribute_value.py +46 -0
- aeri/api/opentelemetry/types/otel_resource.py +24 -0
- aeri/api/opentelemetry/types/otel_resource_span.py +32 -0
- aeri/api/opentelemetry/types/otel_scope.py +34 -0
- aeri/api/opentelemetry/types/otel_scope_span.py +28 -0
- aeri/api/opentelemetry/types/otel_span.py +76 -0
- aeri/api/opentelemetry/types/otel_trace_response.py +16 -0
- aeri/api/organizations/__init__.py +73 -0
- aeri/api/organizations/client.py +756 -0
- aeri/api/organizations/raw_client.py +1707 -0
- aeri/api/organizations/types/__init__.py +71 -0
- aeri/api/organizations/types/delete_membership_request.py +16 -0
- aeri/api/organizations/types/membership_deletion_response.py +17 -0
- aeri/api/organizations/types/membership_request.py +18 -0
- aeri/api/organizations/types/membership_response.py +20 -0
- aeri/api/organizations/types/membership_role.py +30 -0
- aeri/api/organizations/types/memberships_response.py +15 -0
- aeri/api/organizations/types/organization_api_key.py +31 -0
- aeri/api/organizations/types/organization_api_keys_response.py +19 -0
- aeri/api/organizations/types/organization_project.py +25 -0
- aeri/api/organizations/types/organization_projects_response.py +15 -0
- aeri/api/projects/__init__.py +67 -0
- aeri/api/projects/client.py +760 -0
- aeri/api/projects/raw_client.py +1577 -0
- aeri/api/projects/types/__init__.py +65 -0
- aeri/api/projects/types/api_key_deletion_response.py +18 -0
- aeri/api/projects/types/api_key_list.py +23 -0
- aeri/api/projects/types/api_key_response.py +30 -0
- aeri/api/projects/types/api_key_summary.py +35 -0
- aeri/api/projects/types/organization.py +22 -0
- aeri/api/projects/types/project.py +34 -0
- aeri/api/projects/types/project_deletion_response.py +15 -0
- aeri/api/projects/types/projects.py +15 -0
- aeri/api/prompt_version/__init__.py +4 -0
- aeri/api/prompt_version/client.py +157 -0
- aeri/api/prompt_version/raw_client.py +264 -0
- aeri/api/prompts/__init__.py +100 -0
- aeri/api/prompts/client.py +550 -0
- aeri/api/prompts/raw_client.py +987 -0
- aeri/api/prompts/types/__init__.py +96 -0
- aeri/api/prompts/types/base_prompt.py +42 -0
- aeri/api/prompts/types/chat_message.py +17 -0
- aeri/api/prompts/types/chat_message_type.py +15 -0
- aeri/api/prompts/types/chat_message_with_placeholders.py +8 -0
- aeri/api/prompts/types/chat_prompt.py +15 -0
- aeri/api/prompts/types/create_chat_prompt_request.py +37 -0
- aeri/api/prompts/types/create_chat_prompt_type.py +15 -0
- aeri/api/prompts/types/create_prompt_request.py +8 -0
- aeri/api/prompts/types/create_text_prompt_request.py +36 -0
- aeri/api/prompts/types/create_text_prompt_type.py +15 -0
- aeri/api/prompts/types/placeholder_message.py +16 -0
- aeri/api/prompts/types/placeholder_message_type.py +15 -0
- aeri/api/prompts/types/prompt.py +58 -0
- aeri/api/prompts/types/prompt_meta.py +35 -0
- aeri/api/prompts/types/prompt_meta_list_response.py +17 -0
- aeri/api/prompts/types/prompt_type.py +20 -0
- aeri/api/prompts/types/text_prompt.py +14 -0
- aeri/api/scim/__init__.py +94 -0
- aeri/api/scim/client.py +686 -0
- aeri/api/scim/raw_client.py +1528 -0
- aeri/api/scim/types/__init__.py +92 -0
- aeri/api/scim/types/authentication_scheme.py +20 -0
- aeri/api/scim/types/bulk_config.py +22 -0
- aeri/api/scim/types/empty_response.py +16 -0
- aeri/api/scim/types/filter_config.py +17 -0
- aeri/api/scim/types/resource_meta.py +17 -0
- aeri/api/scim/types/resource_type.py +27 -0
- aeri/api/scim/types/resource_types_response.py +21 -0
- aeri/api/scim/types/schema_extension.py +17 -0
- aeri/api/scim/types/schema_resource.py +19 -0
- aeri/api/scim/types/schemas_response.py +21 -0
- aeri/api/scim/types/scim_email.py +16 -0
- aeri/api/scim/types/scim_feature_support.py +14 -0
- aeri/api/scim/types/scim_name.py +14 -0
- aeri/api/scim/types/scim_user.py +24 -0
- aeri/api/scim/types/scim_users_list_response.py +25 -0
- aeri/api/scim/types/service_provider_config.py +36 -0
- aeri/api/scim/types/user_meta.py +20 -0
- aeri/api/score_configs/__init__.py +44 -0
- aeri/api/score_configs/client.py +526 -0
- aeri/api/score_configs/raw_client.py +1012 -0
- aeri/api/score_configs/types/__init__.py +46 -0
- aeri/api/score_configs/types/create_score_config_request.py +46 -0
- aeri/api/score_configs/types/score_configs.py +17 -0
- aeri/api/score_configs/types/update_score_config_request.py +53 -0
- aeri/api/scores/__init__.py +76 -0
- aeri/api/scores/client.py +420 -0
- aeri/api/scores/raw_client.py +656 -0
- aeri/api/scores/types/__init__.py +76 -0
- aeri/api/scores/types/get_scores_response.py +17 -0
- aeri/api/scores/types/get_scores_response_data.py +211 -0
- aeri/api/scores/types/get_scores_response_data_boolean.py +15 -0
- aeri/api/scores/types/get_scores_response_data_categorical.py +15 -0
- aeri/api/scores/types/get_scores_response_data_correction.py +15 -0
- aeri/api/scores/types/get_scores_response_data_numeric.py +15 -0
- aeri/api/scores/types/get_scores_response_trace_data.py +38 -0
- aeri/api/sessions/__init__.py +40 -0
- aeri/api/sessions/client.py +262 -0
- aeri/api/sessions/raw_client.py +500 -0
- aeri/api/sessions/types/__init__.py +40 -0
- aeri/api/sessions/types/paginated_sessions.py +17 -0
- aeri/api/trace/__init__.py +44 -0
- aeri/api/trace/client.py +728 -0
- aeri/api/trace/raw_client.py +1208 -0
- aeri/api/trace/types/__init__.py +46 -0
- aeri/api/trace/types/delete_trace_response.py +14 -0
- aeri/api/trace/types/sort.py +14 -0
- aeri/api/trace/types/traces.py +17 -0
- aeri/api/utils/__init__.py +44 -0
- aeri/api/utils/pagination/__init__.py +40 -0
- aeri/api/utils/pagination/types/__init__.py +40 -0
- aeri/api/utils/pagination/types/meta_response.py +38 -0
- aeri/batch_evaluation.py +1643 -0
- aeri/experiment.py +1044 -0
- aeri/langchain/CallbackHandler.py +1377 -0
- aeri/langchain/__init__.py +5 -0
- aeri/langchain/utils.py +212 -0
- aeri/logger.py +28 -0
- aeri/media.py +352 -0
- aeri/model.py +477 -0
- aeri/openai.py +1124 -0
- aeri/py.typed +0 -0
- aeri/span_filter.py +17 -0
- aeri/types.py +79 -0
- aeri/version.py +3 -0
- aeri_python-4.0.0.dist-info/METADATA +51 -0
- aeri_python-4.0.0.dist-info/RECORD +391 -0
- aeri_python-4.0.0.dist-info/WHEEL +4 -0
- aeri_python-4.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .types import (
|
|
10
|
+
BaseEvent,
|
|
11
|
+
CreateEventBody,
|
|
12
|
+
CreateEventEvent,
|
|
13
|
+
CreateGenerationBody,
|
|
14
|
+
CreateGenerationEvent,
|
|
15
|
+
CreateObservationEvent,
|
|
16
|
+
CreateSpanBody,
|
|
17
|
+
CreateSpanEvent,
|
|
18
|
+
IngestionError,
|
|
19
|
+
IngestionEvent,
|
|
20
|
+
IngestionEvent_EventCreate,
|
|
21
|
+
IngestionEvent_GenerationCreate,
|
|
22
|
+
IngestionEvent_GenerationUpdate,
|
|
23
|
+
IngestionEvent_ObservationCreate,
|
|
24
|
+
IngestionEvent_ObservationUpdate,
|
|
25
|
+
IngestionEvent_ScoreCreate,
|
|
26
|
+
IngestionEvent_SdkLog,
|
|
27
|
+
IngestionEvent_SpanCreate,
|
|
28
|
+
IngestionEvent_SpanUpdate,
|
|
29
|
+
IngestionEvent_TraceCreate,
|
|
30
|
+
IngestionResponse,
|
|
31
|
+
IngestionSuccess,
|
|
32
|
+
IngestionUsage,
|
|
33
|
+
ObservationBody,
|
|
34
|
+
ObservationType,
|
|
35
|
+
OpenAiCompletionUsageSchema,
|
|
36
|
+
OpenAiResponseUsageSchema,
|
|
37
|
+
OpenAiUsage,
|
|
38
|
+
OptionalObservationBody,
|
|
39
|
+
ScoreBody,
|
|
40
|
+
ScoreEvent,
|
|
41
|
+
SdkLogBody,
|
|
42
|
+
SdkLogEvent,
|
|
43
|
+
TraceBody,
|
|
44
|
+
TraceEvent,
|
|
45
|
+
UpdateEventBody,
|
|
46
|
+
UpdateGenerationBody,
|
|
47
|
+
UpdateGenerationEvent,
|
|
48
|
+
UpdateObservationEvent,
|
|
49
|
+
UpdateSpanBody,
|
|
50
|
+
UpdateSpanEvent,
|
|
51
|
+
UsageDetails,
|
|
52
|
+
)
|
|
53
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
54
|
+
"BaseEvent": ".types",
|
|
55
|
+
"CreateEventBody": ".types",
|
|
56
|
+
"CreateEventEvent": ".types",
|
|
57
|
+
"CreateGenerationBody": ".types",
|
|
58
|
+
"CreateGenerationEvent": ".types",
|
|
59
|
+
"CreateObservationEvent": ".types",
|
|
60
|
+
"CreateSpanBody": ".types",
|
|
61
|
+
"CreateSpanEvent": ".types",
|
|
62
|
+
"IngestionError": ".types",
|
|
63
|
+
"IngestionEvent": ".types",
|
|
64
|
+
"IngestionEvent_EventCreate": ".types",
|
|
65
|
+
"IngestionEvent_GenerationCreate": ".types",
|
|
66
|
+
"IngestionEvent_GenerationUpdate": ".types",
|
|
67
|
+
"IngestionEvent_ObservationCreate": ".types",
|
|
68
|
+
"IngestionEvent_ObservationUpdate": ".types",
|
|
69
|
+
"IngestionEvent_ScoreCreate": ".types",
|
|
70
|
+
"IngestionEvent_SdkLog": ".types",
|
|
71
|
+
"IngestionEvent_SpanCreate": ".types",
|
|
72
|
+
"IngestionEvent_SpanUpdate": ".types",
|
|
73
|
+
"IngestionEvent_TraceCreate": ".types",
|
|
74
|
+
"IngestionResponse": ".types",
|
|
75
|
+
"IngestionSuccess": ".types",
|
|
76
|
+
"IngestionUsage": ".types",
|
|
77
|
+
"ObservationBody": ".types",
|
|
78
|
+
"ObservationType": ".types",
|
|
79
|
+
"OpenAiCompletionUsageSchema": ".types",
|
|
80
|
+
"OpenAiResponseUsageSchema": ".types",
|
|
81
|
+
"OpenAiUsage": ".types",
|
|
82
|
+
"OptionalObservationBody": ".types",
|
|
83
|
+
"ScoreBody": ".types",
|
|
84
|
+
"ScoreEvent": ".types",
|
|
85
|
+
"SdkLogBody": ".types",
|
|
86
|
+
"SdkLogEvent": ".types",
|
|
87
|
+
"TraceBody": ".types",
|
|
88
|
+
"TraceEvent": ".types",
|
|
89
|
+
"UpdateEventBody": ".types",
|
|
90
|
+
"UpdateGenerationBody": ".types",
|
|
91
|
+
"UpdateGenerationEvent": ".types",
|
|
92
|
+
"UpdateObservationEvent": ".types",
|
|
93
|
+
"UpdateSpanBody": ".types",
|
|
94
|
+
"UpdateSpanEvent": ".types",
|
|
95
|
+
"UsageDetails": ".types",
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
100
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
101
|
+
if module_name is None:
|
|
102
|
+
raise AttributeError(
|
|
103
|
+
f"No {attr_name} found in _dynamic_imports for module name -> {__name__}"
|
|
104
|
+
)
|
|
105
|
+
try:
|
|
106
|
+
module = import_module(module_name, __package__)
|
|
107
|
+
if module_name == f".{attr_name}":
|
|
108
|
+
return module
|
|
109
|
+
else:
|
|
110
|
+
return getattr(module, attr_name)
|
|
111
|
+
except ImportError as e:
|
|
112
|
+
raise ImportError(
|
|
113
|
+
f"Failed to import {attr_name} from {module_name}: {e}"
|
|
114
|
+
) from e
|
|
115
|
+
except AttributeError as e:
|
|
116
|
+
raise AttributeError(
|
|
117
|
+
f"Failed to get {attr_name} from {module_name}: {e}"
|
|
118
|
+
) from e
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def __dir__():
|
|
122
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
123
|
+
return sorted(lazy_attrs)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
__all__ = [
|
|
127
|
+
"BaseEvent",
|
|
128
|
+
"CreateEventBody",
|
|
129
|
+
"CreateEventEvent",
|
|
130
|
+
"CreateGenerationBody",
|
|
131
|
+
"CreateGenerationEvent",
|
|
132
|
+
"CreateObservationEvent",
|
|
133
|
+
"CreateSpanBody",
|
|
134
|
+
"CreateSpanEvent",
|
|
135
|
+
"IngestionError",
|
|
136
|
+
"IngestionEvent",
|
|
137
|
+
"IngestionEvent_EventCreate",
|
|
138
|
+
"IngestionEvent_GenerationCreate",
|
|
139
|
+
"IngestionEvent_GenerationUpdate",
|
|
140
|
+
"IngestionEvent_ObservationCreate",
|
|
141
|
+
"IngestionEvent_ObservationUpdate",
|
|
142
|
+
"IngestionEvent_ScoreCreate",
|
|
143
|
+
"IngestionEvent_SdkLog",
|
|
144
|
+
"IngestionEvent_SpanCreate",
|
|
145
|
+
"IngestionEvent_SpanUpdate",
|
|
146
|
+
"IngestionEvent_TraceCreate",
|
|
147
|
+
"IngestionResponse",
|
|
148
|
+
"IngestionSuccess",
|
|
149
|
+
"IngestionUsage",
|
|
150
|
+
"ObservationBody",
|
|
151
|
+
"ObservationType",
|
|
152
|
+
"OpenAiCompletionUsageSchema",
|
|
153
|
+
"OpenAiResponseUsageSchema",
|
|
154
|
+
"OpenAiUsage",
|
|
155
|
+
"OptionalObservationBody",
|
|
156
|
+
"ScoreBody",
|
|
157
|
+
"ScoreEvent",
|
|
158
|
+
"SdkLogBody",
|
|
159
|
+
"SdkLogEvent",
|
|
160
|
+
"TraceBody",
|
|
161
|
+
"TraceEvent",
|
|
162
|
+
"UpdateEventBody",
|
|
163
|
+
"UpdateGenerationBody",
|
|
164
|
+
"UpdateGenerationEvent",
|
|
165
|
+
"UpdateObservationEvent",
|
|
166
|
+
"UpdateSpanBody",
|
|
167
|
+
"UpdateSpanEvent",
|
|
168
|
+
"UsageDetails",
|
|
169
|
+
]
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from .raw_client import AsyncRawIngestionClient, RawIngestionClient
|
|
8
|
+
from .types.ingestion_event import IngestionEvent
|
|
9
|
+
from .types.ingestion_response import IngestionResponse
|
|
10
|
+
|
|
11
|
+
# this is used as the default value for optional parameters
|
|
12
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class IngestionClient:
|
|
16
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
17
|
+
self._raw_client = RawIngestionClient(client_wrapper=client_wrapper)
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def with_raw_response(self) -> RawIngestionClient:
|
|
21
|
+
"""
|
|
22
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
23
|
+
|
|
24
|
+
Returns
|
|
25
|
+
-------
|
|
26
|
+
RawIngestionClient
|
|
27
|
+
"""
|
|
28
|
+
return self._raw_client
|
|
29
|
+
|
|
30
|
+
def batch(
|
|
31
|
+
self,
|
|
32
|
+
*,
|
|
33
|
+
batch: typing.Sequence[IngestionEvent],
|
|
34
|
+
metadata: typing.Optional[typing.Any] = OMIT,
|
|
35
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
+
) -> IngestionResponse:
|
|
37
|
+
"""
|
|
38
|
+
**Legacy endpoint for batch ingestion for Aeri Observability.**
|
|
39
|
+
|
|
40
|
+
-> Please use the OpenTelemetry endpoint (`/api/public/otel/v1/traces`). Learn more: https://aeri.com/integrations/native/opentelemetry
|
|
41
|
+
|
|
42
|
+
Within each batch, there can be multiple events.
|
|
43
|
+
Each event has a type, an id, a timestamp, metadata and a body.
|
|
44
|
+
Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace.
|
|
45
|
+
We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request.
|
|
46
|
+
The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Aeri App.
|
|
47
|
+
I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.
|
|
48
|
+
|
|
49
|
+
Notes:
|
|
50
|
+
- Introduction to data model: https://aeri.com/docs/observability/data-model
|
|
51
|
+
- Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
|
|
52
|
+
- The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
|
|
53
|
+
|
|
54
|
+
Parameters
|
|
55
|
+
----------
|
|
56
|
+
batch : typing.Sequence[IngestionEvent]
|
|
57
|
+
Batch of tracing events to be ingested. Discriminated by attribute `type`.
|
|
58
|
+
|
|
59
|
+
metadata : typing.Optional[typing.Any]
|
|
60
|
+
Optional. Metadata field used by the Aeri SDKs for debugging.
|
|
61
|
+
|
|
62
|
+
request_options : typing.Optional[RequestOptions]
|
|
63
|
+
Request-specific configuration.
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
IngestionResponse
|
|
68
|
+
|
|
69
|
+
Examples
|
|
70
|
+
--------
|
|
71
|
+
import datetime
|
|
72
|
+
|
|
73
|
+
from aeri import AeriAPI
|
|
74
|
+
from aeri.ingestion import IngestionEvent_TraceCreate, TraceBody
|
|
75
|
+
|
|
76
|
+
client = AeriAPI(
|
|
77
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
78
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
79
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
80
|
+
username="YOUR_USERNAME",
|
|
81
|
+
password="YOUR_PASSWORD",
|
|
82
|
+
base_url="https://yourhost.com/path/to/api",
|
|
83
|
+
)
|
|
84
|
+
client.ingestion.batch(
|
|
85
|
+
batch=[
|
|
86
|
+
IngestionEvent_TraceCreate(
|
|
87
|
+
id="abcdef-1234-5678-90ab",
|
|
88
|
+
timestamp="2022-01-01T00:00:00.000Z",
|
|
89
|
+
body=TraceBody(
|
|
90
|
+
id="abcdef-1234-5678-90ab",
|
|
91
|
+
timestamp=datetime.datetime.fromisoformat(
|
|
92
|
+
"2022-01-01 00:00:00+00:00",
|
|
93
|
+
),
|
|
94
|
+
environment="production",
|
|
95
|
+
name="My Trace",
|
|
96
|
+
user_id="1234-5678-90ab-cdef",
|
|
97
|
+
input="My input",
|
|
98
|
+
output="My output",
|
|
99
|
+
session_id="1234-5678-90ab-cdef",
|
|
100
|
+
release="1.0.0",
|
|
101
|
+
version="1.0.0",
|
|
102
|
+
metadata="My metadata",
|
|
103
|
+
tags=["tag1", "tag2"],
|
|
104
|
+
public=True,
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
],
|
|
108
|
+
)
|
|
109
|
+
"""
|
|
110
|
+
_response = self._raw_client.batch(
|
|
111
|
+
batch=batch, metadata=metadata, request_options=request_options
|
|
112
|
+
)
|
|
113
|
+
return _response.data
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class AsyncIngestionClient:
|
|
117
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
118
|
+
self._raw_client = AsyncRawIngestionClient(client_wrapper=client_wrapper)
|
|
119
|
+
|
|
120
|
+
@property
|
|
121
|
+
def with_raw_response(self) -> AsyncRawIngestionClient:
|
|
122
|
+
"""
|
|
123
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
124
|
+
|
|
125
|
+
Returns
|
|
126
|
+
-------
|
|
127
|
+
AsyncRawIngestionClient
|
|
128
|
+
"""
|
|
129
|
+
return self._raw_client
|
|
130
|
+
|
|
131
|
+
async def batch(
|
|
132
|
+
self,
|
|
133
|
+
*,
|
|
134
|
+
batch: typing.Sequence[IngestionEvent],
|
|
135
|
+
metadata: typing.Optional[typing.Any] = OMIT,
|
|
136
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
137
|
+
) -> IngestionResponse:
|
|
138
|
+
"""
|
|
139
|
+
**Legacy endpoint for batch ingestion for Aeri Observability.**
|
|
140
|
+
|
|
141
|
+
-> Please use the OpenTelemetry endpoint (`/api/public/otel/v1/traces`). Learn more: https://aeri.com/integrations/native/opentelemetry
|
|
142
|
+
|
|
143
|
+
Within each batch, there can be multiple events.
|
|
144
|
+
Each event has a type, an id, a timestamp, metadata and a body.
|
|
145
|
+
Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace.
|
|
146
|
+
We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request.
|
|
147
|
+
The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Aeri App.
|
|
148
|
+
I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.
|
|
149
|
+
|
|
150
|
+
Notes:
|
|
151
|
+
- Introduction to data model: https://aeri.com/docs/observability/data-model
|
|
152
|
+
- Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
|
|
153
|
+
- The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
|
|
154
|
+
|
|
155
|
+
Parameters
|
|
156
|
+
----------
|
|
157
|
+
batch : typing.Sequence[IngestionEvent]
|
|
158
|
+
Batch of tracing events to be ingested. Discriminated by attribute `type`.
|
|
159
|
+
|
|
160
|
+
metadata : typing.Optional[typing.Any]
|
|
161
|
+
Optional. Metadata field used by the Aeri SDKs for debugging.
|
|
162
|
+
|
|
163
|
+
request_options : typing.Optional[RequestOptions]
|
|
164
|
+
Request-specific configuration.
|
|
165
|
+
|
|
166
|
+
Returns
|
|
167
|
+
-------
|
|
168
|
+
IngestionResponse
|
|
169
|
+
|
|
170
|
+
Examples
|
|
171
|
+
--------
|
|
172
|
+
import asyncio
|
|
173
|
+
import datetime
|
|
174
|
+
|
|
175
|
+
from aeri import AsyncAeriAPI
|
|
176
|
+
from aeri.ingestion import IngestionEvent_TraceCreate, TraceBody
|
|
177
|
+
|
|
178
|
+
client = AsyncAeriAPI(
|
|
179
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
180
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
181
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
182
|
+
username="YOUR_USERNAME",
|
|
183
|
+
password="YOUR_PASSWORD",
|
|
184
|
+
base_url="https://yourhost.com/path/to/api",
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
async def main() -> None:
|
|
189
|
+
await client.ingestion.batch(
|
|
190
|
+
batch=[
|
|
191
|
+
IngestionEvent_TraceCreate(
|
|
192
|
+
id="abcdef-1234-5678-90ab",
|
|
193
|
+
timestamp="2022-01-01T00:00:00.000Z",
|
|
194
|
+
body=TraceBody(
|
|
195
|
+
id="abcdef-1234-5678-90ab",
|
|
196
|
+
timestamp=datetime.datetime.fromisoformat(
|
|
197
|
+
"2022-01-01 00:00:00+00:00",
|
|
198
|
+
),
|
|
199
|
+
environment="production",
|
|
200
|
+
name="My Trace",
|
|
201
|
+
user_id="1234-5678-90ab-cdef",
|
|
202
|
+
input="My input",
|
|
203
|
+
output="My output",
|
|
204
|
+
session_id="1234-5678-90ab-cdef",
|
|
205
|
+
release="1.0.0",
|
|
206
|
+
version="1.0.0",
|
|
207
|
+
metadata="My metadata",
|
|
208
|
+
tags=["tag1", "tag2"],
|
|
209
|
+
public=True,
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
],
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
asyncio.run(main())
|
|
217
|
+
"""
|
|
218
|
+
_response = await self._raw_client.batch(
|
|
219
|
+
batch=batch, metadata=metadata, request_options=request_options
|
|
220
|
+
)
|
|
221
|
+
return _response.data
|
|
@@ -0,0 +1,293 @@
|
|
|
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 ..commons.errors.access_denied_error import AccessDeniedError
|
|
7
|
+
from ..commons.errors.error import Error
|
|
8
|
+
from ..commons.errors.method_not_allowed_error import MethodNotAllowedError
|
|
9
|
+
from ..commons.errors.not_found_error import NotFoundError
|
|
10
|
+
from ..commons.errors.unauthorized_error import UnauthorizedError
|
|
11
|
+
from ..core.api_error import ApiError
|
|
12
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
13
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
14
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
15
|
+
from ..core.request_options import RequestOptions
|
|
16
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
17
|
+
from .types.ingestion_event import IngestionEvent
|
|
18
|
+
from .types.ingestion_response import IngestionResponse
|
|
19
|
+
|
|
20
|
+
# this is used as the default value for optional parameters
|
|
21
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class RawIngestionClient:
|
|
25
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
|
+
self._client_wrapper = client_wrapper
|
|
27
|
+
|
|
28
|
+
def batch(
|
|
29
|
+
self,
|
|
30
|
+
*,
|
|
31
|
+
batch: typing.Sequence[IngestionEvent],
|
|
32
|
+
metadata: typing.Optional[typing.Any] = OMIT,
|
|
33
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
34
|
+
) -> HttpResponse[IngestionResponse]:
|
|
35
|
+
"""
|
|
36
|
+
**Legacy endpoint for batch ingestion for Aeri Observability.**
|
|
37
|
+
|
|
38
|
+
-> Please use the OpenTelemetry endpoint (`/api/public/otel/v1/traces`). Learn more: https://aeri.com/integrations/native/opentelemetry
|
|
39
|
+
|
|
40
|
+
Within each batch, there can be multiple events.
|
|
41
|
+
Each event has a type, an id, a timestamp, metadata and a body.
|
|
42
|
+
Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace.
|
|
43
|
+
We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request.
|
|
44
|
+
The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Aeri App.
|
|
45
|
+
I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.
|
|
46
|
+
|
|
47
|
+
Notes:
|
|
48
|
+
- Introduction to data model: https://aeri.com/docs/observability/data-model
|
|
49
|
+
- Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
|
|
50
|
+
- The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
|
|
51
|
+
|
|
52
|
+
Parameters
|
|
53
|
+
----------
|
|
54
|
+
batch : typing.Sequence[IngestionEvent]
|
|
55
|
+
Batch of tracing events to be ingested. Discriminated by attribute `type`.
|
|
56
|
+
|
|
57
|
+
metadata : typing.Optional[typing.Any]
|
|
58
|
+
Optional. Metadata field used by the Aeri SDKs for debugging.
|
|
59
|
+
|
|
60
|
+
request_options : typing.Optional[RequestOptions]
|
|
61
|
+
Request-specific configuration.
|
|
62
|
+
|
|
63
|
+
Returns
|
|
64
|
+
-------
|
|
65
|
+
HttpResponse[IngestionResponse]
|
|
66
|
+
"""
|
|
67
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
68
|
+
"api/public/ingestion",
|
|
69
|
+
method="POST",
|
|
70
|
+
json={
|
|
71
|
+
"batch": convert_and_respect_annotation_metadata(
|
|
72
|
+
object_=batch,
|
|
73
|
+
annotation=typing.Sequence[IngestionEvent],
|
|
74
|
+
direction="write",
|
|
75
|
+
),
|
|
76
|
+
"metadata": metadata,
|
|
77
|
+
},
|
|
78
|
+
request_options=request_options,
|
|
79
|
+
omit=OMIT,
|
|
80
|
+
)
|
|
81
|
+
try:
|
|
82
|
+
if 200 <= _response.status_code < 300:
|
|
83
|
+
_data = typing.cast(
|
|
84
|
+
IngestionResponse,
|
|
85
|
+
parse_obj_as(
|
|
86
|
+
type_=IngestionResponse, # type: ignore
|
|
87
|
+
object_=_response.json(),
|
|
88
|
+
),
|
|
89
|
+
)
|
|
90
|
+
return HttpResponse(response=_response, data=_data)
|
|
91
|
+
if _response.status_code == 400:
|
|
92
|
+
raise Error(
|
|
93
|
+
headers=dict(_response.headers),
|
|
94
|
+
body=typing.cast(
|
|
95
|
+
typing.Any,
|
|
96
|
+
parse_obj_as(
|
|
97
|
+
type_=typing.Any, # type: ignore
|
|
98
|
+
object_=_response.json(),
|
|
99
|
+
),
|
|
100
|
+
),
|
|
101
|
+
)
|
|
102
|
+
if _response.status_code == 401:
|
|
103
|
+
raise UnauthorizedError(
|
|
104
|
+
headers=dict(_response.headers),
|
|
105
|
+
body=typing.cast(
|
|
106
|
+
typing.Any,
|
|
107
|
+
parse_obj_as(
|
|
108
|
+
type_=typing.Any, # type: ignore
|
|
109
|
+
object_=_response.json(),
|
|
110
|
+
),
|
|
111
|
+
),
|
|
112
|
+
)
|
|
113
|
+
if _response.status_code == 403:
|
|
114
|
+
raise AccessDeniedError(
|
|
115
|
+
headers=dict(_response.headers),
|
|
116
|
+
body=typing.cast(
|
|
117
|
+
typing.Any,
|
|
118
|
+
parse_obj_as(
|
|
119
|
+
type_=typing.Any, # type: ignore
|
|
120
|
+
object_=_response.json(),
|
|
121
|
+
),
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
if _response.status_code == 405:
|
|
125
|
+
raise MethodNotAllowedError(
|
|
126
|
+
headers=dict(_response.headers),
|
|
127
|
+
body=typing.cast(
|
|
128
|
+
typing.Any,
|
|
129
|
+
parse_obj_as(
|
|
130
|
+
type_=typing.Any, # type: ignore
|
|
131
|
+
object_=_response.json(),
|
|
132
|
+
),
|
|
133
|
+
),
|
|
134
|
+
)
|
|
135
|
+
if _response.status_code == 404:
|
|
136
|
+
raise NotFoundError(
|
|
137
|
+
headers=dict(_response.headers),
|
|
138
|
+
body=typing.cast(
|
|
139
|
+
typing.Any,
|
|
140
|
+
parse_obj_as(
|
|
141
|
+
type_=typing.Any, # type: ignore
|
|
142
|
+
object_=_response.json(),
|
|
143
|
+
),
|
|
144
|
+
),
|
|
145
|
+
)
|
|
146
|
+
_response_json = _response.json()
|
|
147
|
+
except JSONDecodeError:
|
|
148
|
+
raise ApiError(
|
|
149
|
+
status_code=_response.status_code,
|
|
150
|
+
headers=dict(_response.headers),
|
|
151
|
+
body=_response.text,
|
|
152
|
+
)
|
|
153
|
+
raise ApiError(
|
|
154
|
+
status_code=_response.status_code,
|
|
155
|
+
headers=dict(_response.headers),
|
|
156
|
+
body=_response_json,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class AsyncRawIngestionClient:
|
|
161
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
162
|
+
self._client_wrapper = client_wrapper
|
|
163
|
+
|
|
164
|
+
async def batch(
|
|
165
|
+
self,
|
|
166
|
+
*,
|
|
167
|
+
batch: typing.Sequence[IngestionEvent],
|
|
168
|
+
metadata: typing.Optional[typing.Any] = OMIT,
|
|
169
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
170
|
+
) -> AsyncHttpResponse[IngestionResponse]:
|
|
171
|
+
"""
|
|
172
|
+
**Legacy endpoint for batch ingestion for Aeri Observability.**
|
|
173
|
+
|
|
174
|
+
-> Please use the OpenTelemetry endpoint (`/api/public/otel/v1/traces`). Learn more: https://aeri.com/integrations/native/opentelemetry
|
|
175
|
+
|
|
176
|
+
Within each batch, there can be multiple events.
|
|
177
|
+
Each event has a type, an id, a timestamp, metadata and a body.
|
|
178
|
+
Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace.
|
|
179
|
+
We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request.
|
|
180
|
+
The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Aeri App.
|
|
181
|
+
I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.
|
|
182
|
+
|
|
183
|
+
Notes:
|
|
184
|
+
- Introduction to data model: https://aeri.com/docs/observability/data-model
|
|
185
|
+
- Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
|
|
186
|
+
- The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
|
|
187
|
+
|
|
188
|
+
Parameters
|
|
189
|
+
----------
|
|
190
|
+
batch : typing.Sequence[IngestionEvent]
|
|
191
|
+
Batch of tracing events to be ingested. Discriminated by attribute `type`.
|
|
192
|
+
|
|
193
|
+
metadata : typing.Optional[typing.Any]
|
|
194
|
+
Optional. Metadata field used by the Aeri SDKs for debugging.
|
|
195
|
+
|
|
196
|
+
request_options : typing.Optional[RequestOptions]
|
|
197
|
+
Request-specific configuration.
|
|
198
|
+
|
|
199
|
+
Returns
|
|
200
|
+
-------
|
|
201
|
+
AsyncHttpResponse[IngestionResponse]
|
|
202
|
+
"""
|
|
203
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
204
|
+
"api/public/ingestion",
|
|
205
|
+
method="POST",
|
|
206
|
+
json={
|
|
207
|
+
"batch": convert_and_respect_annotation_metadata(
|
|
208
|
+
object_=batch,
|
|
209
|
+
annotation=typing.Sequence[IngestionEvent],
|
|
210
|
+
direction="write",
|
|
211
|
+
),
|
|
212
|
+
"metadata": metadata,
|
|
213
|
+
},
|
|
214
|
+
request_options=request_options,
|
|
215
|
+
omit=OMIT,
|
|
216
|
+
)
|
|
217
|
+
try:
|
|
218
|
+
if 200 <= _response.status_code < 300:
|
|
219
|
+
_data = typing.cast(
|
|
220
|
+
IngestionResponse,
|
|
221
|
+
parse_obj_as(
|
|
222
|
+
type_=IngestionResponse, # type: ignore
|
|
223
|
+
object_=_response.json(),
|
|
224
|
+
),
|
|
225
|
+
)
|
|
226
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
227
|
+
if _response.status_code == 400:
|
|
228
|
+
raise Error(
|
|
229
|
+
headers=dict(_response.headers),
|
|
230
|
+
body=typing.cast(
|
|
231
|
+
typing.Any,
|
|
232
|
+
parse_obj_as(
|
|
233
|
+
type_=typing.Any, # type: ignore
|
|
234
|
+
object_=_response.json(),
|
|
235
|
+
),
|
|
236
|
+
),
|
|
237
|
+
)
|
|
238
|
+
if _response.status_code == 401:
|
|
239
|
+
raise UnauthorizedError(
|
|
240
|
+
headers=dict(_response.headers),
|
|
241
|
+
body=typing.cast(
|
|
242
|
+
typing.Any,
|
|
243
|
+
parse_obj_as(
|
|
244
|
+
type_=typing.Any, # type: ignore
|
|
245
|
+
object_=_response.json(),
|
|
246
|
+
),
|
|
247
|
+
),
|
|
248
|
+
)
|
|
249
|
+
if _response.status_code == 403:
|
|
250
|
+
raise AccessDeniedError(
|
|
251
|
+
headers=dict(_response.headers),
|
|
252
|
+
body=typing.cast(
|
|
253
|
+
typing.Any,
|
|
254
|
+
parse_obj_as(
|
|
255
|
+
type_=typing.Any, # type: ignore
|
|
256
|
+
object_=_response.json(),
|
|
257
|
+
),
|
|
258
|
+
),
|
|
259
|
+
)
|
|
260
|
+
if _response.status_code == 405:
|
|
261
|
+
raise MethodNotAllowedError(
|
|
262
|
+
headers=dict(_response.headers),
|
|
263
|
+
body=typing.cast(
|
|
264
|
+
typing.Any,
|
|
265
|
+
parse_obj_as(
|
|
266
|
+
type_=typing.Any, # type: ignore
|
|
267
|
+
object_=_response.json(),
|
|
268
|
+
),
|
|
269
|
+
),
|
|
270
|
+
)
|
|
271
|
+
if _response.status_code == 404:
|
|
272
|
+
raise NotFoundError(
|
|
273
|
+
headers=dict(_response.headers),
|
|
274
|
+
body=typing.cast(
|
|
275
|
+
typing.Any,
|
|
276
|
+
parse_obj_as(
|
|
277
|
+
type_=typing.Any, # type: ignore
|
|
278
|
+
object_=_response.json(),
|
|
279
|
+
),
|
|
280
|
+
),
|
|
281
|
+
)
|
|
282
|
+
_response_json = _response.json()
|
|
283
|
+
except JSONDecodeError:
|
|
284
|
+
raise ApiError(
|
|
285
|
+
status_code=_response.status_code,
|
|
286
|
+
headers=dict(_response.headers),
|
|
287
|
+
body=_response.text,
|
|
288
|
+
)
|
|
289
|
+
raise ApiError(
|
|
290
|
+
status_code=_response.status_code,
|
|
291
|
+
headers=dict(_response.headers),
|
|
292
|
+
body=_response_json,
|
|
293
|
+
)
|