Class MdxEventFormatter


  • public class MdxEventFormatter
    extends Object
    An utility which help to retrieve Mdx based information from a monitor and an event. This can work only for KPI type monitors. TODO: Reuse those constants from AP/MDx Classes
    Author:
    QuartetFS
    • Constructor Detail

      • MdxEventFormatter

        public MdxEventFormatter​(com.qfs.snl.agent.IAgentService agentService)
        Constructor
        Parameters:
        agentService - the service which can retrieve agent informations.
    • Method Detail

      • getMdxQuery

        public String getMdxQuery​(com.qfs.snl.monitors.IMonitor monitor,
                                  com.qfs.snl.data.ISentinelEvent event)
        Creates a MDX query displaying the given event.
        Parameters:
        monitor - the monitor owning the event
        event - the event to explore
        Returns:
        the MDX query displaying the event
      • escapeMdxQuery

        public String escapeMdxQuery​(String query)
        Escapes a MDX query for inclusion in Angular.

        This prepares the query to be embedded into an HTML attribute. It also modify the query not to conflict with Angular processing, particularly {{...}}.

        Parameters:
        query - query to escape
        Returns:
        escaped value
      • getAgent

        public com.qfs.snl.agent.IAgentDescription getAgent​(com.qfs.snl.monitors.IMonitor monitor)
                                                     throws com.quartetfs.fwk.QuartetRuntimeException
        Retrieve the agent description on which the given monitor is registered.
        Parameters:
        monitor - monitor to inspect
        Returns:
        the description of the agent
        Throws:
        com.quartetfs.fwk.QuartetRuntimeException - if the agent can not be retrieved
      • getLiveUrl

        public String getLiveUrl​(com.qfs.snl.monitors.IMonitor monitor)
        Retrieve the live url that can connect to the site on which the given monitor is registered.
        Parameters:
        monitor - monitor to inspect
        Returns:
        the live url or null if none is configured for this monitor site
      • formatMember

        public String formatMember​(String levelPath,
                                   String memberPath)
        Parameters:
        levelPath - the level unique name as [dim].[hier].[level]
        memberPath - the member unique name
        Returns:
        short name of the member without repeating the hierarchy and level information
      • monitorPath

        public String monitorPath​(String site,
                                  long id)
        Get the monitor path from its site and its id.
        Parameters:
        site - on which the monitor applies
        id - of the monitor
        Returns:
        url path to the monitor
      • getContextValues

        public Map<String,​String> getContextValues​(com.qfs.snl.monitors.IMonitor monitor,
                                                         com.qfs.snl.data.ISentinelEvent event)
        Retrieve the actual context values from the given monitor and event. We handle only KPI type monitor
        Parameters:
        monitor - the monitor
        event - the ActiveMonitor event
        Returns:
        map of context values
      • isEpoch

        public boolean isEpoch​(com.qfs.snl.data.ISentinelState state)