@Test public void writeNumericResult() throws IOException { StatsDWriter2 writer = new StatsDWriter2(ImmutableList.<String>of(), "root", "c", false, 1L, "_"); StringWriter out = new StringWriter(); writer.write(out, dummyServer(), dummyQuery(), singleNumericResult()); assertThat(out.toString()) .isEqualTo("root.host_example_net_4321.MemoryAlias.ObjectPendingFinalizationCount:10|c\n"); }
@Override public void write(@Nonnull Writer writer, @Nonnull Server server, @Nonnull Query query, @Nonnull Iterable<Result> results) throws IOException { for (Result result : results) { String key = KeyUtils.getKeyString(server, query, result, typeNames, rootPrefix); if (isNotValidValue(result.getValue())) { log.debug("Skipping message key[{}] with value: {}.", key, result.getValue()); continue; } String line = STATSD_INVALID.matcher(key).replaceAll(replacementForInvalidChar) + computeActualValue(result.getValue()) + "|" + bucketType + "\n"; writer.write(line); } }
StatsDWriter2 implements WriterBasedOutputWriter { @Override public void write(@Nonnull Writer writer, @Nonnull Server server, @Nonnull Query query, @Nonnull Iterable<Result> results) throws IOException { for (Result result : results) { String key = KeyUtils.getKeyString(server, query, result, typeNames, rootPrefix); if (isNotValidValue(result.getValue())) { log.debug("Skipping message key[{}] with value: {}.", key, result.getValue()); continue; } String line = STATSD_INVALID.matcher(key).replaceAll(replacementForInvalidChar) + computeActualValue(result.getValue()) + "|" + bucketType + "\n"; writer.write(line); } } }
StatsDWriter2 implements WriterBasedOutputWriter { @Override public void write(@Nonnull Writer writer, @Nonnull Server server, @Nonnull Query query, @Nonnull Iterable<Result> results) throws IOException { for (Result result : results) { String key = KeyUtils.getKeyString(server, query, result, typeNames, rootPrefix); if (isNotValidValue(result.getValue())) { log.debug("Skipping message key[{}] with value: {}.", key, result.getValue()); continue; } String line = STATSD_INVALID.matcher(key).replaceAll(replacementForInvalidChar) + computeActualValue(result.getValue()) + "|" + bucketType + "\n"; writer.write(line); } } StatsDWriter2(
			@Nonnull List<String> typeNames,
			@Nonnull String rootPrefix,
			@Nonnull String bucketType,
			boolean stringsValuesAsKey,
			@Nonnull Long stringValueDefaultCount,
			@Nonnull String replacementForInvalidChar); }
StatsDWriter2 implements WriterBasedOutputWriter { @Override public void write(@Nonnull Writer writer, @Nonnull Server server, @Nonnull Query query, @Nonnull Iterable<Result> results) throws IOException { for (Result result : results) { String key = KeyUtils.getKeyString(server, query, result, typeNames, rootPrefix); if (isNotValidValue(result.getValue())) { log.debug("Skipping message key[{}] with value: {}.", key, result.getValue()); continue; } String line = STATSD_INVALID.matcher(key).replaceAll(replacementForInvalidChar) + computeActualValue(result.getValue()) + "|" + bucketType + "\n"; writer.write(line); } } StatsDWriter2(
			@Nonnull List<String> typeNames,
			@Nonnull String rootPrefix,
			@Nonnull String bucketType,
			boolean stringsValuesAsKey,
			@Nonnull Long stringValueDefaultCount,
			@Nonnull String replacementForInvalidChar); @Override void write(@Nonnull Writer writer, @Nonnull Server server, @Nonnull Query query, @Nonnull Iterable<Result> results); }
StatsDWriter2 implements WriterBasedOutputWriter { @Override public void write(@Nonnull Writer writer, @Nonnull Server server, @Nonnull Query query, @Nonnull Iterable<Result> results) throws IOException { for (Result result : results) { String key = KeyUtils.getKeyString(server, query, result, typeNames, rootPrefix); if (isNotValidValue(result.getValue())) { log.debug("Skipping message key[{}] with value: {}.", key, result.getValue()); continue; } String line = STATSD_INVALID.matcher(key).replaceAll(replacementForInvalidChar) + computeActualValue(result.getValue()) + "|" + bucketType + "\n"; writer.write(line); } } StatsDWriter2(
			@Nonnull List<String> typeNames,
			@Nonnull String rootPrefix,
			@Nonnull String bucketType,
			boolean stringsValuesAsKey,
			@Nonnull Long stringValueDefaultCount,
			@Nonnull String replacementForInvalidChar); @Override void write(@Nonnull Writer writer, @Nonnull Server server, @Nonnull Query query, @Nonnull Iterable<Result> results);  }