Skip to content

Commit d20074f

Browse files
committed
fix: opentelemetry.enabled feature flag
1 parent 728ae67 commit d20074f

4 files changed

Lines changed: 7 additions & 2 deletions

File tree

app/Audit/AuditEventListener.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private function getAuditStrategy($em): ?IAuditStrategy
7474
// Check if OTLP audit is enabled
7575
if (config('opentelemetry.enabled', false)) {
7676
try {
77+
Log::debug("AuditEventListener::getAuditStrategy strategy AuditLogOtlpStrategy");
7778
return App::make(AuditLogOtlpStrategy::class);
7879
} catch (\Exception $e) {
7980
Log::warning('Failed to create OTLP audit strategy, falling back to database', [
@@ -83,6 +84,7 @@ private function getAuditStrategy($em): ?IAuditStrategy
8384
}
8485

8586
// Use database strategy (either as default or fallback)
87+
Log::debug("AuditEventListener::getAuditStrategy strategy AuditLogStrategy");
8688
return new AuditLogStrategy($em);
8789
}
8890

app/Audit/AuditLogOtlpStrategy.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public function __construct(IAuditLogFormatterFactory $formatterFactory)
3030
$this->formatterFactory = $formatterFactory;
3131
$this->enabled = config('opentelemetry.enabled', false);
3232
$this->elasticIndex = config('opentelemetry.logs.elasticsearch_index', 'logs-audit');
33+
Log::debug("AuditLogOtlpStrategy::__construct", [
34+
'enabled' => $this->enabled,
35+
'elasticIndex' => $this->elasticIndex,
36+
]);
3337
}
3438

3539
/**

app/Services/Apis/MailApi.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
* limitations under the License.
1313
**/
1414
use GuzzleHttp\Client;
15-
use GuzzleHttp\Exception\ClientException;
1615
use GuzzleHttp\Exception\RequestException;
1716
use GuzzleHttp\HandlerStack;
1817
use GuzzleRetry\GuzzleRetryMiddleware;

config/opentelemetry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use OpenTelemetry\SDK\Common\Configuration\Variables;
55

66
return [
7-
'enabled' => env('OTEL_SERVICE_ENABLED', false),
7+
'enabled' => filter_var(env('OTEL_SERVICE_ENABLED', false), FILTER_VALIDATE_BOOLEAN),
88
/**
99
* Service name
1010
*/

0 commit comments

Comments
 (0)