#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
+// Definitions for enums
+#include "common/perf_counters.h"
+
void Option::dump_value(const char *field_name,
const Option::value_t &v, Formatter *f) const
.set_default(0)
.set_description(""),
+ Option("mgr_stats_threshold", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+ .set_default((int64_t)PerfCountersBuilder::PRIO_USEFUL)
+ .set_description("Lowest perfcounter priority collected by mgr")
+ .set_long_description("Daemons only set perf counter data to the manager "
+ "daemon if the counter has a priority higher than this.")
+ .set_min_max((int64_t)PerfCountersBuilder::PRIO_DEBUGONLY,
+ (int64_t)PerfCountersBuilder::PRIO_CRITICAL),
+
Option("journal_zero_on_create", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.set_description(""),
*/
class MMgrConfigure : public Message
{
- static const int HEAD_VERSION = 1;
+ static const int HEAD_VERSION = 2;
static const int COMPAT_VERSION = 1;
public:
uint32_t stats_period;
+
+ // Default 0 means if unspecified will include all stats
+ uint32_t stats_threshold = 0;
void decode_payload() override
{
bufferlist::iterator p = payload.begin();
::decode(stats_period, p);
+ if (header.version >= 2) {
+ ::decode(stats_threshold, p);
+ }
}
void encode_payload(uint64_t features) override {
::encode(stats_period, payload);
+ ::encode(stats_threshold, payload);
}
const char *get_type_name() const override { return "mgrconfigure"; }
void print(ostream& out) const override {
- out << get_type_name() << "()";
+ out << get_type_name() << "(period=" << stats_period
+ << ", threshold=" << stats_threshold << ")";
}
MMgrConfigure()
auto configure = new MMgrConfigure();
configure->stats_period = g_conf->mgr_stats_period;
+ configure->stats_threshold = g_conf->get_val<int64_t>("mgr_stats_threshold");
m->get_connection()->send_message(configure);
DaemonStatePtr daemon;
pcc->with_counters([this, report](
const PerfCountersCollection::CounterMap &by_path)
{
+ auto include_counter = [this](
+ const PerfCounters::perf_counter_data_any_d &ctr)
+ {
+ return ctr.prio >= (int)stats_threshold;
+ };
+
ENCODE_START(1, 1, report->packed);
for (auto p = session->declared.begin(); p != session->declared.end(); ) {
- if (by_path.count(*p) == 0) {
+ if (by_path.count(*p) == 0 || !include_counter(*(by_path.at(*p)))) {
report->undeclare_types.push_back(*p);
ldout(cct,20) << __func__ << " undeclare " << *p << dendl;
p = session->declared.erase(p);
auto& path = i.first;
auto& data = *(i.second);
+ if (!include_counter(data)) {
+ continue;
+ }
+
if (session->declared.count(path) == 0) {
- ldout(cct,20) << __func__ << " declare " << path << dendl;
+ ldout(cct,20) << " declare " << path << dendl;
PerfCounterType type;
type.path = path;
if (data.description) {
}
ENCODE_FINISH(report->packed);
- ldout(cct, 20) << by_path.size() << " counters, of which "
- << report->declare_types.size() << " new" << dendl;
+ ldout(cct, 20) << "sending " << session->declared.size() << " counters ("
+ "of possible " << by_path.size() << "), "
+ << report->declare_types.size() << " new, "
+ << report->undeclare_types.size() << " removed"
+ << dendl;
});
ldout(cct, 20) << "encoded " << report->packed.length() << " bytes" << dendl;
ldout(cct, 4) << "stats_period=" << m->stats_period << dendl;
+ if (stats_threshold != m->stats_threshold) {
+ ldout(cct, 4) << "updated stats threshold: " << m->stats_threshold << dendl;
+ stats_threshold = m->stats_threshold;
+ }
+
bool starting = (stats_period == 0) && (m->stats_period != 0);
stats_period = m->stats_period;
if (starting) {
Mutex lock = {"MgrClient::lock"};
uint32_t stats_period = 0;
+ uint32_t stats_threshold = 0;
SafeTimer timer;
CommandTable<MgrCommand> command_table;