Class TelemetryGenerator


  • public class TelemetryGenerator
    extends Object
    TelemetryGenerator uses context and other parameters to generate event JSON in string format.
    Author:
    Mahesh
    • Constructor Detail

      • TelemetryGenerator

        public TelemetryGenerator()
    • Method Detail

      • setComponent

        public static void setComponent​(String component)
      • access

        public static String access​(Map<String,​String> context,
                                    Map<String,​Object> params)
        To generate api_access LOG telemetry JSON string.
        Parameters:
        context - context of the event
        params - params of the event
        Returns:
        String event in JSON fromat
      • log

        public static String log​(Map<String,​String> context,
                                 String type,
                                 String level,
                                 String message,
                                 String pageid,
                                 Map<String,​Object> params)
        To generate normal LOG telemetry JSON string with all params.
        Parameters:
        context - context of the event
        type - type of the event
        level - log level of the event
        message - message of the event
        pageid - page id of the event
        params - params of the event
        Returns:
        String event string in JSON format.
      • log

        public static String log​(Map<String,​String> context,
                                 String type,
                                 String level,
                                 String message)
        To generate normal LOG telemetry JSON string with required params.
        Parameters:
        context - context of the event
        type - type of the event
        level - log level of the event
        message - message of the event
        Returns:
        String event string in JSON format.
      • error

        public static String error​(Map<String,​String> context,
                                   String code,
                                   String type,
                                   String stacktrace,
                                   String pageid,
                                   Object object)
        To generate ERROR telemetry JSON string with all params.
        Parameters:
        context - context of the event
        code - code of the event
        type - type of the event
        stacktrace - stacktrace of the exception
        pageid - page id
        object - object of the event
        Returns:
        String event string in JSON format.
      • error

        public static String error​(Map<String,​String> context,
                                   String code,
                                   String type,
                                   String stacktrace)
        To generate ERROR telemetry JSON string with required params.
        Parameters:
        context - context of the event
        code - code of the event
        type - type of the event
        stacktrace - stacktrace of the exception.
        Returns:
        String event string in JSON format.
      • search

        public static String search​(Map<String,​String> context,
                                    String query,
                                    Object filters,
                                    Object sort,
                                    List<Map<String,​Object>> cData,
                                    int size,
                                    Object topN,
                                    String type)
        Parameters:
        context - context of the event
        query - query of the search
        filters - filters for search
        sort - sort value for search
        cData - cData of the event
        size - size of the search result
        topN - top N results
        type - type of the event
        Returns:
        String event string in JSON format
      • audit

        public static String audit​(Map<String,​String> context,
                                   List<String> props,
                                   String state,
                                   String prevState,
                                   List<Map<String,​Object>> cdata)
        Parameters:
        context - context of the event
        props - props of the event
        state - state of the event
        prevState - prevState of the object in event
        cdata - cData of the event
        Returns:
        String event string in JSON format
      • audit

        public static String audit​(Map<String,​String> context,
                                   List<String> props,
                                   String state,
                                   String prevState)
        Parameters:
        context - context of the event
        props - props of the event
        state - state of the event
        prevState - prevState of the event
        Returns:
        String event string in JSON format.