Пример #1
0
  List<Dimension> createDimensions(TagList tags) {
    List<Dimension> dimensionList = new ArrayList<Dimension>(tags.size());

    for (Tag tag : tags) {
      dimensionList.add(new Dimension().withName(tag.getKey()).withValue(tag.getValue()));
    }

    return dimensionList;
  }
Пример #2
0
  @Override
  public void toJson(JsonGenerator gen) throws IOException {
    gen.writeStartObject();

    // common tags
    gen.writeObjectFieldStart("tags");
    for (Tag tag : tags) {
      gen.writeStringField(
          ValidCharacters.toValidCharset(tag.getKey()),
          ValidCharacters.toValidCharset(tag.getValue()));
    }
    gen.writeEndObject();

    gen.writeArrayFieldStart("metrics");
    for (AtlasMetric m : metrics) {
      m.toJson(gen);
    }
    gen.writeEndArray();

    gen.writeEndObject();
    gen.flush();
  }