Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. API used by apps for logging the debug data

    Code Block
    languagejava
    /**
     * Interface used by CDAP applications to log the data useful for debugging during runtime.
     */
    public interface DebugLoggerFactory {
      /**
       * Returns {@code true} if application is running in debug mode otherwise false is returned.
       */
      boolean isEnabled();
    
      /**
       * Get the {@link Logger} used to log the debug data.
       * @param loggerName the name of the logger with which the log data to be associated
       * @return the instance of the Logger
       */
      Logger getLogger(String loggerName);
    }
     
    /**
     * Interface used by the CDAP applications to log the debug data.
     */
    public interface Logger {
      /**
       * Logs the data at INFO level. Multiple values can be logged against the same property.
       * @param propertyName the the name of the property
       * @param propertyValue the value associated with the property
       */
      void info(String propertyName, Object propertyValue);
     
      /**
       * Logs the data at DEBUG level. Multiple values can be logged against the same property.
       * @param propertyName the the name of the property
       * @param propertyValue the value associated with the property
       */
      void debug(String propertyName, Object propertyValue);
    
      /**
       * Logs the data at ERROR level. Multiple values can be logged against the same property.
       * @param propertyName the the name of the property
       * @param propertyValue the value associated with the property
       */
      void error(String propertyName, Object propertyValue);
     
      /**
       * Return the name of the logger instance.
       */ 
      String getName(); 
    }
  2. REST endpoints
    1. To start a preview

      Code Block
      languagejava
      POST /v3/namespaces/{namespace-id}/preview?mode=info
      where namespace-id is the name of the namespace
      mode is a query string parameter which can be one of <info,debug,warn> and it controls the logging level for preview. 
      Response will contain the CDAP generated unique preview-id which can be used further to get the preview data.
    2. To get the status of the preview

      Code Block
      languagejava
      GET /v3/namespaces/{namespace-id}/previews/{preview-id}/status
      where namespace-id is the name of the namespace
            preview-id is the id of the preview for which status is to be requested
    3. To get the data associated with the preview

      Code Block
      languagejava
      GET /v3/namespaces/{namespace-id}/previews/{preview-id}/loggers/{logger-id}
      where namespace-id is the name of the namespace
            preview-id is the id of the preview for which data is to be requested
            stage-id is the unique name used to identify the emitter
  3. Config changes for preview:

    Code Block
    languagejava
    Application configuration will have preview related configurations which will be used by CDAP. Currently there are programId and programType configurations which will be used to identify the program to be executed as a part of preview.
    {
       "preview": {
          "programId": "MyProgram",
          "programType": "workflow"
       }
    }

App level capabilities:

  1. Config changes for the application

    Code Block
    languagejava