ScriptsLab
WikiDownloadsSourcesSupport
ScriptsLab
DocumentationDownloadsGitHubDiscord

© 2026 ScriptsLab

Back to src/main/java/com/scriptslab/api/metrics
J

MetricsCollector.java

Java · 69 lines · 1.4 KB

src/main/java/com/scriptslab/api/metrics/MetricsCollector.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.scriptslab.api.metrics;

import java.util.Map;
import java.util.concurrent.CompletableFuture;

/**
 * Metrics collector for monitoring plugin performance.
 */
public interface MetricsCollector {
    
    /**
     * Records a metric value.
     * 
     * @param name metric name
     * @param value metric value
     */
    void record(String name, double value);
    
    /**
     * Increments a counter metric.
     * 
     * @param name counter name
     */
    void increment(String name);
    
    /**
     * Increments a counter by a specific amount.
     * 
     * @param name counter name
     * @param amount amount to increment
     */
    void increment(String name, long amount);
    
    /**
     * Records timing information.
     * 
     * @param name timer name
     * @param durationMs duration in milliseconds
     */
    void recordTiming(String name, long durationMs);
    
    /**
     * Gets a metric value.
     * 
     * @param name metric name
     * @return metric value
     */
    CompletableFuture<Double> getMetric(String name);
    
    /**
     * Gets all metrics.
     * 
     * @return map of all metrics
     */
    CompletableFuture<Map<String, Double>> getAllMetrics();
    
    /**
     * Resets all metrics.
     */
    void reset();
    
    /**
     * Resets a specific metric.
     * 
     * @param name metric name
     */
    void reset(String name);
}