1 | /* |
2 | * stats.h |
3 | * |
4 | * Copyright (C) 2016-2019 Aerospike, Inc. |
5 | * |
6 | * Portions may be licensed to Aerospike, Inc. under one or more contributor |
7 | * license agreements. |
8 | * |
9 | * This program is free software: you can redistribute it and/or modify it under |
10 | * the terms of the GNU Affero General Public License as published by the Free |
11 | * Software Foundation, either version 3 of the License, or (at your option) any |
12 | * later version. |
13 | * |
14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
16 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
17 | * details. |
18 | * |
19 | * You should have received a copy of the GNU Affero General Public License |
20 | * along with this program. If not, see http://www.gnu.org/licenses/ |
21 | */ |
22 | |
23 | #pragma once |
24 | |
25 | //========================================================== |
26 | // Includes. |
27 | // |
28 | |
29 | #include <stdint.h> |
30 | |
31 | #include "citrusleaf/cf_atomic.h" |
32 | |
33 | #include "hist.h" |
34 | |
35 | #include "fabric/fabric.h" |
36 | |
37 | |
38 | //========================================================== |
39 | // Typedefs & constants. |
40 | // |
41 | |
42 | typedef struct as_stats_s { |
43 | |
44 | // Connection stats. |
45 | cf_atomic64 proto_connections_opened; // not just a statistic |
46 | cf_atomic64 proto_connections_closed; // not just a statistic |
47 | // In ticker but not collected via info: |
48 | cf_atomic64 heartbeat_connections_opened; |
49 | cf_atomic64 heartbeat_connections_closed; |
50 | cf_atomic64 fabric_connections_opened; |
51 | cf_atomic64 fabric_connections_closed; |
52 | |
53 | // Heartbeat stats. |
54 | cf_atomic64 heartbeat_received_self; |
55 | cf_atomic64 heartbeat_received_foreign; |
56 | |
57 | // Demarshal stats. |
58 | uint64_t reaper_count; // not in ticker - incremented only in reaper thread |
59 | |
60 | // Info stats. |
61 | cf_atomic64 info_complete; |
62 | |
63 | // Early transaction errors. |
64 | cf_atomic64 n_demarshal_error; |
65 | cf_atomic64 n_tsvc_client_error; |
66 | cf_atomic64 n_tsvc_from_proxy_error; |
67 | cf_atomic64 n_tsvc_batch_sub_error; |
68 | cf_atomic64 n_tsvc_from_proxy_batch_sub_error; |
69 | cf_atomic64 n_tsvc_udf_sub_error; |
70 | cf_atomic64 n_tsvc_ops_sub_error; |
71 | |
72 | // Batch-index stats. |
73 | cf_atomic64 batch_index_initiate; // not in ticker - not just a statistic |
74 | cf_atomic64 batch_index_complete; |
75 | cf_atomic64 batch_index_errors; |
76 | cf_atomic64 batch_index_timeout; |
77 | cf_atomic64 batch_index_delay; // not in ticker |
78 | |
79 | // Batch-index stats. |
80 | cf_atomic64 batch_index_huge_buffers; // not in ticker |
81 | cf_atomic64 batch_index_created_buffers; // not in ticker |
82 | cf_atomic64 batch_index_destroyed_buffers; // not in ticker |
83 | |
84 | // Query & secondary index stats. |
85 | cf_atomic64 query_false_positives; |
86 | cf_atomic64 sindex_gc_retries; // number of times sindex gc skips iteration on failure to get record lock |
87 | uint64_t sindex_gc_list_creation_time; // cumulative sum of list creation phase in sindex gc |
88 | uint64_t sindex_gc_list_deletion_time; // cumulative sum of list deletion phase in sindex gc |
89 | uint64_t sindex_gc_objects_validated; // cumulative sum of sindex objects validated |
90 | uint64_t sindex_gc_garbage_found; // amount of garbage found during list creation phase |
91 | uint64_t sindex_gc_garbage_cleaned; // amount of garbage deleted during list deletion phase |
92 | |
93 | // Fabric stats. |
94 | uint64_t fabric_bulk_s_rate; |
95 | uint64_t fabric_bulk_r_rate; |
96 | uint64_t fabric_ctrl_s_rate; |
97 | uint64_t fabric_ctrl_r_rate; |
98 | uint64_t fabric_meta_s_rate; |
99 | uint64_t fabric_meta_r_rate; |
100 | uint64_t fabric_rw_s_rate; |
101 | uint64_t fabric_rw_r_rate; |
102 | |
103 | //-------------------------------------------- |
104 | // Histograms. |
105 | // |
106 | |
107 | histogram* batch_index_hist; |
108 | bool batch_index_hist_active; // automatically activated |
109 | |
110 | histogram* info_hist; |
111 | |
112 | histogram* svc_demarshal_hist; |
113 | histogram* svc_queue_hist; |
114 | |
115 | histogram* fabric_send_init_hists[AS_FABRIC_N_CHANNELS]; |
116 | histogram* fabric_send_fragment_hists[AS_FABRIC_N_CHANNELS]; |
117 | histogram* fabric_recv_fragment_hists[AS_FABRIC_N_CHANNELS]; |
118 | histogram* fabric_recv_cb_hists[AS_FABRIC_N_CHANNELS]; |
119 | |
120 | } as_stats; |
121 | |
122 | |
123 | //========================================================== |
124 | // Public API. |
125 | // |
126 | |
127 | // For now this is in thr_info.c, until a separate .c file is worth it. |
128 | extern as_stats g_stats; |
129 | |