Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue integration fixes #904

Merged
merged 6 commits into from
Jun 5, 2024
Merged

Queue integration fixes #904

merged 6 commits into from
Jun 5, 2024

Conversation

stayallive
Copy link
Collaborator

@stayallive stayallive commented Jun 4, 2024

  • Fixes: "ErrorException: Undefined array key "sentry_publish_time""
  • Decode payload only once to save on CPU cycles
  • Use job UUID from the payload ($job->getJobId() is publisher (like SQS) ID)
  • Add job ID to publish span
  • Fix queues: prefix for queue names when using Redis driver

@@ -68,6 +68,7 @@ public function onBoot(Dispatcher $events): void
->setOp(self::QUEUE_SPAN_OP_QUEUE_PUBLISH)
->setData([
'messaging.system' => 'laravel',
'messaging.message.id' => $payload['uuid'] ?? null,
'messaging.destination.name' => $queue,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is prepended with "queue:" to something like: queues:queue-name

We need to "fix" this because otherwise the published are on the wrong destination.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out... only the Redis driver does this. We could argue Laravel should fix this but let's also fix it ourselfs 😄

'messaging.message.id' => (string) $event->job->getJobId(),

'messaging.message.id' => $jobPayload['uuid'] ?? $event->job->getJobId(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to keep the string cast for $event->job->getJobId().

Copy link
Collaborator Author

@stayallive stayallive Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's documented as returning a string? When doesn't it do that?

Maybe we should just rely on $jobPayload['uuid'] anyway otherwise they will never match. Laravel should always add a ID to the job payload. Not sure if it's possible to not have one.

@stayallive stayallive merged commit f711fec into master Jun 5, 2024
24 checks passed
@stayallive stayallive deleted the fix-queue-tracing branch June 5, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants