This patch extends a previous patch that added these metrics globally: - cql_requests_count - cql_request_bytes - cql_response_bytes This patch adds a "scheduling_group_name" label to these metrics and changes corresponding counters to be accounted on a per-scheduling-group level. As a bonus this patch also marks all 3 metrics as 'skip_when_empty'. Ref #13061 Signed-off-by: Vlad Zolotarov <vladz@scylladb.com> Message-Id: <20230321201412.3004845-1-vladz@scylladb.com>
74 lines
2.4 KiB
C++
74 lines
2.4 KiB
C++
/*
|
|
* Copyright (C) 2020-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <seastar/core/semaphore.hh>
|
|
#include <seastar/core/sharded.hh>
|
|
#include <seastar/core/future.hh>
|
|
|
|
#include "protocol_server.hh"
|
|
|
|
using namespace seastar;
|
|
|
|
namespace auth { class service; }
|
|
namespace service {
|
|
class migration_notifier;
|
|
class endpoint_lifecycle_notifier;
|
|
class memory_limiter;
|
|
}
|
|
namespace gms { class gossiper; }
|
|
namespace cql3 { class query_processor; }
|
|
namespace qos { class service_level_controller; }
|
|
namespace db { class config; }
|
|
struct client_data;
|
|
|
|
namespace cql_transport {
|
|
|
|
class cql_server;
|
|
class controller : public protocol_server {
|
|
std::vector<socket_address> _listen_addresses;
|
|
std::unique_ptr<sharded<cql_server>> _server;
|
|
semaphore _ops_sem; /* protects start/stop operations on _server */
|
|
bool _stopped = false;
|
|
|
|
sharded<auth::service>& _auth_service;
|
|
sharded<service::migration_notifier>& _mnotifier;
|
|
sharded<service::endpoint_lifecycle_notifier>& _lifecycle_notifier;
|
|
sharded<gms::gossiper>& _gossiper;
|
|
sharded<cql3::query_processor>& _qp;
|
|
sharded<service::memory_limiter>& _mem_limiter;
|
|
sharded<qos::service_level_controller>& _sl_controller;
|
|
const db::config& _config;
|
|
scheduling_group_key _cql_opcode_stats_key;
|
|
|
|
|
|
future<> set_cql_ready(bool ready);
|
|
future<> do_start_server();
|
|
future<> do_stop_server();
|
|
|
|
future<> subscribe_server(sharded<cql_server>& server);
|
|
future<> unsubscribe_server(sharded<cql_server>& server);
|
|
|
|
public:
|
|
controller(sharded<auth::service>&, sharded<service::migration_notifier>&, sharded<gms::gossiper>&,
|
|
sharded<cql3::query_processor>&, sharded<service::memory_limiter>&,
|
|
sharded<qos::service_level_controller>&, sharded<service::endpoint_lifecycle_notifier>&,
|
|
const db::config& cfg, scheduling_group_key cql_opcode_stats_key);
|
|
virtual sstring name() const override;
|
|
virtual sstring protocol() const override;
|
|
virtual sstring protocol_version() const override;
|
|
virtual std::vector<socket_address> listen_addresses() const override;
|
|
virtual future<> start_server() override;
|
|
virtual future<> stop_server() override;
|
|
virtual future<> request_stop_server() override;
|
|
virtual future<utils::chunked_vector<client_data>> get_client_data() override;
|
|
};
|
|
|
|
} // namespace cql_transport
|