Files
scylladb/redis/stats.cc
Avi Kivity fcb8d040e8 treewide: use Software Package Data Exchange (SPDX) license identifiers
Instead of lengthy blurbs, switch to single-line, machine-readable
standardized (https://spdx.dev) license identifiers. The Linux kernel
switched long ago, so there is strong precedent.

Three cases are handled: AGPL-only, Apache-only, and dual licensed.
For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0),
reasoning that our changes are extensive enough to apply our license.

The changes we applied mechanically with a script, except to
licenses/README.md.

Closes #9937
2022-01-18 12:15:18 +01:00

45 lines
1.9 KiB
C++

/*
* Copyright (C) 2019 pengjian.uestc @ gmail.com
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "redis/stats.hh"
#include <seastar/core/metrics.hh>
namespace redis {
const char* REDIS_METRICS = "redis";
stats::stats() : api_operations{} {
seastar::metrics::label op("op");
_metrics.add_group("redis", {
#define OPERATION(name, CamelCaseName) \
seastar::metrics::make_total_operations("operation", api_operations.name._counter, \
seastar::metrics::description("number of operations via redis API"), {op(CamelCaseName)}), \
seastar::metrics::make_histogram("op_latency", \
seastar::metrics::description("Latency histogram of an operation via redis API"), {op(CamelCaseName)}, [this]{return api_operations.name._latency.get_histogram(1,20);}),
OPERATION(_get, "get")
OPERATION(_set, "set")
OPERATION(_del, "del")
OPERATION(_ping, "ping")
OPERATION(_select, "select")
});
_metrics.add_group("redis", {
seastar::metrics::make_derive("redis-connections", _connects,
seastar::metrics::description("Counts a number of client connections.")),
seastar::metrics::make_gauge("current_connections", _connections,
seastar::metrics::description("Holds a current number of client connections.")),
seastar::metrics::make_derive("requests_served", _requests_served,
seastar::metrics::description("Counts a number of served requests.")),
seastar::metrics::make_gauge("requests_serving", _requests_serving,
seastar::metrics::description("Holds a number of requests that are being processed right now.")),
seastar::metrics::make_histogram("requests_latency", seastar::metrics::description("The general requests latency histogram"), [this]{ return _estimated_requests_latency.get_histogram(16, 20);}),
});
}
}