tools/sclla-sstable: implement the getlogginglevels command
This commit is contained in:
20
test/nodetool/test_logging.py
Normal file
20
test/nodetool/test_logging.py
Normal file
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Copyright 2023-present ScyllaDB
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#
|
||||
|
||||
from rest_api_mock import expected_request
|
||||
|
||||
|
||||
def test_getlogginglevels(nodetool):
|
||||
res = nodetool("getlogginglevels", expected_requests=[
|
||||
expected_request("GET", "/storage_service/logging_level",
|
||||
response=[{"key": "sstable", "value": "info"}, {"key": "cache", "value": "trace"}])])
|
||||
|
||||
assert res == \
|
||||
"""
|
||||
Logger Name Log Level
|
||||
sstable info
|
||||
cache trace
|
||||
"""
|
||||
@@ -423,6 +423,21 @@ void flush_operation(scylla_rest_client& client, const bpo::variables_map& vm) {
|
||||
client.post(format("/storage_service/keyspace_flush/{}", keyspace), std::move(params));
|
||||
}
|
||||
|
||||
void getlogginglevels_operation(scylla_rest_client& client, const bpo::variables_map& vm) {
|
||||
auto res = client.get("/storage_service/logging_level");
|
||||
const auto row_format = "{:<50}{:>10}\n";
|
||||
fmt::print(std::cout, "\n");
|
||||
fmt::print(std::cout, fmt::runtime(row_format), "Logger Name", "Log Level");
|
||||
for (const auto& element : res.GetArray()) {
|
||||
const auto& logger_obj = element.GetObject();
|
||||
fmt::print(
|
||||
std::cout,
|
||||
fmt::runtime(row_format),
|
||||
rjson::to_string_view(logger_obj["key"]),
|
||||
rjson::to_string_view(logger_obj["value"]));
|
||||
}
|
||||
}
|
||||
|
||||
void gettraceprobability_operation(scylla_rest_client& client, const bpo::variables_map& vm) {
|
||||
auto res = client.get("/storage_service/trace_probability");
|
||||
fmt::print(std::cout, "Current trace probability: {}\n", res.GetDouble());
|
||||
@@ -948,6 +963,16 @@ Fore more information, see: https://opensource.docs.scylladb.com/stable/operatin
|
||||
},
|
||||
flush_operation
|
||||
},
|
||||
{
|
||||
{
|
||||
"getlogginglevels",
|
||||
"Get the runtime logging levels",
|
||||
R"(
|
||||
Prints a table with the name and current logging level for each logger in ScyllaDB.
|
||||
)",
|
||||
},
|
||||
getlogginglevels_operation
|
||||
},
|
||||
{
|
||||
{
|
||||
"gettraceprobability",
|
||||
|
||||
Reference in New Issue
Block a user