Tighten experimental error span sampling

This commit is contained in:
Chirag Aggarwal
2026-04-30 12:10:40 +05:30
parent 9a09bbbe72
commit e3b26a4666
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -82,6 +82,7 @@ if (!empty($experimentalLoggingConfig)) {
$addSentryExporter(
loggingConfig: $experimentalLoggingConfig,
sampler: fn (Span $span): bool => $span->getError() !== null
&& $span->get('appwrite.error.publish') === true
&& $span->get('appwrite.error.experimental') === true
&& \mt_rand() / \mt_getrandmax() <= $sampleRate,
);
@@ -15,6 +15,7 @@ use Utopia\Agents\Agent;
use Utopia\Database\Document;
use Utopia\Http\Adapter\Swoole\Response as SwooleResponse;
use Utopia\Span\Span;
use Utopia\System\System;
use Utopia\Validator\ArrayList;
use Utopia\Validator\Text;
use Utopia\Validator\WhiteList;
@@ -105,6 +106,9 @@ class Create extends CreateDocumentAction
$span = new Span('vectorsDB.createTextEmbeddings');
$span->set('level', 'error');
$span->set('logger', 'http');
$span->set('server.name', System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname()));
$span->set('release', System::getEnv('_APP_VERSION', 'UNKNOWN'));
$span->set('environment', System::getEnv('_APP_ENV', 'development') === 'production' ? 'production' : 'staging');
$span->set('appwrite.error.publish', true);
$span->set('appwrite.error.action', 'vectorsDB.createTextEmbeddings');
$span->set('embeddingModel', $model);