Examples of MonitorConfig


Examples of com.netflix.servo.monitor.MonitorConfig

    private static final String JMX_DOMAIN_KEY = "JmxDomain";

    @Override
    public String getName(Metric metric) {
        MonitorConfig config = metric.getConfig();
        TagList tags = config.getTags();

        Tag domainTag = tags.getTag(JMX_DOMAIN_KEY);
        if (domainTag != null) { // jmx metric
            return handleJmxMetric(config, tags);
        } else {
View Full Code Here

Examples of com.netflix.servo.monitor.MonitorConfig

    private static final ObjectNameMapper DEFAULT_MAPPER = new DefaultObjectNameMapper();
    private static final String TEST_DOMAIN = "testDomain";

    @Test
    public void testStandardMapping() {
        MonitorConfig config = MonitorConfig.builder("testName").withTag("foo", "bar").build();
        ObjectName name = DEFAULT_MAPPER.createObjectName(TEST_DOMAIN, new BasicCounter(config));
        assertEquals(name.getDomain(), TEST_DOMAIN);
        assertEquals(name.getKeyPropertyListString(),
                String.format("name=testName,%s=COUNTER,foo=bar",
                        DataSourceType.KEY));
View Full Code Here

Examples of com.netflix.servo.monitor.MonitorConfig

        MonitorRegistry registry = new BasicMonitorRegistry();
        registry.register(Monitors.newCounter("test"));

        MetricPoller poller = new MonitorRegistryMetricPoller(registry);
        Metric metric = poller.poll(MATCH_ALL).get(0);
        MonitorConfig expected = MonitorConfig.builder("test")
            .withTag(DataSourceType.COUNTER)
            .build();
        assertEquals(metric.getConfig(), expected);
    }
View Full Code Here

Examples of com.netflix.servo.monitor.MonitorConfig

        // Verify we didn't wait too long, we should only wait 1 second but allow up to
        // 10 to make it less likely to have spurious test failures
        assertTrue(end - start < TEN_SECONDS);

        MonitorConfig expected = MonitorConfig.builder("test")
            .withTag(DataSourceType.COUNTER)
            .build();
        assertEquals(metric.getConfig(), expected);
    }
View Full Code Here

Examples of com.taobao.metamorphosis.tools.monitor.core.MonitorConfig

        }
    }


    public void initProbers(String source) throws InitException {
        this.monitorConfig = new MonitorConfig();
        try {
            this.monitorConfig.loadInis(StringUtils.isBlank(source) ? MonitorConfig.DEFAULT_CONFIG_FILE : source);
        }
        catch (IOException e) {
            throw new InitException(e);
View Full Code Here

Examples of com.taobao.metamorphosis.tools.monitor.core.MonitorConfig


    public static void main(String[] args) {

        MsgProber prober = null;
        MonitorConfig monitorConfig = new MonitorConfig();
        try {
            monitorConfig.loadInis("monitor.properties");
            CoreManager coreManager = CoreManager.getInstance(monitorConfig, 1);
            prober = new MsgProber(coreManager);
            prober.init();
        }
        catch (Throwable e) {
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.monitor.config.MonitorConfig

  {
    // Get new config reader
    MonitorConfigReader monitorConfigReader = new MonitorConfigReaderImpl();

    // Monitor config object which will be merged after all of the input parms are processed
    MonitorConfig monitorConfigFromArgs = null;

    // If no input arguments, then throw exception
    if (args.length == 0)
    {
      // ADD:
      throw new IllegalArgumentException(
        getMessage("usage01", Monitor.USAGE_MESSAGE));
    }

    // Parse the command line arguments to locate the config file option (if it was specified)
    for (int argCount = 0; argCount < args.length; argCount++)
    {
      // -configFile
      if ((args[argCount].equalsIgnoreCase("-config"))
        || (args[argCount].equals("-c")))
      {
        argCount++;
        monitorConfigFromArgs =
          monitorConfigReader.readMonitorConfig(args[argCount]);
      }
    }

    // If config file was not specified, then create analyzer config object
    if (monitorConfigFromArgs == null)
    {
      monitorConfigFromArgs = new MonitorConfigImpl();
      monitorConfigFromArgs.init(this.messageList);
    }

    // Parse all of the command line arguments
    for (int argCount = 0; argCount < args.length; argCount++)
    {
      // -configFile
      if ((args[argCount].equalsIgnoreCase("-config"))
        || (args[argCount].equals("-c")))
      {
        // Skip this option since it was already processed
        argCount++;
      }

      // -comment
      else if (
        (args[argCount].equalsIgnoreCase("-comment"))
          || (args[argCount].equals("-C")))
      {
        argCount++;
        Comment comment = new CommentImpl();
        comment.setText(args[argCount]);
        monitorConfigFromArgs.setComment(comment);
      }

      // -logFile
      else if (
        (args[argCount].equalsIgnoreCase("-logFile"))
          || (args[argCount].equals("-l")))
      {
        argCount++;
        monitorConfigFromArgs.setLogLocation(args[argCount]);
      }

      // -replace
      else if (
        (args[argCount].equalsIgnoreCase("-replace"))
          || (args[argCount].equals("-r")))
      {
        argCount++;
        monitorConfigFromArgs.setReplaceLog(
          Boolean.valueOf(args[argCount]).booleanValue());
      }

      // -logDuration
      else if (
        (args[argCount].equalsIgnoreCase("-logDuration"))
          || (args[argCount].equals("-d")))
      {
        argCount++;
        monitorConfigFromArgs.setLogDuration(
          Integer.valueOf(args[argCount]).intValue());
      }

      // -timeout
      else if (
        (args[argCount].equalsIgnoreCase("-timeout"))
          || (args[argCount].equals("-t")))
      {
        argCount++;
        monitorConfigFromArgs.setTimeout(
          Integer.valueOf(args[argCount]).intValue());
      }

      // -manInTheMiddle
      else if (
        (args[argCount].equalsIgnoreCase("-manInTheMiddle"))
          || (args[argCount].equals("-m")))
      {
        ManInTheMiddle manInTheMiddle = null;

        // Increment arg count
        argCount++;

        // Get the man-in-the-middle object
        if ((manInTheMiddle = monitorConfigFromArgs.getManInTheMiddle())
          == null)
          manInTheMiddle = new ManInTheMiddleImpl();

        // ADD: Check for correct number of remaining args

        // Create redirect
        Redirect redirect = new RedirectImpl();

        // Get the redirect values
        redirect.setListenPort(Integer.valueOf(args[argCount++]).intValue());
        redirect.setHost(args[argCount++]);
        redirect.setMaxConnections(
          Integer.valueOf(args[argCount++]).intValue());
        redirect.setReadTimeoutSeconds(
          Integer.valueOf(args[argCount++]).intValue());

        // Add redirect
        manInTheMiddle.addRedirect(redirect);

        // Set the man-in-the-middle
        monitorConfigFromArgs.setManInTheMiddle(manInTheMiddle);
      }

      // -verbose
      else if (
        (args[argCount].equalsIgnoreCase("-verbose"))
          || (args[argCount].equals("-v")))
      {
        argCount++;
        //monitorConfigFromArgs.setVerboseOption(Boolean.valueOf(args[argCount]).booleanValue());
        monitorConfigFromArgs.setVerboseOption(true);
      }

      // -GUI
      else if (args[argCount].equalsIgnoreCase("-GUI"))
      {
        // Ignore -GUI option
      }

      else
      {
        throw new IllegalArgumentException(
          getMessage(
            "config01",
            args[argCount],
            "The specified option is not supported."));
      }
    }

    // If addStyleSheet was not specified, then create a comment version of it
    if (monitorConfigFromArgs.getAddStyleSheet() == null)
    {
      AddStyleSheet addStyleSheet = new AddStyleSheetImpl();
      addStyleSheet.setHref(WSIConstants.DEFAULT_LOG_XSL);
      addStyleSheet.setType(WSIConstants.DEFAULT_XSL_TYPE);
      addStyleSheet.setComment(true);
      monitorConfigFromArgs.setAddStyleSheet(addStyleSheet);
    }

    // Merge config info into this object
    setConfig(monitorConfigFromArgs);
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.monitor.config.MonitorConfig

  /* (non-Javadoc)
   * @see org.wsi.test.monitor.config.MonitorConfigReader#readMonitorConfig(Reader)
   */
  public MonitorConfig readMonitorConfig(Reader reader) throws WSIException
  {
    MonitorConfig monitorConfig = new MonitorConfigImpl();

    // Parse XML
    Document doc = XMLUtils.parseXML(reader);

    // Parse elements in the config document
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.monitor.config.MonitorConfig

    {
      // Tool information
      ToolInfo toolInfo = new ToolInfo(TOOL_NAME, TOOL_VERSION, TOOL_RELEASE_DATE, TOOL_IMPLEMENTER, TOOL_LOCATION);

      DocumentFactory documentFactory = DocumentFactory.newInstance();
      MonitorConfig monitorConfig = documentFactory.newMonitorConfig();
   
      Comment comment = new CommentImpl();
      comment.setText("Comment");
      monitorConfig.setComment(comment);
      monitorConfig.setLogLocation("URL");
      monitorConfig.setReplaceLog(true);

      AddStyleSheet addStyleSheet = new AddStyleSheetImpl();
      monitorConfig.setAddStyleSheet(addStyleSheet);

      monitorConfig.setLogDuration(600);
      monitorConfig.setTimeout(3);
    
      ManInTheMiddle manInTheMiddle = new ManInTheMiddleImpl();
      monitorConfig.setManInTheMiddle(manInTheMiddle);

      monitorConfig.setLocation("documentURI");
      monitorConfig.setVerboseOption(false);

      // Start    
      pw.print(toolInfo.getStartXMLString(""));
   
      // Config
      pw.print(monitorConfig.toXMLString(WSIConstants.NS_NAME_WSI_MONITOR_CONFIG));

      // End
      pw.println(toolInfo.getEndXMLString(""));
    }
    catch (Exception e)
View Full Code Here

Examples of org.geoserver.monitor.MonitorConfig

    @BeforeClass
    public static void setUpData() throws Exception {
        MonitorDAO dao = new MemoryMonitorDAO();
        new MonitorTestData(dao).setup();
       
        MonitorConfig mc = new MonitorConfig() {
           
            @Override
            public MonitorDAO createDAO() {
                MonitorDAO dao = new MemoryMonitorDAO();
                try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.