|
6 | 6 | import java.util.Map; |
7 | 7 |
|
8 | 8 | public final class CursorStats { |
9 | | - |
10 | | - private Long fullCount; |
11 | 9 | private final Map<String, Object> properties = new HashMap<>(); |
| 10 | + private Long writesExecuted; |
| 11 | + private Long writesIgnored; |
| 12 | + private Long scannedFull; |
| 13 | + private Long scannedIndex; |
| 14 | + private Long cursorsCreated; |
| 15 | + private Long cursorsRearmed; |
| 16 | + private Long cacheHits; |
| 17 | + private Long cacheMisses; |
| 18 | + private Long filtered; |
| 19 | + private Long httpRequests; |
| 20 | + private Long fullCount; |
| 21 | + private Double executionTime; |
| 22 | + private Long peakMemoryUsage; |
12 | 23 |
|
13 | 24 | @JsonAnySetter |
14 | 25 | public void add(String key, Object value) { |
15 | 26 | properties.put(key, value); |
16 | 27 | } |
17 | 28 |
|
| 29 | + public Object get(String key) { |
| 30 | + return properties.get(key); |
| 31 | + } |
| 32 | + |
| 33 | + /** |
| 34 | + * @return The total number of data-modification operations successfully executed. |
| 35 | + */ |
| 36 | + public Long getWritesExecuted() { |
| 37 | + return writesExecuted; |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * @return The total number of data-modification operations that were unsuccessful, but have been ignored because of |
| 42 | + * the ignoreErrors query option. |
| 43 | + */ |
| 44 | + public Long getWritesIgnored() { |
| 45 | + return writesIgnored; |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * @return The total number of documents iterated over when scanning a collection without an index. Documents |
| 50 | + * scanned by subqueries are included in the result, but operations triggered by built-in or user-defined AQL |
| 51 | + * functions are not. |
| 52 | + */ |
| 53 | + public Long getScannedFull() { |
| 54 | + return scannedFull; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * @return The total number of documents iterated over when scanning a collection using an index. Documents scanned |
| 59 | + * by subqueries are included in the result, but operations triggered by built-in or user-defined AQL functions are |
| 60 | + * not. |
| 61 | + */ |
| 62 | + public Long getScannedIndex() { |
| 63 | + return scannedIndex; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * @return The total number of cursor objects created during query execution. Cursor objects are created for index |
| 68 | + * lookups. |
| 69 | + */ |
| 70 | + public Long getCursorsCreated() { |
| 71 | + return cursorsCreated; |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * @return The total number of times an existing cursor object was repurposed. Repurposing an existing cursor object |
| 76 | + * is normally more efficient compared to destroying an existing cursor object and creating a new one from scratch. |
| 77 | + */ |
| 78 | + public Long getCursorsRearmed() { |
| 79 | + return cursorsRearmed; |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * @return The total number of index entries read from in-memory caches for indexes of type edge or persistent. This |
| 84 | + * value is only non-zero when reading from indexes that have an in-memory cache enabled, and when the query allows |
| 85 | + * using the in-memory cache (i.e. using equality lookups on all index attributes). |
| 86 | + */ |
| 87 | + public Long getCacheHits() { |
| 88 | + return cacheHits; |
| 89 | + } |
| 90 | + |
| 91 | + /** |
| 92 | + * @return The total number of cache read attempts for index entries that could not be served from in-memory caches |
| 93 | + * for indexes of type edge or persistent. This value is only non-zero when reading from indexes that have an |
| 94 | + * in-memory cache enabled, the query allows using the in-memory cache (i.e. using equality lookups on all index |
| 95 | + * attributes) and the looked up values are not present in the cache. |
| 96 | + */ |
| 97 | + public Long getCacheMisses() { |
| 98 | + return cacheMisses; |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * @return The total number of documents removed after executing a filter condition in a FilterNode or another node |
| 103 | + * that post-filters data. Note that nodes of the IndexNode type can also filter documents by selecting only the |
| 104 | + * required index range from a collection, and the filtered value only indicates how much filtering was done by a |
| 105 | + * post filter in the IndexNode itself or following FilterNode nodes. Nodes of the EnumerateCollectionNode and |
| 106 | + * TraversalNode types can also apply filter conditions and can report the number of filtered documents. |
| 107 | + */ |
| 108 | + public Long getFiltered() { |
| 109 | + return filtered; |
| 110 | + } |
| 111 | + |
| 112 | + /** |
| 113 | + * @return The total number of cluster-internal HTTP requests performed. |
| 114 | + */ |
| 115 | + public Long getHttpRequests() { |
| 116 | + return httpRequests; |
| 117 | + } |
| 118 | + |
| 119 | + /** |
| 120 | + * @return The total number of documents that matched the search condition if the query’s final top-level LIMIT |
| 121 | + * operation were not present. This attribute may only be returned if the fullCount option was set when starting the |
| 122 | + * query and only contains a sensible value if the query contains a LIMIT operation on the top level. |
| 123 | + */ |
18 | 124 | public Long getFullCount() { |
19 | 125 | return fullCount; |
20 | 126 | } |
21 | 127 |
|
22 | | - public Object get(String key) { |
23 | | - return properties.get(key); |
| 128 | + /** |
| 129 | + * @return The query execution time (wall-clock time) in seconds. |
| 130 | + */ |
| 131 | + public Double getExecutionTime() { |
| 132 | + return executionTime; |
24 | 133 | } |
25 | 134 |
|
| 135 | + /** |
| 136 | + * @return The maximum memory usage of the query while it was running. In a cluster, the memory accounting is done |
| 137 | + * per shard, and the memory usage reported is the peak memory usage value from the individual shards. Note that to |
| 138 | + * keep things lightweight, the per-query memory usage is tracked on a relatively high level, not including any |
| 139 | + * memory allocator overhead nor any memory used for temporary results calculations (e.g. memory |
| 140 | + * allocated/deallocated inside AQL expressions and function calls). |
| 141 | + */ |
| 142 | + public Long getPeakMemoryUsage() { |
| 143 | + return peakMemoryUsage; |
| 144 | + } |
26 | 145 | } |
0 commit comments