Skip to content

Commit

Permalink
Merge pull request #5 from worksome/feature/enable
Browse files Browse the repository at this point in the history
feat: support disabling Horizon Telemetry
  • Loading branch information
owenvoke authored Feb 1, 2023
2 parents 08561b2 + fbfe37b commit 789721a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"illuminate/contracts": "^9.46",
"laravel/horizon": "^5.10",
"open-telemetry/api": "^0.0.17",
"worksome/laravel-telemetry": "^0.2.0"
"worksome/laravel-telemetry": "^0.2.4"
},
"require-dev": {
"nunomaduro/collision": "^6.4",
Expand Down
8 changes: 8 additions & 0 deletions src/HorizonTelemetryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public function boot(): void
/** @var Repository $config */
$config = $this->app->make(Repository::class);

if (! $config->get('telemetry.enabled', true)) {
return null;
}

if ($config->get(self::CONFIG_PREFIX . MeterName::FailedJobs->value, true)) {
$dispatcher->listen(JobFailed::class, FailedJobsListener::class);
}
Expand All @@ -50,6 +54,10 @@ public function boot(): void
/** @var Repository $config */
$config = $this->app->make(Repository::class);

if (! $config->get('telemetry.enabled', true)) {
return null;
}

if ($currentMasterSupervisorsSchedule = $config->get(
self::CONFIG_PREFIX . MeterName::CurrentMasterSupervisors->value
)) {
Expand Down

0 comments on commit 789721a

Please sign in to comment.