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

Make RASA_ENVIRONMENT available in events logged by Kafka producer #10413

Merged
merged 3 commits into from
Nov 30, 2021

Conversation

indam23
Copy link
Contributor

@indam23 indam23 commented Nov 29, 2021

Proposed changes:

Status (please check what you already did):

  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@indam23 indam23 requested a review from a team as a code owner November 29, 2021 10:42
@indam23 indam23 requested review from a team and aeshky and removed request for a team November 29, 2021 10:42
@indam23 indam23 changed the base branch from main to 2.8.x November 29, 2021 10:42
@indam23 indam23 requested review from b-quachtran and joejuzl and removed request for a team and aeshky November 29, 2021 10:42
@@ -198,7 +200,16 @@ def _publish(self, event: Dict[Text, Any]) -> None:
logger.debug(
f"Calling kafka send({self.topic}, value={event}, key={partition_key!s})"
)
self.producer.send(self.topic, value=event, key=partition_key)

headers = [("RASA_ENVIRONMENT", bytes(self.rasa_environment, encoding=DEFAULT_ENCODING))]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have a unit test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Trying to figure out how to check this because it's not a property like it is for Pika - it only shows up in the headers when the event is sent. Is it necessary to mock a consumer to check what is sent, or do you think it can be mocked higher up?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it requires everything to be mocked then probably not worth it. We really need some integration tests using an actual kafka.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha. So no unit tests on this PR then? All we can assert without mocks is that the environment var is fetched but that seems a little ¯_(ツ)_/¯

@indam23 indam23 merged commit ceded88 into 2.8.x Nov 30, 2021
@indam23 indam23 deleted the kafka_add_environment_header branch November 30, 2021 16:46
@m-vdb m-vdb mentioned this pull request Dec 7, 2021
2 tasks
@ePreda ePreda mentioned this pull request Dec 23, 2021
4 tasks
@indam23 indam23 mentioned this pull request Jan 6, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants