Package dev.runabout

Interface RunaboutService


  • public interface RunaboutService
    Runabout interface for converting runtime java objects to JSON outputs that can be used for replay debugging in Runabout. The service has a generic type parameter that allows for the user to specify the type of JSON object to be used. By default, the service uses the built-in lightweight JsonObject interface. To use a different type, use RunaboutServiceBuilder to create a custom service.
    • Method Detail

      • getService

        static RunaboutService getService​(java.lang.String projectName,
                                          java.lang.String apiToken)
        Gets the default RunaboutService which uses the built-in JsonObject type.
        Parameters:
        projectName - The name of the project to log scenarios under.
        apiToken - The API token for the Runabout project.
        Returns:
        The default implementation of RunaboutService.
      • serialize

        RunaboutInput serialize​(java.lang.Object object)
        Converts an object to a RunaboutInput.
        Parameters:
        object - The object to serialize.
        Returns:
        A RunaboutInput representing the serialized object.
      • createScenario

        RunaboutScenario createScenario​(@Nullable
                                        java.lang.String eventId,
                                        @Nullable
                                        JsonObject properties,
                                        java.lang.Object... objects)
        Converts a method and the given objects to a Runabout JSON object. This JSON format is known by Runabout and can be parsed by the Runabout web application and IDE plugin. The format is as follows: {
        "version": "0.0.0", // The version of the Runabout JSON format.
        "caller": "com.example.ClassName.methodName", // The caller method, from which the objects are arguments.
        "instances": [] // The runabout instances (as JSON) from the objects passed in.
        }

        The format of the instances is as follows: {
        "type": "com.example.Value", // The fully qualified class of the instance.
        "value": "new Value()" // A String which is a Java expression, which evaluates to an object.
        "dependencies": [] // The fully qualified class names for all dependencies of the instance.
        }
        Parameters:
        eventId - Nullable String eventId for tracking scenarios that occurred in the same request.
        properties - Nullable JsonObject contextual data for adding additional info to scenarios.
        objects - The objects to convert to Runabout inputs in JSON.
        Returns:
        A JSON object.
      • saveScenario

        void saveScenario​(java.lang.String eventId,
                          JsonObject properties,
                          java.lang.Object... objects)
        Emit a scenario with eventId and contextual data to the runabout ingest API. This method is intended to be non-blocking and implementations should enqueue the data to be sent on another thread.
        Parameters:
        eventId - Nullable String eventId for tracking scenarios that occurred in the same request.
        properties - Nullable JsonObject contextual data for adding additional info to scenarios.
        objects - Objects to convert to Runabout instances for the scenario.