summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2018-06-27 10:05:49 +0200
committerVenky Shankar <vshankar@redhat.com>2018-08-16 08:16:50 +0200
commit315aa47a07429ba0a47fbd40078f0e8fd16b9ffd (patch)
tree90ef0fcb5b2e563c365a669290056103f378fce5 /src
parentMerge PR #23592 into master (diff)
downloadceph-315aa47a07429ba0a47fbd40078f0e8fd16b9ffd.tar.xz
ceph-315aa47a07429ba0a47fbd40078f0e8fd16b9ffd.zip
mds: add perf counters to track current open/stale sessions
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/mds/SessionMap.cc12
-rw-r--r--src/mds/SessionMap.h7
2 files changed, 19 insertions, 0 deletions
diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc
index 756855e6992..8f324fae013 100644
--- a/src/mds/SessionMap.cc
+++ b/src/mds/SessionMap.cc
@@ -52,6 +52,10 @@ void SessionMap::register_perfcounters()
"Sessions added");
plb.add_u64_counter(l_mdssm_session_remove, "session_remove",
"Sessions removed");
+ plb.add_u64(l_mdssm_session_open, "sessions_open",
+ "Sessions currently open");
+ plb.add_u64(l_mdssm_session_stale, "sessions_stale",
+ "Sessions currently stale");
logger = plb.create_perf_counters();
g_ceph_context->get_perfcounters_collection()->add(logger);
}
@@ -483,7 +487,15 @@ uint64_t SessionMap::set_state(Session *session, int s) {
if (by_state_entry == by_state.end())
by_state_entry = by_state.emplace(s, new xlist<Session*>).first;
by_state_entry->second->push_back(&session->item_session_list);
+
+ // refresh number of sessions for states which have perf
+ // couters associated
+ logger->set(l_mdssm_session_open,
+ get_session_count_in_state(Session::STATE_OPEN));
+ logger->set(l_mdssm_session_stale,
+ get_session_count_in_state(Session::STATE_STALE));
}
+
return session->get_state_seq();
}
diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h
index 10e87a713e1..6606cafff26 100644
--- a/src/mds/SessionMap.h
+++ b/src/mds/SessionMap.h
@@ -41,6 +41,8 @@ enum {
l_mdssm_session_count,
l_mdssm_session_add,
l_mdssm_session_remove,
+ l_mdssm_session_open,
+ l_mdssm_session_stale,
l_mdssm_last,
};
@@ -684,6 +686,11 @@ public:
*/
void save_if_dirty(const std::set<entity_name_t> &tgt_sessions,
MDSGatherBuilder *gather_bld);
+
+private:
+ uint64_t get_session_count_in_state(int state) {
+ return !is_any_state(state) ? 0 : by_state[state]->size();
+ }
};
std::ostream& operator<<(std::ostream &out, const Session &s);