summaryrefslogtreecommitdiffstats
path: root/aclk/aclk_query_queue.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-04-14 18:12:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-04-14 18:12:10 +0000
commitb5321aff06d6ea8d730d62aec2ffd8e9271c1ffc (patch)
tree36c41e35994786456154f9d3bf88c324763aeea4 /aclk/aclk_query_queue.c
parentAdding upstream version 1.33.1. (diff)
downloadnetdata-upstream/1.34.0.tar.xz
netdata-upstream/1.34.0.zip
Adding upstream version 1.34.0.upstream/1.34.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--aclk/aclk_query_queue.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/aclk/aclk_query_queue.c b/aclk/aclk_query_queue.c
index fe7ee123c..74a899226 100644
--- a/aclk/aclk_query_queue.c
+++ b/aclk/aclk_query_queue.c
@@ -45,49 +45,14 @@ static inline int _aclk_queue_query(aclk_query_t query)
}
-// Gets a pointer to the metric associated with a particular query type.
-// NULL if the query type has no associated metric.
-static inline volatile uint32_t *aclk_stats_qmetric_for_qtype(aclk_query_type_t qtype) {
- switch (qtype) {
- case HTTP_API_V2:
- return &aclk_metrics_per_sample.query_type_http;
- case ALARM_STATE_UPDATE:
- return &aclk_metrics_per_sample.query_type_alarm_upd;
- case METADATA_INFO:
- return &aclk_metrics_per_sample.query_type_metadata_info;
- case METADATA_ALARMS:
- return &aclk_metrics_per_sample.query_type_metadata_alarms;
- case CHART_NEW:
- return &aclk_metrics_per_sample.query_type_chart_new;
- case CHART_DEL:
- return &aclk_metrics_per_sample.query_type_chart_del;
- case REGISTER_NODE:
- return &aclk_metrics_per_sample.query_type_register_node;
- case NODE_STATE_UPDATE:
- return &aclk_metrics_per_sample.query_type_node_upd;
- default:
- return NULL;
- }
-}
-
int aclk_queue_query(aclk_query_t query)
{
int ret = _aclk_queue_query(query);
if (!ret) {
- // local cache of query type before we wake up query thread, which may
- // free the query in a race.
- aclk_query_type_t qtype = query->type;
QUERY_THREAD_WAKEUP;
-
if (aclk_stats_enabled) {
- // get target query type metric before lock so we keep lock for
- // minimal time.
- volatile uint32_t *metric = aclk_stats_qmetric_for_qtype(qtype);
-
ACLK_STATS_LOCK;
aclk_metrics_per_sample.queries_queued++;
- if (metric)
- *metric += 1;
ACLK_STATS_UNLOCK;
}
}