<commit_before>package org.marsik.elshelves.backend.app.prometheus;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import io.prometheus.client.Collector;
import org.marsik.elshelves.backend.repositories.LotRepository;
import org.marsik.elshelves.backend.repositories.UserRepository;
import org.marsik.elshelves.backend.repositories.results.EntityMetric;
import org.marsik.elshelves.backend.repositories.results.LotMetric;
import org.marsik.elshelves.backend.repositories.results.UserMetric;

public class ShelvesStatsCollector extends Collector {
    LotRepository lotRepository;

    UserRepository userRepository;

    public ShelvesStatsCollector(LotRepository lotRepository,
            UserRepository userRepository) {
        this.lotRepository = lotRepository;
        this.userRepository = userRepository;
    }

    @Override
    public List<MetricFamilySamples> collect() {
        List<MetricFamilySamples> metrics = new ArrayList<>();
        StringBuilder result = new StringBuilder();

        LotMetric count = lotRepository.lotCount();

        List<MetricFamilySamples.Sample> sample = new ArrayList<>();

        sample.add(new MetricFamilySamples.Sample(
                "shelves_part_count",
                Arrays.asList("type"),
                Arrays.asList("total"),<commit_msg>Fix findbugs issue (unused variable in metric collector)<commit_after>package org.marsik.elshelves.backend.app.prometheus;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import io.prometheus.client.Collector;
import org.marsik.elshelves.backend.repositories.LotRepository;
import org.marsik.elshelves.backend.repositories.UserRepository;
import org.marsik.elshelves.backend.repositories.results.EntityMetric;
import org.marsik.elshelves.backend.repositories.results.LotMetric;
import org.marsik.elshelves.backend.repositories.results.UserMetric;

public class ShelvesStatsCollector extends Collector {
    LotRepository lotRepository;

    UserRepository userRepository;

    public ShelvesStatsCollector(LotRepository lotRepository,
            UserRepository userRepository) {
        this.lotRepository = lotRepository;
        this.userRepository = userRepository;
    }

    @Override
    public List<MetricFamilySamples> collect() {
        List<MetricFamilySamples> metrics = new ArrayList<>();

        LotMetric count = lotRepository.lotCount();

        List<MetricFamilySamples.Sample> sample = new ArrayList<>();

        sample.add(new MetricFamilySamples.Sample(
                "shelves_part_count",
                Arrays.asList("type"),
                Arrays.asList("total"),
{'fraction_non_alphanumeric': 0.08957470831765149, 'fraction_numerical': 0.0, 'mean_word_length': 3.9682242990654206, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '2021306', 'n_tokens_mistral': 753, 'n_tokens_neox': 717, 'n_words': 126}