001package io.ebean.meta; 002 003import java.util.Comparator; 004 005/** 006 * Collect the metrics in raw JSON form. 007 */ 008public interface ServerMetricsAsJson { 009 010 /** 011 * Set to false to exclude profile location and sql. 012 */ 013 ServerMetricsAsJson withExtraAttributes(boolean withLocation); 014 015 /** 016 * Set to false to exclude SQL hash. 017 */ 018 ServerMetricsAsJson withHash(boolean withHash); 019 020 /** 021 * Set the sort property - see SortMetric 022 * @see SortMetric 023 */ 024 ServerMetricsAsJson withSort(Comparator<MetaTimedMetric> sortBy); 025 026 /** 027 * Set the new line character to use. 028 */ 029 ServerMetricsAsJson withNewLine(boolean withNewLine); 030 031 /** 032 * Set to include a heading of the database name. 033 * <p> 034 * When this is false the metrics are written without json array start or array end. 035 */ 036 ServerMetricsAsJson withHeader(boolean withHeader); 037 038 /** 039 * Collect and write metrics as JSON to the given buffer. 040 */ 041 void write(Appendable buffer); 042 043 /** 044 * Return the metrics in raw JSON. 045 */ 046 String json(); 047}