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

Commit

Permalink
Make the use if the telemetry service configurable (#1420)
Browse files Browse the repository at this point in the history
* Make the telemetry requests configurable

* Add new config setting to the schema

* Remove telemetry from configuration file

* Remove telemetry from configuration file

* Remove telemetry from schema

* Remove extra comma

* Fetch the telemetry from settings table instead of configuration file
  • Loading branch information
arboehme authored and binal-7span committed Nov 26, 2019
1 parent ae2d697 commit f8e0fd3
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/core/Directus/Application/CoreServicesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -711,19 +711,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

0 comments on commit f8e0fd3

Please sign in to comment.