// Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
//     private final StringWriter writer = new StringWriter();
//     private final Map<String, String> globalLabels;
// 
//     public PrometheusFormatWriter(Map<String, String> globalLabels) {
//         this.globalLabels = globalLabels;
//     }
// 
//     public SingleMetricsDefinitionBuilder addGauge(String name) {
//         return new SingleMetricsDefinitionBuilder(MetricType.GAUGE, writer, name, globalLabels);
//     }
// 
//     public SingleMetricsDefinitionBuilder addCounter(String name) {
//         return new SingleMetricsDefinitionBuilder(MetricType.COUNTER, writer, name, globalLabels);
//     }
// 
//     public SummaryMetricsDefinitionBuilder addSummary(String name) {
//         return new SummaryMetricsDefinitionBuilder(writer, name, globalLabels);
//     }
// 
//     public String toString() {
//         return writer.toString();
//     }
// }
// 
// Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/SingleValueWriter.java
// public final class SingleValueWriter {
//     private final ValueWriter valueWriter;
//     private final String name;
// 
//     SingleValueWriter(StringWriter writer, String name, Map<String, String> globalLabels) {
//         this.valueWriter = new ValueWriter(writer, globalLabels);
//         this.name = name;
//     }
// 
//     public SingleValueWriter withSharedLabel(String labelName, String labelValue) {
//         valueWriter.addSharedLabel(labelName, labelValue);
//         return this;
//     }
// 
//     public void value(double value) {
//         this.value(value, Collections.emptyMap());
//     }
// 
//     public SingleValueWriter value(double value, Map<String, String> labels) {
//         valueWriter.writeValue(name, value, labels);
//         return this;
//     }
// 
// 
//     public SingleValueWriter value(double value, String...labels) {
//         if (labels.length % 2 != 0) {
//             throw new IllegalArgumentException("Wrong number of labels, should be in pairs..");
//         }
// 
//         Map<String, String> paramsMap = new LinkedHashMap<>();
//         for (int i = 0; i < labels.length; i++) {
//             paramsMap.put(labels[i], labels[++i]);
//         }
// 
//         return this.value(value, paramsMap);
//     }
// 
// 
// 
//     public void summary(long collectionCount, long millis, String...labels) {
//         if (labels.length % 2 != 0) {
//             throw new IllegalArgumentException("Wrong number of labels, should be in pairs..");
//         }
//         Map<String, String> paramsMap = new LinkedHashMap<>();
//         for (int i = 0; i < labels.length; i++) {
//             paramsMap.put(labels[i], labels[++i]);
//         }
//         valueWriter.writeValue(name + "_count", collectionCount, paramsMap);
//         valueWriter.writeValue(name + "_sum", millis, paramsMap);
//     }
// }


import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.ingest.IngestStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.SingleValueWriter;
package pl.suchenia.elasticsearchPrometheusMetrics.generators;


public class IngestMetricsGenerator extends MetricsGenerator<IngestStats> {
    private static final Logger logger = Loggers.getLogger(IngestMetricsGenerator.class, "init");

    @Override
// Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
//     private final StringWriter writer = new StringWriter();
//     private final Map<String, String> globalLabels;
// 
//     public PrometheusFormatWriter(Map<String, String> globalLabels) {
//         this.globalLabels = globalLabels;
//     }
// 
//     public SingleMetricsDefinitionBuilder addGauge(String name) {
//         return new SingleMetricsDefinitionBuilder(MetricType.GAUGE, writer, name, globalLabels);
//     }
// 
//     public SingleMetricsDefinitionBuilder addCounter(String name) {
//         return new SingleMetricsDefinitionBuilder(MetricType.COUNTER, writer, name, globalLabels);
//     }
// 
//     public SummaryMetricsDefinitionBuilder addSummary(String name) {
//         return new SummaryMetricsDefinitionBuilder(writer, name, globalLabels);
//     }
// 
//     public String toString() {
//         return writer.toString();
//     }
// }
// 
// Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/SingleValueWriter.java
// public final class SingleValueWriter {
//     private final ValueWriter valueWriter;
//     private final String name;
// 
//     SingleValueWriter(StringWriter writer, String name, Map<String, String> globalLabels) {
//         this.valueWriter = new ValueWriter(writer, globalLabels);
//         this.name = name;
//     }
// 
//     public SingleValueWriter withSharedLabel(String labelName, String labelValue) {
//         valueWriter.addSharedLabel(labelName, labelValue);
//         return this;
//     }
// 
//     public void value(double value) {
//         this.value(value, Collections.emptyMap());
//     }
// 
//     public SingleValueWriter value(double value, Map<String, String> labels) {
//         valueWriter.writeValue(name, value, labels);
//         return this;
//     }
// 
// 
//     public SingleValueWriter value(double value, String...labels) {
//         if (labels.length % 2 != 0) {
//             throw new IllegalArgumentException("Wrong number of labels, should be in pairs..");
//         }
// 
//         Map<String, String> paramsMap = new LinkedHashMap<>();
//         for (int i = 0; i < labels.length; i++) {
//             paramsMap.put(labels[i], labels[++i]);
//         }
// 
//         return this.value(value, paramsMap);
//     }
// 
// 
// 
//     public void summary(long collectionCount, long millis, String...labels) {
//         if (labels.length % 2 != 0) {
//             throw new IllegalArgumentException("Wrong number of labels, should be in pairs..");
//         }
//         Map<String, String> paramsMap = new LinkedHashMap<>();
//         for (int i = 0; i < labels.length; i++) {
//             paramsMap.put(labels[i], labels[++i]);
//         }
//         valueWriter.writeValue(name + "_count", collectionCount, paramsMap);
//         valueWriter.writeValue(name + "_sum", millis, paramsMap);
//     }
// }


// Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/IngestMetricsGenerator.java
import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.ingest.IngestStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.SingleValueWriter;

package pl.suchenia.elasticsearchPrometheusMetrics.generators;


public class IngestMetricsGenerator extends MetricsGenerator<IngestStats> {
    private static final Logger logger = Loggers.getLogger(IngestMetricsGenerator.class, "init");

    @Override
    public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, IngestStats ingestStats) {