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

[ATO-2105] Implement functionality to create custom spans #1075

Merged
merged 4 commits into from
Feb 14, 2024

Conversation

Tawakalt
Copy link
Contributor

@Tawakalt Tawakalt commented Feb 13, 2024

Proposed changes:

Views from Jaegar UI
Screenshot 2024-02-13 at 14 57 21

Status (please check what you already did):

  • made PR ready for code review
  • added some tests for the functionality
  • updated the documentation in the rasaHQ/rasa
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

Copy link
Member

@ancalita ancalita left a comment

Choose a reason for hiding this comment

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

Great work 💯 In addition to the below comments, how did you obtain that view in Jaeger? I'd suggest to add a new test custom action that does the same steps you took to get that custom span in a different test case.

@Tawakalt
Copy link
Contributor Author

Tawakalt commented Feb 13, 2024

Great work 💯 In addition to the below comments, how did you obtain that view in Jaeger? I'd suggest to add a new test custom action that does the same steps you took to get that custom span in a different test case.

It will require an integration test to achieve this.

I wrote a custom action like this and triggered it

class ValidatePredefinedSlots(ValidationAction):
    def validate_location(
        self,
        slot_value: Any,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: DomainDict,
    ) -> Dict[Text, Any]:
        """Validate location value."""
        from rasa_sdk.tracing.tracer_register import ActionExecutorTracerRegister

        tracer = ActionExecutorTracerRegister().get_tracer()
        with tracer.start_as_current_span("my_very_own_custom_span"):
            if isinstance(slot_value, str):
                # validation succeeded, capitalize the value of the "location" slot
                dispatcher.utter_message("Nice! I've always wanted to visit ", slot_value.capitalize())
                return {"location": slot_value.capitalize()}
            else:
                # validation failed, set this slot to None
                return {"location": None}

Copy link
Member

@ancalita ancalita left a comment

Choose a reason for hiding this comment

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

🎉
I'd also make Sanchari aware of this integration test case need to be added to the list for the action server testing.

@Tawakalt Tawakalt merged commit 46436a7 into main Feb 14, 2024
16 checks passed
@Tawakalt Tawakalt deleted the ATO-2105-create-custom-spans branch February 14, 2024 09:53
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