aidev-bkplugin 2.2.2rc51__tar.gz → 2.2.2rc52__tar.gz
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.
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/PKG-INFO +2 -2
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/apps.py +1 -1
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/otel_metrics.py +7 -10
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/tasks.py +1 -1
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/pyproject.toml +2 -2
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_otel_metrics.py +5 -5
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/test_apps.py +12 -9
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/test_management_metrics.py +10 -8
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/constants.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/enums.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/management/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/management/commands/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/management/commands/upgrade_sessions.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/migrations/0001_initial.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/migrations/0002_event_delivery.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/migrations/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/models.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/openapi/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/openapi/urls.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/openapi/views.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/apigw/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/apigw/permissions.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/checkpoint/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/checkpoint/bk_django_saver.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/authentication.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/decorators.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/exception.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/renderers.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/permissions.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/private/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/private/permissions.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/private/urls.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/private/views.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/serializers/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/serializers/agent.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/serializers/chat_completion.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/serializers/llm.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/serializers/user_operation.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_bkplugin.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_builder.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_config.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_execution.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_helpers.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_session.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/approval_resume.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/chat_tracing.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/database_event_bus.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/event_resource_manager.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/event_tracing.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/execution.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/llm.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/metric_runtime.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/user_operation.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/settings.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/urls.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/utils.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/agent.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/base.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/chat.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/chat_group.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/flow_agent.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/llm.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/session.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/user_operation.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/readme.md +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/apps.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/conftest.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/database_events/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/database_events/conftest.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/database_events/test_bus.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/database_events/test_resource_manager.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/database_events/test_tracing.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/packages/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/packages/drf/test_renderers_trace.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/packages/test_bk_django_saver.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/packages/test_bk_django_saver_async.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/private/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/private/test_private_views.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/agent/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/agent/conftest.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/agent/test_agent_config_fetcher.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/agent/test_builder.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/agent/test_session_manager.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_agent_completion.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_agui_handler.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_approval_resume.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_approval_resume_tracing.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_bkplugin.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_execution.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_llm.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_resume_consumer.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_thread_chat_completion.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_user_operation.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/settings.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/test_constants.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/__init__.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_agent_view.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_chat_agent_code_propagation.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_chat_completion_serializer.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_chat_flow_agent.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_chat_stream_status.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_session_pv_files_views.py +0 -0
- {aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_session_view.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aidev-bkplugin
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.2rc52
|
|
4
4
|
Summary: AiDev Agent Bkplugin builtin functions
|
|
5
5
|
Requires-Python: <3.12,>=3.11
|
|
6
|
-
Requires-Dist: aidev-agent>=2.2.
|
|
6
|
+
Requires-Dist: aidev-agent>=2.2.2rc52
|
|
7
7
|
Requires-Dist: blueapps<5.0,>=4.15.1
|
|
8
8
|
Requires-Dist: django<5.0,>=4.2.28
|
|
9
9
|
Provides-Extra: opentelemetry
|
|
@@ -175,7 +175,7 @@ def init_bk_aidev_agent_otel() -> None:
|
|
|
175
175
|
agent_info.get("agent_name"),
|
|
176
176
|
agent_info.get("agent_sdk_version"),
|
|
177
177
|
)
|
|
178
|
-
if metric_settings.
|
|
178
|
+
if metric_settings.has_bkm_config:
|
|
179
179
|
metric_service = BkPluginMetricService(
|
|
180
180
|
service_name=otel_config.service_name,
|
|
181
181
|
endpoints=endpoints,
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/otel_metrics.py
RENAMED
|
@@ -80,7 +80,6 @@ class MetricExportSettings:
|
|
|
80
80
|
enabled: bool
|
|
81
81
|
export_interval_millis: int = DEFAULT_METRIC_EXPORT_INTERVAL_MILLIS
|
|
82
82
|
export_timeout_millis: int = 30000
|
|
83
|
-
export_via_celery: bool = True
|
|
84
83
|
bkm_push_mode: str = BKM_PUSH_MODE_CELERY
|
|
85
84
|
bkm_data_id: int | None = None
|
|
86
85
|
bkm_access_token: str = ""
|
|
@@ -88,6 +87,11 @@ class MetricExportSettings:
|
|
|
88
87
|
bkm_target: str = ""
|
|
89
88
|
task_ttl_seconds: int = DEFAULT_METRIC_TASK_TTL_SECONDS
|
|
90
89
|
|
|
90
|
+
@property
|
|
91
|
+
def has_bkm_config(self) -> bool:
|
|
92
|
+
"""Whether all credentials required for BKM export are configured."""
|
|
93
|
+
return self.bkm_data_id is not None and bool(self.bkm_access_token and self.bkm_push_url)
|
|
94
|
+
|
|
91
95
|
@classmethod
|
|
92
96
|
def from_agent_info(cls, agent_info: dict[str, Any] | None, *, default_enabled: bool) -> "MetricExportSettings":
|
|
93
97
|
otel_info = (agent_info or {}).get("otel_info") or {}
|
|
@@ -105,10 +109,6 @@ class MetricExportSettings:
|
|
|
105
109
|
task_ttl_seconds = agent_settings.BKAI_AGENT_METRICS_TASK_TTL_SECONDS
|
|
106
110
|
if task_ttl_seconds is None:
|
|
107
111
|
task_ttl_seconds = metrics_info.get("task_ttl_seconds", DEFAULT_METRIC_TASK_TTL_SECONDS)
|
|
108
|
-
export_via_celery = metrics_info.get(
|
|
109
|
-
"export_via_celery",
|
|
110
|
-
otel_info.get("metric_export_via_celery"),
|
|
111
|
-
)
|
|
112
112
|
bkm_push_mode = agent_settings.BKAI_AGENT_METRICS_PUSH_MODE
|
|
113
113
|
if bkm_push_mode is None:
|
|
114
114
|
bkm_push_mode = metrics_info.get(
|
|
@@ -126,8 +126,6 @@ class MetricExportSettings:
|
|
|
126
126
|
push_url = _normalize_bkm_push_url(push_url)
|
|
127
127
|
target = agent_settings.BKAI_AGENT_METRICS_TARGET or metrics_info.get("agent_target", "")
|
|
128
128
|
has_bkm_config = data_id not in (None, "") and bool(access_token and push_url)
|
|
129
|
-
if export_via_celery is None:
|
|
130
|
-
export_via_celery = has_bkm_config
|
|
131
129
|
environment_enabled = agent_settings.BKAI_AGENT_ENABLE_METRICS
|
|
132
130
|
enabled = (
|
|
133
131
|
environment_enabled
|
|
@@ -139,7 +137,6 @@ class MetricExportSettings:
|
|
|
139
137
|
export_interval_millis=max(10_000, int(interval)),
|
|
140
138
|
export_timeout_millis=max(1000, int(timeout)),
|
|
141
139
|
task_ttl_seconds=max(1, int(task_ttl_seconds)),
|
|
142
|
-
export_via_celery=_as_bool(export_via_celery),
|
|
143
140
|
bkm_push_mode=bkm_push_mode,
|
|
144
141
|
bkm_data_id=int(data_id) if data_id not in (None, "") else None,
|
|
145
142
|
bkm_access_token=str(access_token or ""),
|
|
@@ -370,7 +367,7 @@ class BkPluginMetricService:
|
|
|
370
367
|
logger.info("[aidev_bkplugin] metric export disabled")
|
|
371
368
|
return False
|
|
372
369
|
readers = []
|
|
373
|
-
if self.settings.
|
|
370
|
+
if self.settings.has_bkm_config:
|
|
374
371
|
if self.settings.bkm_push_mode == BKM_PUSH_MODE_CELERY and self.enqueue_bkm_metrics is None:
|
|
375
372
|
logger.warning("[aidev_bkplugin] BKM metric export enabled but Celery enqueue is unavailable")
|
|
376
373
|
return False
|
|
@@ -406,7 +403,7 @@ class BkPluginMetricService:
|
|
|
406
403
|
self.provider.shutdown()
|
|
407
404
|
self.provider = None
|
|
408
405
|
return False
|
|
409
|
-
transport = f"bkm_{self.settings.bkm_push_mode}" if self.settings.
|
|
406
|
+
transport = f"bkm_{self.settings.bkm_push_mode}" if self.settings.has_bkm_config else "otlp_direct"
|
|
410
407
|
logger.info(
|
|
411
408
|
"[aidev_bkplugin] metric export started with %d reader(s), transport=%s",
|
|
412
409
|
len(readers),
|
|
@@ -19,7 +19,7 @@ logger = logging.getLogger(__name__)
|
|
|
19
19
|
@shared_task(
|
|
20
20
|
name="aidev_bkplugin.push_bkm_metrics",
|
|
21
21
|
ignore_result=True,
|
|
22
|
-
queue=agent_settings.
|
|
22
|
+
queue=agent_settings.BKAI_AGENT_QUEUE_METRIC,
|
|
23
23
|
autoretry_for=(RetryableMetricPushError,),
|
|
24
24
|
retry_backoff=True,
|
|
25
25
|
retry_jitter=True,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "aidev-bkplugin"
|
|
3
|
-
version = "2.2.
|
|
3
|
+
version = "2.2.2rc52"
|
|
4
4
|
description = "AiDev Agent Bkplugin builtin functions"
|
|
5
5
|
readme = "readme.md"
|
|
6
6
|
requires-python = "<3.12,>=3.11"
|
|
7
7
|
dependencies = [
|
|
8
|
-
"aidev-agent>=2.2.
|
|
8
|
+
"aidev-agent>=2.2.2rc52",
|
|
9
9
|
"blueapps>=4.15.1, <5.0",
|
|
10
10
|
"django>=4.2.28,<5.0",
|
|
11
11
|
]
|
|
@@ -161,7 +161,7 @@ def test_metric_settings_parse_nested_otel_info():
|
|
|
161
161
|
assert settings.export_interval_millis == 10_000
|
|
162
162
|
assert settings.export_timeout_millis == 7000
|
|
163
163
|
assert settings.task_ttl_seconds == 120
|
|
164
|
-
assert settings.
|
|
164
|
+
assert settings.has_bkm_config is True
|
|
165
165
|
assert settings.bkm_data_id == 1001
|
|
166
166
|
assert settings.bkm_access_token == "metric-secret"
|
|
167
167
|
assert settings.bkm_push_url == "http://proxy:10205/v2/push/"
|
|
@@ -226,7 +226,7 @@ def test_metric_settings_use_local_environment_fallback(monkeypatch):
|
|
|
226
226
|
assert settings.bkm_access_token == "local-secret"
|
|
227
227
|
assert settings.bkm_push_url == "http://local-proxy:10205/v2/push/"
|
|
228
228
|
assert settings.bkm_target == "local-target"
|
|
229
|
-
assert settings.
|
|
229
|
+
assert settings.has_bkm_config is True
|
|
230
230
|
assert settings.export_interval_millis == 25_000
|
|
231
231
|
assert settings.bkm_push_mode == BKM_PUSH_MODE_DIRECT
|
|
232
232
|
assert settings.task_ttl_seconds == 1800
|
|
@@ -239,7 +239,7 @@ def test_metric_settings_keep_direct_otlp_transport_without_bkm_config():
|
|
|
239
239
|
assert settings.export_interval_millis == 10_000
|
|
240
240
|
assert settings.bkm_push_mode == BKM_PUSH_MODE_CELERY
|
|
241
241
|
assert settings.task_ttl_seconds == 3600
|
|
242
|
-
assert settings.
|
|
242
|
+
assert settings.has_bkm_config is False
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
def test_metric_settings_do_not_reuse_trace_credentials(monkeypatch):
|
|
@@ -582,8 +582,8 @@ def test_celery_task_exports_through_process_local_metric_service(mocker):
|
|
|
582
582
|
service.push_bkm.assert_called_once_with("endpoint-fingerprint", "payload")
|
|
583
583
|
assert tasks.push_bkm_metrics_task.shared_task_options["autoretry_for"] == (RetryableMetricPushError,)
|
|
584
584
|
assert tasks.push_bkm_metrics_task.shared_task_options["max_retries"] == 3
|
|
585
|
-
assert tasks.agent_settings.
|
|
586
|
-
assert tasks.push_bkm_metrics_task.shared_task_options["queue"] == "
|
|
585
|
+
assert tasks.agent_settings.BKAI_AGENT_QUEUE_METRIC == "bkai_agent_metric"
|
|
586
|
+
assert tasks.push_bkm_metrics_task.shared_task_options["queue"] == "bkai_agent_metric"
|
|
587
587
|
assert tasks.run_bkplugin_background_agent_task.shared_task_options["queue"] == "bkai_agent_task"
|
|
588
588
|
|
|
589
589
|
|
|
@@ -83,7 +83,7 @@ def test_init_otel_deduplicates_endpoint_sources_before_instrumenting(mocker):
|
|
|
83
83
|
endpoint = {"url": "https://collector.example/api", "token": "token", "exporter_type": ExporterType.GRPC}
|
|
84
84
|
metric_settings = SimpleNamespace(
|
|
85
85
|
enabled=False,
|
|
86
|
-
|
|
86
|
+
has_bkm_config=False,
|
|
87
87
|
export_interval_millis=1500,
|
|
88
88
|
export_timeout_millis=7000,
|
|
89
89
|
)
|
|
@@ -148,11 +148,14 @@ def test_management_commands_disable_metrics_and_traces_before_remote_config(moc
|
|
|
148
148
|
],
|
|
149
149
|
)
|
|
150
150
|
@pytest.mark.parametrize("enabled", [False, True])
|
|
151
|
-
@pytest.mark.parametrize("
|
|
152
|
-
def test_service_entries_preserve_metric_configuration(mocker, monkeypatch, argv, enabled,
|
|
151
|
+
@pytest.mark.parametrize("has_bkm_config", [False, True])
|
|
152
|
+
def test_service_entries_preserve_metric_configuration(mocker, monkeypatch, argv, enabled, has_bkm_config):
|
|
153
153
|
monkeypatch.setattr(apps.sys, "argv", argv)
|
|
154
154
|
metric_settings = SimpleNamespace(
|
|
155
|
-
enabled=enabled,
|
|
155
|
+
enabled=enabled,
|
|
156
|
+
has_bkm_config=has_bkm_config,
|
|
157
|
+
export_interval_millis=1500,
|
|
158
|
+
export_timeout_millis=7000,
|
|
156
159
|
)
|
|
157
160
|
config, instrumentor, _ = _mock_otel_inputs(mocker, {}, metric_settings)
|
|
158
161
|
config.enable_traces = not enabled
|
|
@@ -165,8 +168,8 @@ def test_service_entries_preserve_metric_configuration(mocker, monkeypatch, argv
|
|
|
165
168
|
|
|
166
169
|
assert config.enable_metrics is enabled
|
|
167
170
|
assert config.enable_traces is (not enabled)
|
|
168
|
-
assert config.metric_provider_managed_externally is (enabled and
|
|
169
|
-
assert metric_service.called is
|
|
171
|
+
assert config.metric_provider_managed_externally is (enabled and has_bkm_config)
|
|
172
|
+
assert metric_service.called is has_bkm_config
|
|
170
173
|
apps.MetricExportSettings.from_agent_info.assert_called_once()
|
|
171
174
|
instrumentor.instrument.assert_called_once_with()
|
|
172
175
|
|
|
@@ -177,7 +180,7 @@ def test_init_otel_keeps_direct_metric_export_in_agent_sdk(mocker, monkeypatch):
|
|
|
177
180
|
monkeypatch.delattr(aidev_agent_packages, "opentelemetry", raising=False)
|
|
178
181
|
settings = SimpleNamespace(
|
|
179
182
|
enabled=True,
|
|
180
|
-
|
|
183
|
+
has_bkm_config=False,
|
|
181
184
|
export_interval_millis=1500,
|
|
182
185
|
export_timeout_millis=7000,
|
|
183
186
|
)
|
|
@@ -202,10 +205,10 @@ def test_init_otel_keeps_direct_metric_export_in_agent_sdk(mocker, monkeypatch):
|
|
|
202
205
|
instrumentor.instrument.assert_called_once_with()
|
|
203
206
|
|
|
204
207
|
|
|
205
|
-
def
|
|
208
|
+
def test_init_otel_uses_bkplugin_metric_provider_for_bkm_export(mocker):
|
|
206
209
|
settings = SimpleNamespace(
|
|
207
210
|
enabled=True,
|
|
208
|
-
|
|
211
|
+
has_bkm_config=True,
|
|
209
212
|
export_interval_millis=1500,
|
|
210
213
|
export_timeout_millis=7000,
|
|
211
214
|
)
|
|
@@ -50,13 +50,15 @@ EXIT_PROBE = dedent("""
|
|
|
50
50
|
# Keep the real SDK provider lifecycle; avoid unrelated agent wrappers.
|
|
51
51
|
return SimpleNamespace(instrument=BkAgentOTelService(config).start)
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
use_bkm = sys.argv[1] == "bkm"
|
|
54
54
|
sys.argv = ["bin/manage.py", sys.argv[2]]
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
metrics_config = {"enabled": True}
|
|
56
|
+
if use_bkm:
|
|
57
|
+
metrics_config.update({
|
|
58
|
+
"agent_data_id": 1, "agent_access_token": "test-token",
|
|
59
|
+
"agent_push_url": "http://collector.example.com/v2/push/",
|
|
60
|
+
})
|
|
61
|
+
agent_info = {"otel_info": {"metrics": metrics_config}}
|
|
60
62
|
endpoint = {"url": "http://collector.example.com", "token": "", "exporter_type": ExporterType.HTTP}
|
|
61
63
|
with (
|
|
62
64
|
patch.object(apps, "get_otel_endpoint_by_json_str", return_value=[endpoint]),
|
|
@@ -77,13 +79,13 @@ EXIT_PROBE = dedent("""
|
|
|
77
79
|
""")
|
|
78
80
|
|
|
79
81
|
|
|
80
|
-
@pytest.mark.parametrize("transport", ["
|
|
82
|
+
@pytest.mark.parametrize("transport", ["otlp", "bkm"])
|
|
81
83
|
@pytest.mark.parametrize("command", ["migrate", "upgrade_sessions"])
|
|
82
84
|
def test_management_initialization_exits_without_metric_or_trace_export(transport, command):
|
|
83
85
|
env = {
|
|
84
86
|
**os.environ,
|
|
85
87
|
"DJANGO_SETTINGS_MODULE": "tests.settings",
|
|
86
|
-
"PYTHONPATH": os.pathsep.join([str(PLUGIN_ROOT), str(AGENT_ROOT)]),
|
|
88
|
+
"PYTHONPATH": os.pathsep.join([str(PLUGIN_ROOT), str(AGENT_ROOT), os.environ.get("PYTHONPATH", "")]),
|
|
87
89
|
"BKAI_AGENT_OTEL_ENABLED": "true",
|
|
88
90
|
"BKAI_AGENT_ENABLE_METRICS": "true",
|
|
89
91
|
"BKAI_AGENT_ENABLE_TRACES": "true",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/management/commands/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/migrations/0001_initial.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/apigw/__init__.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/apigw/permissions.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/checkpoint/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/__init__.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/authentication.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/decorators.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/exception.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/packages/drf/renderers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/serializers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/serializers/chat_completion.py
RENAMED
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/serializers/user_operation.py
RENAMED
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_bkplugin.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_builder.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_config.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_execution.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_helpers.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/agent_session.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/approval_resume.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/chat_tracing.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/database_event_bus.py
RENAMED
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/event_tracing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/metric_runtime.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/services/user_operation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/aidev_bkplugin/views/user_operation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/database_events/test_resource_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/packages/drf/test_renderers_trace.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/packages/test_bk_django_saver.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/packages/test_bk_django_saver_async.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/agent/test_session_manager.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_agent_completion.py
RENAMED
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_approval_resume.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_approval_resume_tracing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_resume_consumer.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/services/test_thread_chat_completion.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_chat_completion_serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_chat_stream_status.py
RENAMED
|
File without changes
|
{aidev_bkplugin-2.2.2rc51 → aidev_bkplugin-2.2.2rc52}/tests/views/test_session_pv_files_views.py
RENAMED
|
File without changes
|
|
File without changes
|