Emits MicroProfile metrics from Porcupine pipelines
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main/java/com/sebastian_daschner/porcupine_metrics
.gitignore
LICENSE
README.adoc
pom.xml

README.adoc

Porcupine metrics

Emits statistics of Porcupine pipelines via MicroProfile metrics.

Usage

Add the following dependency to your project build. It depends on Porcupine 0.0.4, CDI 1.1, and MicroProfile Metrics 1.0.

<dependency>
    <groupId>com.sebastian-daschner</groupId>
    <artifactId>porcupine-metrics</artifactId>
    <version>1.0</version>
</dependency>

Inject the bean PorcupineMetrics and invoke the updateMetrics method as often as you want the metrics to be updated. Due to Porcupine’s statistics internals, the update mechanism currently requires to be triggered explicitly, e.g. via timer:

@Singleton
@Startup
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class ExecutorStatisticsUpdater {

    @Inject
    PorcupineMetrics porcupineMetrics;

    @Resource
    ManagedScheduledExecutorService scheduler;

    @PostConstruct
    public void init() {
        scheduler.scheduleAtFixedRate(porcupineMetrics::updateMetrics,
            0, 5, TimeUnit.SECONDS);
    }

}