use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class OpenTSDBDecoderTest method testOpenTSDBCharacters.
@Test
public void testOpenTSDBCharacters() {
List<String> customSourceTags = new ArrayList<>();
customSourceTags.add("fqdn");
OpenTSDBDecoder decoder = new OpenTSDBDecoder("localhost", customSourceTags);
List<ReportPoint> out = new ArrayList<>();
decoder.decodeReportPoints("put tsdb.vehicle.charge.battery_level 12345.678 93.123e3 host=/vehicle_2554-test/GOOD some_tag=/vehicle_2554-test/BAD", out);
ReportPoint point = out.get(0);
assertEquals("dummy", point.getTable());
assertEquals("tsdb.vehicle.charge.battery_level", point.getMetric());
assertEquals(93123.0, point.getValue());
assertEquals(12345678L, point.getTimestamp().longValue());
assertEquals("/vehicle_2554-test/GOOD", point.getHost());
assertEquals("/vehicle_2554-test/BAD", point.getAnnotations().get("some_tag"));
}
use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class GraphiteDecoder method decodeReportPoints.
@Override
public void decodeReportPoints(String msg, List<ReportPoint> out) {
List<ReportPoint> output = Lists.newArrayList();
decodeReportPoints(msg, output, "dummy");
if (!output.isEmpty()) {
for (ReportPoint rp : output) {
String metricName = rp.getMetric();
List<String> metricParts = Lists.newArrayList(Splitter.on(".").split(metricName));
if (metricParts.size() <= 1) {
throw new RuntimeException("Metric name does not contain a customer id: " + metricName);
}
String customerId = metricParts.get(0);
if (CUSTOMERID.matcher(customerId).matches()) {
metricName = Joiner.on(".").join(metricParts.subList(1, metricParts.size()));
}
out.add(ReportPoint.newBuilder(rp).setMetric(metricName).setTable(customerId).build());
}
}
}
use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class TapeDispatcher method run.
@Override
public void run() {
for (Utils.HistogramKey key : digests.keySet()) {
digests.compute(key, (k, v) -> {
if (v == null) {
return null;
}
// Remove and add to shipping queue
if (v.getDispatchTimeMillis() < clock.millisSinceEpoch()) {
try {
ReportPoint out = Utils.pointFromKeyAndDigest(k, v);
output.add(out);
dispatchCounter.inc();
} catch (Exception e) {
logger.log(Level.SEVERE, "Failed dispatching entry " + k, e);
}
return null;
}
return v;
});
}
}
use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class GraphiteDecoderTest method testBenchmark.
@Ignore
@Test
public void testBenchmark() throws Exception {
List<String> customSourceTags = new ArrayList<String>();
customSourceTags.add("fqdn");
customSourceTags.add("hostname");
customSourceTags.add("highcardinalitytag1");
customSourceTags.add("highcardinalitytag2");
customSourceTags.add("highcardinalitytag3");
customSourceTags.add("highcardinalitytag4");
customSourceTags.add("highcardinalitytag5");
GraphiteDecoder decoder = new GraphiteDecoder("localhost", emptyCustomSourceTags);
int ITERATIONS = 1000000;
for (int i = 0; i < ITERATIONS / 1000; i++) {
List<ReportPoint> out = new ArrayList<>();
decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level 93 123456 highcardinalitytag5=vehicle_2554", out);
}
long start = System.currentTimeMillis();
for (int i = 0; i < ITERATIONS; i++) {
List<ReportPoint> out = new ArrayList<>();
decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level 93 123456 highcardinalitytag5=vehicle_2554", out);
}
double end = System.currentTimeMillis();
System.out.println(ITERATIONS / ((end - start) / 1000) + " DPS");
}
use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class GraphiteDecoderTest method testTagVWithDigitAtBeginning.
@Test
public void testTagVWithDigitAtBeginning() throws Exception {
GraphiteDecoder decoder = new GraphiteDecoder("localhost", emptyCustomSourceTags);
List<ReportPoint> out = new ArrayList<>();
decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level 93 host=vehicle_2554 version=1_0", out);
ReportPoint point = out.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("vehicle.charge.battery_level", point.getMetric());
assertEquals(93.0, point.getValue());
assertEquals("vehicle_2554", point.getHost());
assertEquals("1_0", point.getAnnotations().get("version"));
}
Aggregations