@Override protected MetricsInfo newValue(String name, String desc) { return new MetricsInfoImpl(name, desc); } };
/** * Create a mutable long integer counter * @param name of the metric * @param desc metric description * @param iVal initial value * @return a new counter object */ public MutableFastCounter newCounter(String name, String desc, long iVal) { return newCounter(new MetricsInfoImpl(name, desc), iVal); }
/** * Create a mutable long integer gauge * @param name of the metric * @param desc metric description * @param iVal initial value * @return a new gauge object */ public MutableGaugeLong newGauge(String name, String desc, long iVal) { return newGauge(new MetricsInfoImpl(name, desc), iVal); }
/** * Add a tag to the metrics * @param name of the tag * @param description of the tag * @param value of the tag * @param override existing tag if true * @return the registry (for keep adding tags) */ public DynamicMetricsRegistry tag(String name, String description, String value, boolean override) { return tag(new MetricsInfoImpl(name, description), value, override); }
public MutableHistogram getHistogram(String histoName) { //See getGauge for description on how this works. MutableMetric histo = metricsMap.get(histoName); if (histo == null) { MutableHistogram newCounter = new MutableHistogram(new MetricsInfoImpl(histoName, "")); histo = metricsMap.putIfAbsent(histoName, newCounter); if (histo == null) { return newCounter; } } if (!(histo instanceof MutableHistogram)) { throw new MetricsException("Metric already exists in registry for metric name: " + histoName + " and not of type MutableHistogram"); } return (MutableHistogram) histo; }
/** * Get a MetricMutableCounterLong from the storage. If it is not there atomically put it. * * @param counterName Name of the counter to get * @param potentialStartingValue starting value if we have to create a new counter */ public MutableFastCounter getCounter(String counterName, long potentialStartingValue) { //See getGauge for description on how this works. MutableMetric counter = metricsMap.get(counterName); if (counter == null) { MutableFastCounter newCounter = new MutableFastCounter(new MetricsInfoImpl(counterName, ""), potentialStartingValue); counter = metricsMap.putIfAbsent(counterName, newCounter); if (counter == null) { return newCounter; } } if (!(counter instanceof MutableCounter)) { throw new MetricsException("Metric already exists in registry for metric name: " + counterName + " and not of type MutableCounter"); } return (MutableFastCounter) counter; }
/** * Get a MetricMutableGaugeLong from the storage. If it is not there atomically put it. * * @param gaugeName name of the gauge to create or get. * @param potentialStartingValue value of the new gauge if we have to create it. */ public MutableGaugeLong getGauge(String gaugeName, long potentialStartingValue) { //Try and get the guage. MutableMetric metric = metricsMap.get(gaugeName); //If it's not there then try and put a new one in the storage. if (metric == null) { //Create the potential new gauge. MutableGaugeLong newGauge = new MutableGaugeLong(new MetricsInfoImpl(gaugeName, ""), potentialStartingValue); // Try and put the gauge in. This is atomic. metric = metricsMap.putIfAbsent(gaugeName, newGauge); //If the value we get back is null then the put was successful and we will return that. //otherwise gaugeLong should contain the thing that was in before the put could be completed. if (metric == null) { return newGauge; } } if (!(metric instanceof MutableGaugeLong)) { throw new MetricsException("Metric already exists in registry for metric name: " + gaugeName + " and not of type MetricMutableGaugeLong"); } return (MutableGaugeLong) metric; }
@Override protected MetricsInfo newValue(String name, String desc) { return new MetricsInfoImpl(name, desc); } };
@Override protected MetricsInfo newValue(String name, String desc) { return new MetricsInfoImpl(name, desc); } };
@Override protected MetricsInfo newValue(String name, String desc) { return new MetricsInfoImpl(name, desc); } };
@Override protected MetricsInfo newValue(String name, String desc) { return new MetricsInfoImpl(name, desc); } };
/** * Add a tag to the metrics * @param name of the tag * @param description of the tag * @param value of the tag * @param override existing tag if true * @return the registry (for keep adding tags) */ public DynamicMetricsRegistry tag(String name, String description, String value, boolean override) { return tag(new MetricsInfoImpl(name, description), value, override); }
/** * Create a mutable long integer counter * @param name of the metric * @param desc metric description * @param iVal initial value * @return a new counter object */ public MutableFastCounter newCounter(String name, String desc, long iVal) { return newCounter(new MetricsInfoImpl(name, desc), iVal); }
/** * Create a mutable long integer counter * @param name of the metric * @param desc metric description * @param iVal initial value * @return a new counter object */ public MutableFastCounter newCounter(String name, String desc, long iVal) { return newCounter(new MetricsInfoImpl(name, desc), iVal); }
/** * Create a mutable long integer gauge * @param name of the metric * @param desc metric description * @param iVal initial value * @return a new gauge object */ public MutableGaugeLong newGauge(String name, String desc, long iVal) { return newGauge(new MetricsInfoImpl(name, desc), iVal); }
/** * Create a mutable long integer gauge * @param name of the metric * @param desc metric description * @param iVal initial value * @return a new gauge object */ public MutableGaugeLong newGauge(String name, String desc, long iVal) { return newGauge(new MetricsInfoImpl(name, desc), iVal); }
/** * Add a tag to the metrics * @param name of the tag * @param description of the tag * @param value of the tag * @param override existing tag if true * @return the registry (for keep adding tags) */ public DynamicMetricsRegistry tag(String name, String description, String value, boolean override) { return tag(new MetricsInfoImpl(name, description), value, override); }
/** * Create a mutable long integer counter * @param name of the metric * @param desc metric description * @param iVal initial value * @return a new counter object */ public MutableCounterLong newCounter(String name, String desc, long iVal) { return newCounter(new MetricsInfoImpl(name, desc), iVal); }
/** * Create a mutable long integer gauge * @param name of the metric * @param desc metric description * @param iVal initial value * @return a new gauge object */ public MutableGaugeLong newGauge(String name, String desc, long iVal) { return newGauge(new MetricsInfoImpl(name, desc), iVal); }
/** * Add a tag to the metrics * @param name of the tag * @param description of the tag * @param value of the tag * @param override existing tag if true * @return the registry (for keep adding tags) */ public DynamicMetricsRegistry tag(String name, String description, String value, boolean override) { return tag(new MetricsInfoImpl(name, description), value, override); }