/*
 * Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
 */

package ai.vespa.metricsproxy.metric.model.json;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import java.util.List;
import java.util.logging.Logger;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_ABSENT;

/**
 * @author gjoranv
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(NON_ABSENT)
@JsonPropertyOrder({ "node", "services" })
public class GenericJsonModel {
    private static Logger log = Logger.getLogger(GenericJsonModel.class.getName());

    @JsonProperty("node")
    public GenericNode node;

    @JsonProperty("services")
    public List<GenericService> services;

    public String serialize() {
        ObjectMapper mapper = JacksonUtil.createObjectMapper();
        try {
            return mapper.writeValueAsString(this);
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException("Could not render metrics. Check the log for details.");
        }
    }

}

@@ -496,16 +496,48 @@
 l.List;%0A
+import java.util.logging.Level;%0A
 import j
@@ -1239,26 +1239,73 @@
     
-e.printStackTrace(
+log.log(Level.WARNING, %22Got exception when rendering metrics:%22, e
 );%0A 

Use logger instead of printStackTrace