private static int operation(Id id) { for (Tag t : id.tags()) { if ("statistic".equals(t.key())) { return operation(t.value()); } } LOGGER.warn("invalid statistic for {}, value will be dropped", id); return UNKNOWN; }
private static int operation(Id id) { for (Tag t : id.tags()) { if ("statistic".equals(t.key())) { return operation(t.value()); } } LOGGER.warn("invalid statistic for {}, value will be dropped", id); return UNKNOWN; }
private static void appendMeasurement( JsonGenerator gen, Map<String, Integer> strings, Map<String, String> commonTags, Id id, double value) throws IOException { int op = operation(id); if (shouldSend(op, value)) { // Number of tag entries, commonTags + name + tags int n = commonTags.size() + 1 + Utils.size(id.tags()); gen.writeNumber(n); // Write out the key/value pairs for the tags for (Map.Entry<String, String> entry : commonTags.entrySet()) { gen.writeNumber(strings.get(entry.getKey())); gen.writeNumber(strings.get(entry.getValue())); } for (Tag t : id.tags()) { gen.writeNumber(strings.get(t.key())); gen.writeNumber(strings.get(t.value())); } gen.writeNumber(strings.get("name")); gen.writeNumber(strings.get(id.name())); // Write out the operation and delta value gen.writeNumber(op); gen.writeNumber(value); } }
private static void appendMeasurement( JsonGenerator gen, Map<String, Integer> strings, Map<String, String> commonTags, Id id, double value) throws IOException { int op = operation(id); if (shouldSend(op, value)) { // Number of tag entries, commonTags + name + tags int n = commonTags.size() + 1 + Utils.size(id.tags()); gen.writeNumber(n); // Write out the key/value pairs for the tags for (Map.Entry<String, String> entry : commonTags.entrySet()) { gen.writeNumber(strings.get(entry.getKey())); gen.writeNumber(strings.get(entry.getValue())); } for (Tag t : id.tags()) { gen.writeNumber(strings.get(t.key())); gen.writeNumber(strings.get(t.value())); } gen.writeNumber(strings.get("name")); gen.writeNumber(strings.get(id.name())); // Write out the operation and delta value gen.writeNumber(op); gen.writeNumber(value); } }