@Override public String name() { return delegate.name(); }
@Override public void putMetrics(MetricsRecord record) { writer.print(record.timestamp()); writer.print(" "); writer.print(record.context()); writer.print("."); writer.print(record.name()); String separator = ": "; for (MetricsTag tag : record.tags()) { writer.print(separator); separator = ", "; writer.print(tag.name()); writer.print("="); writer.print(tag.value()); } for (AbstractMetric metric : record.metrics()) { writer.print(separator); separator = ", "; writer.print(metric.name()); writer.print("="); writer.print(metric.value()); } writer.println(); }
/** * Whether to accept the record * @param record to filter on * @return true to accept; false otherwise. */ public boolean accepts(MetricsRecord record) { return accepts(record.name()) && accepts(record.tags()); }
.append(record.context()).append(".").append(record.name());
@Override public boolean equals(Object obj) { if (obj instanceof MetricsRecord) { final MetricsRecord other = (MetricsRecord) obj; return Objects.equal(timestamp(), other.timestamp()) && Objects.equal(name(), other.name()) && Objects.equal(description(), other.description()) && Objects.equal(tags(), other.tags()) && Iterables.elementsEqual(metrics(), other.metrics()); } return false; }
buf.append(record.name().replaceAll("\\.", "-")).append(PERIOD);
/** * Update the cache and return the current cached record * @param mr the update record * @param includingTags cache tag values (for later lookup by name) if true * @return the updated cache record */ public Record update(MetricsRecord mr, boolean includingTags) { String name = mr.name(); RecordCache recordCache = map.get(name); if (recordCache == null) { recordCache = new RecordCache(); map.put(name, recordCache); } Collection<MetricsTag> tags = mr.tags(); Record record = recordCache.get(tags); if (record == null) { record = new Record(); recordCache.put(tags, record); } for (AbstractMetric m : mr.metrics()) { record.metrics.put(m.name(), m); } if (includingTags) { // mostly for some sinks that include tags as part of a dense schema for (MetricsTag t : mr.tags()) { record.tags.put(t.name(), t.value()); } } return record; }
String recordName = record.name(); String contextName = record.context();
record.context(), record.name());
@Override public void putMetrics(MetricsRecord metricsRecord) { if (metricsRecord.name().equals(PHOENIX_METRICS_RECORD_NAME)) { synchronized (GlobalPhoenixMetricsTestSink.lock) { GlobalPhoenixMetricsTestSink.metrics = metricsRecord.metrics(); } } }
@Override public void putMetrics(MetricsRecord record) { // we could wait until flush, but this is a really lightweight process, so we just write // them // as soon as we get them if (!LOG.isDebugEnabled()) { return; } LOG.debug("Found record:" + record.name()); for (AbstractMetric metric : record.metrics()) { // just print the metric we care about if (metric.name().startsWith(TracingUtils.METRIC_SOURCE_KEY)) { LOG.debug("\t metric:" + metric); } } }
/** * Whether to accept the record * @param record to filter on * @return true to accept; false otherwise. */ public boolean accepts(MetricsRecord record) { return accepts(record.name()) && accepts(record.tags()); }
/** * Whether to accept the record * @param record to filter on * @return true to accept; false otherwise. */ public boolean accepts(MetricsRecord record) { return accepts(record.name()) && accepts(record.tags()); }
/** * Whether to accept the record * @param record to filter on * @return true to accept; false otherwise. */ public boolean accepts(MetricsRecord record) { return accepts(record.name()) && accepts(record.tags()); }
private MetricsRecord makeRecord(String name, Collection<MetricsTag> tags, Collection<AbstractMetric> metrics) { MetricsRecord mr = mock(MetricsRecord.class); when(mr.name()).thenReturn(name); when(mr.tags()).thenReturn(tags); when(mr.metrics()).thenReturn(metrics); return mr; }
private MetricsRecord makeRecord(String name, Collection<MetricsTag> tags, Collection<AbstractMetric> metrics) { MetricsRecord mr = mock(MetricsRecord.class); when(mr.name()).thenReturn(name); when(mr.tags()).thenReturn(tags); when(mr.metrics()).thenReturn(metrics); return mr; }
@Override public boolean equals(Object obj) { if (obj instanceof MetricsRecord) { final MetricsRecord other = (MetricsRecord) obj; return Objects.equal(timestamp(), other.timestamp()) && Objects.equal(name(), other.name()) && Objects.equal(description(), other.description()) && Objects.equal(tags(), other.tags()) && Iterables.elementsEqual(metrics(), other.metrics()); } return false; }
@Override public boolean equals(Object obj) { if (obj instanceof MetricsRecord) { final MetricsRecord other = (MetricsRecord) obj; return Objects.equal(timestamp(), other.timestamp()) && Objects.equal(name(), other.name()) && Objects.equal(description(), other.description()) && Objects.equal(tags(), other.tags()) && Iterables.elementsEqual(metrics(), other.metrics()); } return false; }
@Override public boolean equals(Object obj) { if (obj instanceof MetricsRecord) { final MetricsRecord other = (MetricsRecord) obj; return Objects.equal(timestamp(), other.timestamp()) && Objects.equal(name(), other.name()) && Objects.equal(description(), other.description()) && Objects.equal(tags(), other.tags()) && Iterables.elementsEqual(metrics(), other.metrics()); } return false; }