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

Added global_keyprefix support for pubsub clients #1495

Merged
merged 2 commits into from
Feb 28, 2022
Merged

Added global_keyprefix support for pubsub clients #1495

merged 2 commits into from
Feb 28, 2022

Conversation

vinayinvicible
Copy link
Contributor

Fixes #1494

Need help with testcases.

@thedrow
Copy link
Member

thedrow commented Feb 24, 2022

What kind of help do you need with the testing?

@vinayinvicible
Copy link
Contributor Author

@thedrow
I've added a unit test. Please let me know if I've to add more tests.

channel.active_fanout_queues.add('a')

channel._subscribe()
mock_execute_command.assert_called()
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need assert_called if we have assert_called_with?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it.

Copy link
Member

@thedrow thedrow left a comment

Choose a reason for hiding this comment

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

Just a few small neat-picks.

@@ -217,7 +217,7 @@ def _prefix_args(self, args):
if command in self.PREFIXED_SIMPLE_COMMANDS:
args[0] = self.global_keyprefix + str(args[0])

if command in self.PREFIXED_COMPLEX_COMMANDS.keys():
elif command in self.PREFIXED_COMPLEX_COMMANDS:
Copy link
Member

Choose a reason for hiding this comment

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

Remove the line break please. It was there because these conditions where unrelated although you are right, they should be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it.

@auvipy auvipy added this to the 5.2.x milestone Feb 28, 2022
@auvipy auvipy merged commit 3475986 into celery:master Feb 28, 2022
@vinayinvicible vinayinvicible deleted the pubsub_keyprefix branch February 28, 2022 11:05
abellotti added a commit to cloudigrade/cloudigrade that referenced this pull request Mar 11, 2022
the fix from celery/kombu#1495

This fixes the issue where task events from the cloudigrade
worker were not seen by the internal celery metrics.

High level:
With kombu 5.2.3, redis client psubscribes are not subscribed
to a channel named with the global_keyprefix that we
specified with the broker_transport options. However, task
and worker events are keyed with the prefix, so they are never
seen by the celery metrics. Removing the global_keyprefix
(i.e. user prefix via CLOUDIGRADE_ENVIRONMENT)
events now are properly seen, but this won't work with a shared
redis instance.

With the fix in the PR mentioned above, the global_keyprefix
is properly handled with pubsub clients.
abellotti added a commit to cloudigrade/cloudigrade that referenced this pull request Mar 11, 2022
the fix from celery/kombu#1495

This fixes the issue where task events from the cloudigrade
worker were not seen by the internal celery metrics.

High level:
With kombu 5.2.3, redis client psubscribes are not subscribed
to a channel named with the global_keyprefix that we
specified with the broker_transport options. However, task
and worker events are keyed with the prefix, so they are never
seen by the celery metrics. Removing the global_keyprefix
(i.e. user prefix via CLOUDIGRADE_ENVIRONMENT)
events now are properly seen, but this won't work with a shared
redis instance.

With the fix in the PR mentioned above, the global_keyprefix
is properly handled with pubsub clients.
abellotti added a commit to abellotti/celery-exporter that referenced this pull request Mar 23, 2022
This version includes: celery/kombu#1495
which fixes an issue where pubsub clients would not
work with messages that include the global_keyprefix.
danihodovic pushed a commit to danihodovic/celery-exporter that referenced this pull request Mar 23, 2022
This version includes: celery/kombu#1495
which fixes an issue where pubsub clients would not
work with messages that include the global_keyprefix.
keithgg pushed a commit to open-craft/kombu that referenced this pull request Aug 11, 2022
* Added global_keyprefix support for pubsub clients

* Added test cases
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.

Celery inspect has stopped working after using global_keyprefix transport option
3 participants