RasaHQ / rasa-sdk

SDK for the development of custom actions for Rasa
https://rasa.com/docs
Apache License 2.0
291 stars 233 forks source link

[ATO-2609] Add gRPC tracing #1117

Closed radovanZRasa closed 4 months ago

radovanZRasa commented 4 months ago

Add tracing between Rasa and action server.

image

Status (please check what you already did):

Tawakalt commented 4 months ago

@radovanZRasa We should do a quick check that this works with grpc as well.

ancalita commented 4 months ago

@radovanZRasa Do we know what are the errors in the screenshot you shared in the PR description? Referring to the spans with exclamation mark next to them.

radovanZRasa commented 4 months ago

@radovanZRasa Do we know what are the errors in the screenshot you shared in the PR description? Referring to the spans with exclamation mark next to them.

Yea, I was testing Rasa with CALM bot from calm-demo-bot and action server from simple NLU bot because I did not want to lose time to install necessary dependencies for CALM bot's actions in my Rasa SDK virtual env. I only wanted to verify that tracing works.

Tawakalt commented 4 months ago

@radovanZRasa Do we know what are the errors in the screenshot you shared in the PR description? Referring to the spans with exclamation mark next to them.

It's most likely the missing domain error log that should now be fixed.

radovanZRasa commented 4 months ago

@radovanZRasa Do we know what are the errors in the screenshot you shared in the PR description? Referring to the spans with exclamation mark next to them.

It's most likely the missing domain error log that should now be fixed.

They will also appear in this case. Good thing is that all calls are logged so everything is there.

image

As image shows all calls are recorded.

For failed call, log indicates that domain was not found: image

radovanZRasa commented 4 months ago

@radovanZRasa We should do a quick check that this works with grpc as well.

I added custom action AddContact and added tracing into it:

from typing import Any, Dict
from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.tracing.tracer_register import ActionExecutorTracerRegister

class AddContact(Action):
    def name(self) -> str:
        return "add_contact"

    def run(
        self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[str, Any]
    ):
        tracer = ActionExecutorTracerRegister().get_tracer()
        with tracer.start_as_current_span("AddContact.add_contact"):
            return [SlotSet("return_value", "success")]

Verified: image