Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Make the use if the telemetry service configurable #1420

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/core/Directus/Application/CoreServicesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,19 +717,23 @@ protected function getEmitter()
$emitter->addAction('auth.request:credentials', function () use ($container) {
/** @var Session $session */
$session = $container->get('session');
if ($session->getStorage()->get('telemetry') === true) {
return;
}
$useTelemetry = get_directus_setting('telemetry',true);

$data = [
'version' => Application::DIRECTUS_VERSION,
'url' => get_url(),
'type' => 'api'
];
\Directus\request_send_json('POST', 'https://telemetry.directus.io/count', $data);
if($useTelemetry) {
if ($session->getStorage()->get('telemetry') === true) {
return;
}

// NOTE: this only works when the client sends subsequent request with the same cookie
$session->getStorage()->set('telemetry', true);
$data = [
'version' => Application::DIRECTUS_VERSION,
'url' => get_url(),
'type' => 'api'
];
\Directus\request_send_json('POST', 'https://telemetry.directus.io/count', $data);

// NOTE: this only works when the client sends subsequent request with the same cookie
$session->getStorage()->set('telemetry', true);
}
});

return $emitter;
Expand Down