public void testCopy() { TagMap tags = new TagMap(); tags.put("tagkey", "tagval"); MetricMap metrics = new MetricMap(); metrics.put("metrickey", 123.4); OutputRecord r = new OutputRecord(tags, metrics); assertEquals(tags, r.getTagsCopy()); assertNotSame(tags, r.getTagsCopy()); assertEquals(metrics, r.getMetricsCopy()); assertNotSame(metrics, r.getMetricsCopy()); } }
public void init(String contextName, ContextFactory factory) { super.init(contextName, factory); parseAndSetPeriod(PERIOD_PROPERTY); }
public void init(String contextName, ContextFactory factory) { super.init(contextName, factory); parseAndSetPeriod(PERIOD_PROPERTY); }
/** * Stops monitoring and frees buffered data, returning this * object to its initial state. */ public synchronized void close() { stopMonitoring(); clearUpdaters(); }
/** * Returns a copy of this record's tags. */ public TagMap getTagsCopy() { return new TagMap(tagMap); }
/** * Starts or restarts monitoring, the emitting of metrics records. */ public synchronized void startMonitoring() throws IOException { if (!isMonitoring) { startTimer(); isMonitoring = true; } }
/** * Stops monitoring. This does not free buffered data. * @see #close() */ public synchronized void stopMonitoring() { if (isMonitoring) { stopTimer(); isMonitoring = false; } }
/** * Subclasses should override this if they subclass MetricsRecordImpl. * @param recordName the name of the record * @return newly created instance of MetricsRecordImpl or subclass */ protected MetricsRecord newRecord(String recordName) { return new MetricsRecordImpl(recordName, this); }
/** * Returns the metric object which can be a Float, Integer, Short or Byte. */ public Number getMetric(String name) { return metricMap.get(name); }
/** * Removes any tag of the specified name. */ public void removeTag(String tagName) { tagTable.remove(tagName); }
/** * Removes the row, if it exists, in the buffered data table having tags * that equal the tags that have been set on this record. */ public void remove() { context.remove(this); }
/** * Updates the table of buffered data which is to be sent periodically. * If the tag values match an existing row, that row is updated; * otherwise, a new row is added. */ public void update() { context.update(this); }
public void testCopy() { TagMap tags = new TagMap(); tags.put("tagkey", "tagval"); MetricMap metrics = new MetricMap(); metrics.put("metrickey", 123.4); OutputRecord r = new OutputRecord(tags, metrics); assertEquals(tags, r.getTagsCopy()); assertNotSame(tags, r.getTagsCopy()); assertEquals(metrics, r.getMetricsCopy()); assertNotSame(metrics, r.getMetricsCopy()); } }
/** * Stops monitoring and frees buffered data, returning this * object to its initial state. */ public synchronized void close() { stopMonitoring(); clearUpdaters(); }
/** * Returns a copy of this record's tags. */ public TagMap getTagsCopy() { return new TagMap(tagMap); }
/** * Starts or restarts monitoring, the emitting of metrics records. */ public synchronized void startMonitoring() throws IOException { if (!isMonitoring) { startTimer(); isMonitoring = true; } }
/** * Removes any tag of the specified name. */ public void removeTag(String tagName) { tagTable.remove(tagName); }
/** * Removes the row, if it exists, in the buffered data table having tags * that equal the tags that have been set on this record. */ public void remove() { context.remove(this); }
public void testCopy() { TagMap tags = new TagMap(); tags.put("tagkey", "tagval"); MetricMap metrics = new MetricMap(); metrics.put("metrickey", 123.4); OutputRecord r = new OutputRecord(tags, metrics); assertEquals(tags, r.getTagsCopy()); assertNotSame(tags, r.getTagsCopy()); assertEquals(metrics, r.getMetricsCopy()); assertNotSame(metrics, r.getMetricsCopy()); } }
/** * Returns a copy of this record's tags. */ public TagMap getTagsCopy() { return new TagMap(tagMap); }