Examples of Metrics


Examples of org.mcstats.Metrics

      }
      if (War.war.getWarzones().size() > 0) {
        War.war.log("Warzones ready.", Level.INFO);
        final int zones = War.war.getWarzones().size();
        try {
          Metrics metrics = new Metrics(War.war);
          Graph warzoneCount = metrics.createGraph("Warzones");
          warzoneCount.addPlotter(new FixedPlotter("Count", zones));
          Graph language = metrics.createGraph("Language");
          String langName = War.war.getLoadedLocale().getDisplayLanguage(Locale.ENGLISH);
          if (langName.isEmpty()) {
            langName = "English";
          }
          language.addPlotter(new PlotterEnabled(langName));
          Graph plugins = metrics.createGraph("Extensions");
          if (War.war.isSpoutServer()) {
            plugins.addPlotter(new PlotterEnabled("Spout"));
          }
          if (War.war.isTagServer()) {
            plugins.addPlotter(new PlotterEnabled("TagAPI"));
          }
          if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
            plugins.addPlotter(new PlotterEnabled("WorldEdit"));
          }
          plugins.addPlotter(new PlotterEnabled("War")); // of course
          metrics.start();
        } catch (IOException ignored) {
        }
      }
    }
  }
View Full Code Here

Examples of org.mcstats.Metrics

        }
    }

    private void setupMetrics() {
        try {
            Metrics m = new Metrics(this);

            Metrics.Graph envGraph = m.createGraph("worlds_by_env");
            for (Environment env : Environment.values())
                envGraph.addPlotter(new EnvironmentPlotter(this, env));

            m.addCustomData(new Metrics.Plotter("Loaded worlds") {
                @Override
                public int getValue() {
                    return getMVWorldManager().getMVWorlds().size();
                }
            });
            m.addCustomData(new Metrics.Plotter("Total number of worlds") {
                @Override
                public int getValue() {
                    return getMVWorldManager().getMVWorlds().size()
                            + getMVWorldManager().getUnloadedWorlds().size();
                }
            });

            Set<String> gens = new HashSet<String>();
            for (MultiverseWorld w : this.getMVWorldManager().getMVWorlds())
                gens.add(w.getGenerator());
            gens.remove(null);
            gens.remove("null");
            Metrics.Graph genGraph = m.createGraph("custom_gens");
            for (String gen : gens)
                genGraph.addPlotter(new GeneratorPlotter(this, gen));

            m.start();
            log(Level.FINE, "Metrics have run!");
        } catch (IOException e) {
            log(Level.WARNING, "There was an issue while enabling metrics: " + e.getMessage());
        }
    }
View Full Code Here

Examples of org.mcstats.Metrics

  protected PieChartGraph playedMapsTracker = null;

  private void setupPluginMetrics()
    throws IOException
  {
    Metrics metrics = new Metrics(this);

    Set<String> mapNames = Sets.newHashSet();
    for (AutoRefMap map : AutoRefMap.getRemoteMaps())
      mapNames.add(map.getName());

    Graph gMaps = metrics.createGraph("Most Popular Maps");
    playedMapsTracker = new PieChartGraph(gMaps, mapNames);

    metrics.start();
  }
View Full Code Here

Examples of org.mcstats.Metrics

        server.getScheduler().runTaskTimerAsynchronously(this, runnable, startTime, repetitionTime);
    }

    private void startStatistics() {
        try {
            new Metrics(this).start();
        } catch (IOException ex) {
            ChestShop.getBukkitLogger().severe("There was an error while submitting statistics.");
        }
    }
View Full Code Here

Examples of org.mcstats.Metrics

    public PermissionsMetrics(PermissionsPlugin plugin) {
        this.plugin = plugin;
    }

    public void start() throws IOException {
        metrics = new Metrics(plugin);

        // don't bother with the rest if it's off
        if (metrics.isOptOut()) return;

        setupFeaturesUsed();
View Full Code Here

Examples of org.sonar.api.measures.Metrics

    for (Metric metric : metrics.getMetrics()) {
      String metricKey = metric.getKey();
      if (CoreMetrics.getMetrics().contains(metric)) {
        throw new IllegalStateException("The following metric is already defined in sonar: " + metricKey);
      }
      Metrics anotherRepository = metricsByRepository.get(metricKey);
      if (anotherRepository != null) {
        throw new IllegalStateException("The metric '" + metricKey + "' is already defined in the extension: " + anotherRepository);
      }
      metricsByRepository.put(metricKey, metrics);
    }
View Full Code Here

Examples of org.sonar.api.measures.Metrics

    checkTables("shouldUpdateIfAlreadyExists", "metrics");
  }

  @Test
  public void shouldAddUserManagesMetric() {
    Metrics metrics = mock(Metrics.class);
    when(metrics.getMetrics()).thenReturn(Lists.<Metric>newArrayList(new Metric.Builder("key", "new short name", Metric.ValueType.FLOAT)
      .setDescription("new description")
      .setDirection(-1)
      .setQualitative(true)
      .setDomain("new domain")
      .setUserManaged(true)
View Full Code Here

Examples of org.sonar.api.measures.Metrics

  @Test
  public void shouldNotUpdateUserManagesMetricIfAlreadyExists() {
    setupData("shouldNotUpdateUserManagesMetricIfAlreadyExists");

    Metrics metrics = mock(Metrics.class);
    when(metrics.getMetrics()).thenReturn(Lists.<Metric>newArrayList(new Metric.Builder("key", "new short name", Metric.ValueType.FLOAT)
      .setDescription("new description")
      .setDirection(-1)
      .setQualitative(true)
      .setDomain("new domain")
      .setUserManaged(true)
View Full Code Here

Examples of org.sonar.api.measures.Metrics

    assertThat(metrics).onProperty("key").contains("ncloc");
  }

  @Test
  public void should_provide_plugin_metrics() {
    Metrics factory = new Metrics() {
      public List<Metric> getMetrics() {
        return Arrays.<Metric>asList(new Metric.Builder("custom", "Custom", Metric.ValueType.FLOAT).create());
      }
    };
    MetricProvider provider = new MetricProvider(new Metrics[] {factory});
View Full Code Here

Examples of org.springframework.data.geo.Metrics

   */
  private void extractDistanceString(Distance distance, StringBuilder sb) {
    // handle Distance object
    sb.append((int) distance.getValue());

    Metrics metric = (Metrics) distance.getMetric();

    switch (metric) {
      case KILOMETERS:
        sb.append("km");
        break;
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.