diff --git a/app/config/variables.php b/app/config/variables.php index 80ec4979d7..26ad012475 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -279,7 +279,7 @@ return [ ], [ 'name' => '_APP_LOGGING_CONFIG', - 'description' => 'This variable enables error logging using a provider DSN. This value is empty by default. Currently, Appwrite supports Sentry DSNs using the format `sentry://PROJECT_ID:SENTRY_API_KEY@SENTRY_HOST/`.', + 'description' => 'This variable enables error logging using a provider DSN. This value is empty by default. Currently, Appwrite supports Sentry DSNs using the format `https://SENTRY_PUBLIC_KEY@SENTRY_HOST/PROJECT_ID`.', 'introduction' => '0.12.0', 'default' => '', 'required' => false, @@ -288,7 +288,7 @@ return [ ], [ 'name' => '_APP_EXPERIMENT_LOGGING_CONFIG', - 'description' => 'This variable enables experimental error logging using a provider DSN. This value is empty by default. Currently, Appwrite supports Sentry DSNs using the format `sentry://PROJECT_ID:SENTRY_API_KEY@SENTRY_HOST/?sample=0.01`.', + 'description' => 'This variable enables experimental error logging using a provider DSN. This value is empty by default. Currently, Appwrite supports Sentry DSNs using the format `https://SENTRY_PUBLIC_KEY@SENTRY_HOST/PROJECT_ID?sample=0.01`.', 'introduction' => '1.9.0', 'default' => '', 'required' => false, diff --git a/app/init/span.php b/app/init/span.php index 387dd15bb4..90c63d25fb 100644 --- a/app/init/span.php +++ b/app/init/span.php @@ -1,6 +1,5 @@ getScheme(); - - if ($providerName !== 'sentry') { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Logging provider not supported. Logging is disabled'); - } - - $projectId = $loggingProvider->getUser(); - $apiKey = $loggingProvider->getPassword(); - $host = $loggingProvider->getHost(); - $port = $loggingProvider->getPort(); - $path = $loggingProvider->getPath(); - - if (empty($projectId) || empty($apiKey) || empty($host)) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Invalid Sentry DSN. Logging is disabled'); - } - - $host = $host . (empty($port) ? '' : ':' . $port); - $path = empty($path) ? '' : \trim($path, '/') . '/'; - $dsn = 'https://' . $apiKey . '@' . $host . '/' . $path . $projectId; - Span::addExporter( new Exporter\Sentry( - dsn: $dsn, + dsn: $loggingConfig, environment: System::getEnv('_APP_ENV', 'development') === 'production' ? 'production' : 'staging', release: System::getEnv('_APP_VERSION', 'UNKNOWN'), serverName: System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname()), diff --git a/src/Appwrite/Platform/Tasks/Doctor.php b/src/Appwrite/Platform/Tasks/Doctor.php index b9c2fb33c8..e5a1d12452 100644 --- a/src/Appwrite/Platform/Tasks/Doctor.php +++ b/src/Appwrite/Platform/Tasks/Doctor.php @@ -131,10 +131,10 @@ class Doctor extends Action $providerName = $loggingProvider->getScheme(); - if ($providerName !== 'sentry') { + if (!\in_array($providerName, ['http', 'https'])) { Console::log('🔴 Logging adapter is unsupported (' . $providerName . ')'); } else { - Console::log('🟢 Logging adapter is enabled (' . $providerName . ')'); + Console::log('🟢 Logging adapter is enabled (sentry)'); } } catch (\Throwable) { Console::log('🔴 Logging adapter is misconfigured');