Skip to content

Conversation

@vladvildanov
Copy link
Collaborator

Description of change

Please provide a description of the change here.

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

return self._exception

@dataclass
class AfterCommandExecutionEvent:
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be easier to understand what this event handles if the name suggests it is related to metrics collection or if it might be used for other things as well - at least in the docstrings, we can add a mention of the metrics collection.

return_value=collector
):
# Create event dispatcher (real one, to test the full chain)
event_dispatcher = EventDispatcher()
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not mandatory - in case it is not provided as input argument a default EventDispatcher instances will be created.

with mock.patch.object(
recorder, '_get_or_create_collector', return_value=collector
):
event_dispatcher = EventDispatcher()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to have some of the test (we can also look at them as examples how some features can be used or need to be configured) without pre-creating the event dispatcher and leave the init method to create the default instance - in this case the end result will be the same - instance of type EventDispatcher

assert attrs['server.port'] == 6379
assert attrs['db.namespace'] == '0'

def test_pipeline_transaction_emits_multi_command_name(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this covered in the test above? The difference between those two tests is that the first one sends several commands as transaction and this one sends just one command

"""
Test that an empty pipeline (no commands) does not emit an event.
"""
from redis.client import Pipeline
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think all those imports can be removed - they are already added to the top level imports in the beginning of the file.

):
# Create a new event dispatcher and attach it to the cluster
event_dispatcher = EventDispatcher()
r._event_dispatcher = event_dispatcher
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this needed? It should already be initialized. Or it needs to be initialized after OTelConfig?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants