docs: Optional<String> writeMeter(Meter meter) {
          Iterable<Measurement> measurements = meter.measure();
          List<String> names = new ArrayList<>();
          // Snapshot values should be used throughout this method as there are chances for values to be changed in-between.
          List<Double> values = new ArrayList<>();
          for (Measurement measurement : measurements) {
              double value = measurement.getValue();
              if (!Double.isFinite(value)) {
                  continue;
              }
              names.add(measurement.getStatistic().getTagValueRepresentation());
              values.add(value);
          }
          if (names.isEmpty()) {
              return Optional.empty();
          }
          return Optional.of(writeDocument(meter, builder -> {
              for (int i = 0; i < names.size(); i++) {
                  builder.append(",\"").append(names.get(i)).append("\":\"").append(values.get(i)).append("\"");
              }
          }));
      }