#include "../../../common/async/yield_context.h"
#include "common/async/blocked_completion.h"
-#include "common/dout.h"
+#include "common/dout.h"
+#include "rgw_perf_counters.h"
namespace rgw { namespace d4n {
age = std::max(it->second->localWeight, age);
erase(dpp, key, y);
+
+ if (perfcounter) {
+ perfcounter->inc(l_rgw_d4n_cache_evictions);
+ }
freeSpace = cacheDriver->get_free_space(dpp);
}
*
*/
+#include "rgw_perf_counters.h"
#include "rgw_sal_d4n.h"
namespace rgw { namespace sal {
is_latest_version = false;
}
if (!get_obj_attrs_from_cache(dpp, y)) {
+ if(perfcounter) {
+ perfcounter->inc(l_rgw_d4n_cache_misses);
+ }
std::string head_oid_in_cache;
rgw::sal::Attrs attrs;
std::string version;
} else {
ldpp_dout(dpp, 0) << "D4NFilterObject::" << __func__ << "(): failed to cache head object in cache backend, ret=" << ret << dendl;
}
+ } else {
+ if(perfcounter) {
+ perfcounter->inc(l_rgw_d4n_cache_hits);
+ }
}
return 0;
is_latest_version = false;
}
if (!source->get_obj_attrs_from_cache(dpp, y)) {
+ if(perfcounter) {
+ perfcounter->inc(l_rgw_d4n_cache_misses);
+ }
std::string head_oid_in_cache;
rgw::sal::Attrs attrs;
std::string version;
} else {
ldpp_dout(dpp, 0) << "D4NFilterObject::" << __func__ << "(): failed to cache head object during eviction, ret=" << ret << dendl;
}
+ } else {
+ if(perfcounter) {
+ perfcounter->inc(l_rgw_d4n_cache_hits);
+ }
}
return 0;
offset += bl.length();
completed.pop_front_and_dispose(std::default_delete<rgw::AioResultEntry>{});
+ if(perfcounter) {
+ perfcounter->inc(l_rgw_d4n_cache_hits);
+ }
}
ldpp_dout(dpp, 20) << "D4NFilterObject::returning from flush:: " << dendl;
this->cb->set_ofs(ofs);
auto r = next->iterate(dpp, ofs, end, this->cb.get(), y);
+
+ //calculate the number of blocks read from backend store, and increment the perfcounter using that
+ if(perfcounter) {
+ uint64_t len_to_read_from_store = ((end - ofs) + 1);
+ uint64_t num_blocks = (len_to_read_from_store%obj_max_req_size) == 0 ? len_to_read_from_store/obj_max_req_size : (len_to_read_from_store/obj_max_req_size) + 1;
+ perfcounter->inc(l_rgw_d4n_cache_misses, num_blocks);
+ }
if (r < 0) {
ldpp_dout(dpp, 0) << "D4NFilterObject::iterate:: " << __func__ << "(): Error: failed to fetch object from backend store, ret=" << r << dendl;
pcb->add_u64_counter(l_rgw_lua_script_ok, "lua_script_ok", "Successful executions of Lua scripts");
pcb->add_u64_counter(l_rgw_lua_script_fail, "lua_script_fail", "Failed executions of Lua scripts");
pcb->add_u64(l_rgw_lua_current_vms, "lua_current_vms", "Number of Lua VMs currently being executed");
+
+ pcb->add_u64_counter(l_rgw_d4n_cache_hits, "d4n_cache_hits", "D4N cache hits");
+ pcb->add_u64_counter(l_rgw_d4n_cache_misses, "d4n_cache_misses", "D4N cache misses");
+ pcb->add_u64_counter(l_rgw_d4n_cache_evictions, "d4n_cache_evictions", "D4N cache evictions");
}
void add_rgw_op_counters(PerfCountersBuilder *lpcb) {