наблюдаемость: завершить базовый контур Community
CI / Rust Checks (push) Failing after 4m28s
CI / UI Checks (push) Has been skipped
CI / Frontend E2E (push) Has been skipped
CI / Community Image Smoke (push) Has been skipped
CI / Deploy (push) Has been skipped

Добавить структурированные журналы, метрики, трассировку и безопасный канал критических ошибок. Усилить границы рантайма, тесты, проверку зависимостей и сценарии развёртывания.
This commit is contained in:
2026-07-31 01:01:14 +03:00
parent 99bd05c145
commit 0e8f1ca03a
160 changed files with 13506 additions and 1499 deletions
@@ -1,9 +1,47 @@
use super::*;
fn invocation_history_loss_category(error: &RegistryError) -> InvocationHistoryLossCategory {
match error {
RegistryError::Storage(error)
if error
.as_database_error()
.and_then(|database_error| database_error.code())
.is_some_and(|code| code.starts_with("22") || code.starts_with("23")) =>
{
InvocationHistoryLossCategory::InvalidRecord
}
RegistryError::Storage(_) => InvocationHistoryLossCategory::Unavailable,
_ => InvocationHistoryLossCategory::InvalidRecord,
}
}
impl PostgresRegistry {
pub async fn delete_invocation_logs_before(
&self,
cutoff: OffsetDateTime,
) -> Result<u64, RegistryError> {
let result = sqlx::query("delete from invocation_logs where created_at < $1::timestamptz")
.bind(cutoff)
.execute(&self.pool)
.await?;
Ok(result.rows_affected())
}
pub async fn create_invocation_log(
&self,
request: CreateInvocationLogRequest<'_>,
) -> InvocationHistoryWriteOutcome {
match self.try_create_invocation_log(request).await {
Ok(()) => InvocationHistoryWriteOutcome::Recorded,
Err(error) => InvocationHistoryWriteOutcome::Lost(InvocationHistoryLoss {
category: invocation_history_loss_category(&error),
}),
}
}
async fn try_create_invocation_log(
&self,
request: CreateInvocationLogRequest<'_>,
) -> Result<(), RegistryError> {
let request_preview = crank_core::sanitize_invocation_preview(&request.log.request_preview);
let response_preview =