Skip to content

Commit 552e09b

Browse files
committed
fix(otel): emit EmitAuditLogJob with db fallback
1 parent 3b55424 commit 552e09b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/Audit/AuditLogOtlpStrategy.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* limitations under the License.
1313
**/
1414
use App\Audit\Interfaces\IAuditStrategy;
15+
use App\Jobs\Utils\JobDispatcher;
1516
use Doctrine\ORM\PersistentCollection;
1617
use Illuminate\Support\Facades\Log;
1718
use App\Jobs\EmitAuditLogJob;
@@ -70,8 +71,10 @@ public function audit($subject, array $change_set, string $event_type, AuditCon
7071
if (!empty($description)) {
7172
$auditData['audit.description'] = $description;
7273
}
73-
Log::debug("AuditLogOtlpStrategy::audit sending entry to OTEL", ["user_id" => $ctx->userId, "user_email" => $ctx->userEmail, 'payload' => $auditData]);
74-
EmitAuditLogJob::dispatch($this->getLogMessage($event_type), $auditData);
74+
$job = new EmitAuditLogJob($this->getLogMessage($event_type), $auditData);
75+
JobDispatcher::withDbFallback(
76+
job: $job,
77+
);
7578
Log::debug("AuditLogOtlpStrategy::audit entry sent to OTEL", ["user_id" => $ctx->userId, "user_email" => $ctx->userEmail]);
7679

7780
} catch (\Exception $ex) {

0 commit comments

Comments
 (0)