All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.boot.metrics.OntrackMetricsSource Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.boot.metrics;

import net.nemerosa.ontrack.model.metrics.MetricsSource;
import net.nemerosa.ontrack.model.metrics.OntrackMetrics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.metrics.Metric;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.stream.Stream;

/**
 * Export of all {@link net.nemerosa.ontrack.model.metrics.OntrackMetrics}.
 */
@Component
public class OntrackMetricsSource implements MetricsSource {

    private final Collection ontrackMetrics;

    @Autowired
    public OntrackMetricsSource(Collection ontrackMetrics) {
        this.ontrackMetrics = ontrackMetrics;
    }

    @Override
    public Stream> getMetrics() {
        return ontrackMetrics.stream().flatMap(p -> p.metrics().stream());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy