Package com.codahale.metrics

Examples of com.codahale.metrics.Gauge


                    2 * histograms.size() + 2 * timers.size()); // something like that


            for (Map.Entry<String, Gauge> gaugeEntry : gauges.entrySet()) {
                DemuxedKey key = new DemuxedKey(gaugeEntry.getKey());
                Gauge gauge = gaugeEntry.getValue();

                Object valueObj = gauge.getValue();
                if (valueObj == null) {
                    continue;
                }

                String valueStr = valueObj.toString();
View Full Code Here


            List<MetricDatum> data = new ArrayList<MetricDatum>(gauges.size() + counters.size() + histograms.size() +
                    meters.size() + timers.size()); // something like that

            for (Map.Entry<String, Gauge> gaugeEntry : gauges.entrySet()) {
                DemuxedKey key = new DemuxedKey(gaugeEntry.getKey());
                Gauge gauge = gaugeEntry.getValue();
                Object valueObj = gauge.getValue();
                if (valueObj == null) {
                    continue;
                }

                String valueStr = valueObj.toString();
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void aGaugeAnnotatedMethodWithDefaultName() throws Exception {
        instance.doAnotherThing();

        final Gauge metric = registry.getGauges().get(name(InstrumentedWithGauge.class,
                                                                       "doAnotherThing", GaugeListener.GAUGE_SUFFIX));

        assertThat("Guice creates a metric",
                   metric,
                   is(notNullValue()));
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void aGaugeAnnotatedMethodWithAbsoluteName() throws Exception {
        instance.doAThingWithAbsoluteName();

        final Gauge metric = registry.getGauges().get(name("absoluteName"));

        assertThat("Guice creates a metric",
                   metric,
                   is(notNullValue()));
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void aGaugeAnnotatedMethod() throws Exception {
        instance.doAThing();

        final Gauge metric = registry.getGauges().get(name(InstrumentedWithGauge.class, "things"));

        assertThat("Guice creates a metric",
                   metric,
                   is(notNullValue()));
View Full Code Here

     * @param name counter name.
     * @param variable variable to add.
     */
    @Override
    public void addVariable(String group, String name, final Variable variable) {
        Gauge gauge = new Gauge() {
            @Override
            public Object getValue() {
                return variable.getValue();
            }
        };
View Full Code Here

  private boolean methodTakesNoParamsAndIsNonVoid(Method method) {
    return method.getGenericParameterTypes().length == 0 && method.getReturnType() != Void.class;
  }

  private void registerGauge(final Object object, final Method method, final String signature) {
    registry.register(name("gauge", signature), new Gauge() {
      @Override
      public Object getValue() {
        try {
          return method.invoke(object);
        } catch (Exception e) {
View Full Code Here

        }
    }


    void reportGauge(Map.Entry<String, Gauge> gaugeEntry, String type, List<MetricDatum> data) {
        Gauge gauge = gaugeEntry.getValue();

        Object valueObj = gauge.getValue();
        if (valueObj == null) {
            return;
        }

        String valueStr = valueObj.toString();
View Full Code Here

        }
    }


    void reportGauge(Map.Entry<String, Gauge> gaugeEntry, String type, List<MetricDatum> data) {
        Gauge gauge = gaugeEntry.getValue();

        Object valueObj = gauge.getValue();
        if (valueObj == null) {
            return;
        }

        String valueStr = valueObj.toString();
View Full Code Here

        }
    }


    void reportGauge(Map.Entry<String, Gauge> gaugeEntry, String type, List<MetricDatum> data) {
        Gauge gauge = gaugeEntry.getValue();

        Object valueObj = gauge.getValue();
        if (valueObj == null) {
            return;
        }

        String valueStr = valueObj.toString();
View Full Code Here

TOP

Related Classes of com.codahale.metrics.Gauge

Copyright © 2018 www.massapicom. 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.