Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonGenerator.writeStartObject()


    writeToLibrato(server, query, results);
  }

  private void serialize(Server server, Query query, List<Result> results, OutputStream outputStream) throws IOException {
    JsonGenerator g = jsonFactory.createJsonGenerator(outputStream, JsonEncoding.UTF8);
    g.writeStartObject();
    g.writeArrayFieldStart("counters");
    g.writeEndArray();

    String source = getSource(server);
View Full Code Here


    for (Result result : results) {
      Map<String, Object> resultValues = result.getValues();
      if (resultValues != null) {
        for (Map.Entry<String, Object> values : resultValues.entrySet()) {
          if (NumberUtils.isNumeric(values.getValue())) {
            g.writeStartObject();
            g.writeStringField("name", KeyUtils.getKeyStringWithDottedKeys(query, result, values, typeNames));
            if (source != null && !source.isEmpty()) {
              g.writeStringField("source", source);
            }
            g.writeNumberField("measure_time", TimeUnit.SECONDS.convert(result.getEpoch(), TimeUnit.MILLISECONDS));
View Full Code Here

   */
  private String getGatewayMessage(final List<Result> results) throws IOException {
    int valueCount = 0;
    Writer writer = new StringWriter();
    JsonGenerator g = jsonFactory.createGenerator(writer);
    g.writeStartObject();
    g.writeNumberField("timestamp", System.currentTimeMillis() / 1000);
    g.writeNumberField("proto_version", STACKDRIVER_PROTOCOL_VERSION);
    g.writeArrayFieldStart("data");

    List<String> typeNames = this.getTypeNames();
View Full Code Here

              logger.info("Metric value for " + nameBuilder.toString() + " is NaN, skipping");
              continue;
            }
           
            valueCount++;
            g.writeStartObject();
           
            g.writeStringField("name", nameBuilder.toString());
           
            g.writeNumberField("value", Double.valueOf(entry.getValue().toString()));
           
View Full Code Here

  }

  private void serialize(Server server, Query query, List<Result> results, OutputStream outputStream) throws IOException {
    JsonGenerator g = jsonFactory.createGenerator(outputStream, JsonEncoding.UTF8);
    g.useDefaultPrettyPrinter();
    g.writeStartObject();
    g.writeStringField("name", "jmxtrans");
    g.writeStringField("type", "metric");
    g.writeStringField("handler", handler);

    StringBuilder jsonoutput = new StringBuilder();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.