<commit_before>package io.github.bckfnn.actioner;


import java.io.StringWriter;
import java.util.Map;

import com.codahale.metrics.Counter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Snapshot;

import io.vertx.core.Handler;
import io.vertx.core.http.HttpHeaders;
import io.vertx.ext.web.RoutingContext;

public class PrometheusMetricsHandler implements Handler<RoutingContext> {
    private final MetricRegistry registry;

    public PrometheusMetricsHandler(MetricRegistry registry) {
        this.registry = registry;
    }

    @Override
    public void handle(RoutingContext ctx) {
        ctx.response().setStatusCode(200);
        ctx.response().putHeader(HttpHeaders.CONTENT_TYPE, "text/plain; version=0.0.4; charset=utf-8");
        StringWriter writer = new StringWriter();
        try {

            long now = System.currentTimeMillis();
            for (Map.Entry<String, Counter> counter : registry.getCounters().entrySet()) {
                //writer.write("# HELP " + counter.getKey() + " xx\n");
                writer.write("# TYPE " + counter.getKey() + " counter\n");
                writer.write(counter.getKey() + " " + counter.getValue().getCount() + " " + now + "\n");
            };
            for (Map.Entry<String, Gauge> gauge : registry.getGauges().entrySet()) {
                //writer.write("# HELP " + counter.getKey() + " xx\n");
                writer.write("# TYPE " + gauge.getKey() + " counter\n");
                writer.write(gauge.getKey() + " " + gauge.getValue().getValue() + " " + now + "\n");
            };
<commit_msg>fix compiler warning.<commit_after>package io.github.bckfnn.actioner;


import java.io.StringWriter;
import java.util.Map;

import com.codahale.metrics.Counter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Snapshot;

import io.vertx.core.Handler;
import io.vertx.core.http.HttpHeaders;
import io.vertx.ext.web.RoutingContext;

public class PrometheusMetricsHandler implements Handler<RoutingContext> {
    private final MetricRegistry registry;

    public PrometheusMetricsHandler(MetricRegistry registry) {
        this.registry = registry;
    }

    @Override
    public void handle(RoutingContext ctx) {
        ctx.response().setStatusCode(200);
        ctx.response().putHeader(HttpHeaders.CONTENT_TYPE, "text/plain; version=0.0.4; charset=utf-8");
        StringWriter writer = new StringWriter();
        try {

            long now = System.currentTimeMillis();
            for (Map.Entry<String, Counter> counter : registry.getCounters().entrySet()) {
                //writer.write("# HELP " + counter.getKey() + " xx\n");
                writer.write("# TYPE " + counter.getKey() + " counter\n");
                writer.write(counter.getKey() + " " + counter.getValue().getCount() + " " + now + "\n");
            };
            for (@SuppressWarnings("rawtypes") Map.Entry<String, Gauge> gauge : registry.getGauges().entrySet()) {
                //writer.write("# HELP " + counter.getKey() + " xx\n");
                writer.write("# TYPE " + gauge.getKey() + " counter\n");
                writer.write(gauge.getKey() + " " + gauge.getValue().getValue() + " " + now + "\n");
            };

{'fraction_non_alphanumeric': 0.1456761462565293, 'fraction_numerical': 0.004062681369704005, 'mean_word_length': 2.8861330326944756, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4765437', 'n_tokens_mistral': 1025, 'n_tokens_neox': 1006, 'n_words': 183}