Skip to content

Commit dfc1294

Browse files
Jimmy Lufacebook-github-bot
authored andcommitted
Move ODSL exporter to cachelib/facebook folder for external use
Summary: Library who uses CacheLib may not get to modify their clients' service monitoring config. This enables any CacheLib client to directly export stats to ODS. (Same way as CacheBench) reference to original user question: https://fb.workplace.com/groups/cachelibusers/posts/2314564142064048 Reviewed By: jaesoo-fb Differential Revision: D47957568 fbshipit-source-id: 64a51fdaeb0b282f82dfd0c33795726463d6464b
1 parent a0aa0b7 commit dfc1294

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

cachelib/cachebench/cache/Cache-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Cache<Allocator>::Cache(const CacheConfig& config,
258258
allocatorConfig_.setNvmAdmissionMinTTL(config_.memoryOnlyTTL);
259259
}
260260

261-
allocatorConfig_.cacheName = "cachebench";
261+
allocatorConfig_.cacheName = kCachebenchCacheName;
262262

263263
bool isRecovered = false;
264264
if (!allocatorConfig_.cacheDir.empty()) {

cachelib/cachebench/cache/Cache.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ DECLARE_string(report_ac_memory_usage_stats);
4949
namespace facebook {
5050
namespace cachelib {
5151
namespace cachebench {
52+
constexpr folly::StringPiece kCachebenchCacheName = "cachebench";
53+
5254
// An admission policy that rejects items that was last accessed more than
5355
// X seconds ago. This is useful to simulate workloads where we provide a
5456
// retention (soft) guarantee.

cachelib/cachebench/main.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#ifdef CACHEBENCH_FB_ENV
2929
#include "cachelib/cachebench/facebook/FbDep.h"
3030
#include "cachelib/cachebench/facebook/fb303/FB303ThriftServer.h"
31-
#include "cachelib/cachebench/facebook/odsl_exporter/OdslExporter.h"
31+
#include "cachelib/facebook/odsl_exporter/OdslExporter.h"
3232
#include "common/init/Init.h"
3333
#else
3434
#include <folly/init/Init.h>
@@ -113,6 +113,7 @@ bool checkArgsValidity() {
113113
}
114114

115115
int main(int argc, char** argv) {
116+
using namespace facebook::cachelib;
116117
using namespace facebook::cachelib::cachebench;
117118

118119
#ifdef CACHEBENCH_FB_ENV
@@ -124,10 +125,10 @@ int main(int argc, char** argv) {
124125
CacheBenchConfig config(FLAGS_json_test_config,
125126
customizeCacheConfigForFacebook,
126127
customizeStressorConfigForFacebook);
127-
std::unique_ptr<OdslExporter> odslExporter_;
128+
std::unique_ptr<util::OdslExporter> odslExporter_;
128129
std::unique_ptr<FB303ThriftService> fb303_;
129130
if (FLAGS_fb303_port == 0 && FLAGS_export_to_ods) {
130-
odslExporter_ = std::make_unique<OdslExporter>();
131+
odslExporter_ = std::make_unique<util::OdslExporter>(kCachebenchCacheName);
131132
} else if (FLAGS_fb303_port > 0) {
132133
fb303_ = std::make_unique<FB303ThriftService>(FLAGS_fb303_port);
133134
}

0 commit comments

Comments
 (0)