forked from graphql-java/java-dataloader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatisticsCollector.java
More file actions
114 lines (101 loc) · 3.85 KB
/
StatisticsCollector.java
File metadata and controls
114 lines (101 loc) · 3.85 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package org.dataloader.stats;
import org.dataloader.annotations.PublicSpi;
import org.dataloader.stats.context.IncrementBatchLoadCountByStatisticsContext;
import org.dataloader.stats.context.IncrementBatchLoadExceptionCountStatisticsContext;
import org.dataloader.stats.context.IncrementCacheHitCountStatisticsContext;
import org.dataloader.stats.context.IncrementLoadCountStatisticsContext;
import org.dataloader.stats.context.IncrementLoadErrorCountStatisticsContext;
/**
* This allows statistics to be collected for {@link org.dataloader.DataLoader} operations
*/
@PublicSpi
public interface StatisticsCollector {
/**
* Called to increment the number of loads
*
* @param <K> the class of the key in the data loader
* @param context the context containing metadata of the data loader invocation
*/
default <K> void incrementLoadCount(IncrementLoadCountStatisticsContext<K> context) {
incrementLoadCount();
}
/**
* Called to increment the number of loads
*
* @deprecated use {@link #incrementLoadCount(IncrementLoadCountStatisticsContext)}
*/
@Deprecated
void incrementLoadCount();
/**
* Called to increment the number of loads that resulted in an object deemed in error
*
* @param <K> the class of the key in the data loader
* @param context the context containing metadata of the data loader invocation
*
*/
default <K> void incrementLoadErrorCount(IncrementLoadErrorCountStatisticsContext<K> context) {
incrementLoadErrorCount();
}
/**
* Called to increment the number of loads that resulted in an object deemed in error
*
* @deprecated use {@link #incrementLoadErrorCount(IncrementLoadErrorCountStatisticsContext)}
*/
@Deprecated
void incrementLoadErrorCount();
/**
* Called to increment the number of batch loads
*
* @param <K> the class of the key in the data loader
* @param delta how much to add to the count
* @param context the context containing metadata of the data loader invocation
*/
default <K> void incrementBatchLoadCountBy(long delta, IncrementBatchLoadCountByStatisticsContext<K> context) {
incrementBatchLoadCountBy(delta);
}
/**
* Called to increment the number of batch loads
*
* @param delta how much to add to the count
*
* @deprecated use {@link #incrementBatchLoadCountBy(long, IncrementBatchLoadCountByStatisticsContext)}
*/
@Deprecated
void incrementBatchLoadCountBy(long delta);
/**
* Called to increment the number of batch loads exceptions
*
* @param <K> the class of the key in the data loader
* @param context the context containing metadata of the data loader invocation
*/
default <K> void incrementBatchLoadExceptionCount(IncrementBatchLoadExceptionCountStatisticsContext<K> context) {
incrementBatchLoadExceptionCount();
}
/**
* Called to increment the number of batch loads exceptions
*
* @deprecated use {@link #incrementBatchLoadExceptionCount(IncrementBatchLoadExceptionCountStatisticsContext)}
*/
@Deprecated
void incrementBatchLoadExceptionCount();
/**
* Called to increment the number of cache hits
*
* @param <K> the class of the key in the data loader
* @param context the context containing metadata of the data loader invocation
*/
default <K> void incrementCacheHitCount(IncrementCacheHitCountStatisticsContext<K> context) {
incrementCacheHitCount();
}
/**
* Called to increment the number of cache hits
*
* @deprecated use {@link #incrementCacheHitCount(IncrementCacheHitCountStatisticsContext)}
*/
@Deprecated
void incrementCacheHitCount();
/**
* @return the statistics that have been gathered to this point in time
*/
Statistics getStatistics();
}