Skip to content

Commit 34093ae

Browse files
author
Xin Dong
committed
Move the constant into knobs
1 parent 07f49aa commit 34093ae

File tree

5 files changed

+4
-5
lines changed

5 files changed

+4
-5
lines changed

src/Constants.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,5 @@ const char* MT_TIME_INSERT_LATENCY_US = "dl_insert_latency_useconds";
7676
const char* MT_HIST_INSERT_SZ = "dl_insert_size_bytes";
7777
const char* MT_HIST_TR_PER_REQUEST = "dl_tr_per_request";
7878
const char* MT_RATE_IDX_REBUILD = "dl_index_rebuild_rate";
79-
const uint64_t SLOW_QUERY_THRESHOLD_MICRO_SECONDS = 10000;
8079

8180
} // namespace DocLayerConstants

src/Constants.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ extern const char* MT_TIME_INSERT_LATENCY_US;
8989
extern const char* MT_HIST_INSERT_SZ;
9090
extern const char* MT_HIST_TR_PER_REQUEST;
9191
extern const char* MT_RATE_IDX_REBUILD;
92-
// TODO: make this part of the knob/options instead of constants?
93-
extern const uint64_t SLOW_QUERY_THRESHOLD_MICRO_SECONDS;
9492

9593
} // namespace DocLayerConstants
9694

src/ExtMsg.actor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,9 @@ ACTOR static Future<Void> doRun(Reference<ExtMsgQuery> query, Reference<ExtConne
517517
uint64_t queryLatencyMicroSeconds = (timer_int() - startTime) / 1000;
518518
DocumentLayer::metricReporter->captureTime(DocLayerConstants::MT_TIME_QUERY_LATENCY_US, queryLatencyMicroSeconds);
519519

520-
if (slowQueryLogging && queryLatencyMicroSeconds >= DocLayerConstants::SLOW_QUERY_THRESHOLD_MICRO_SECONDS) {
520+
if (slowQueryLogging && queryLatencyMicroSeconds >= DOCLAYER_KNOBS->SLOW_QUERY_THRESHOLD_MICRO_SECONDS) {
521521
TraceEvent(SevWarn, "SlowQuery")
522-
.detail("ThresholdMicroSeconds", DocLayerConstants::SLOW_QUERY_THRESHOLD_MICRO_SECONDS)
522+
.detail("ThresholdMicroSeconds", DOCLAYER_KNOBS->SLOW_QUERY_THRESHOLD_MICRO_SECONDS)
523523
.detail("DurationMicroSeconds", queryLatencyMicroSeconds)
524524
.detail("Query", query->toString());
525525
}

src/Knobs.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ DocLayerKnobs::DocLayerKnobs(bool enable) {
4444
init(MAX_RETURNABLE_DATA_SIZE, (1 << 20) * 16);
4545
init(CURSOR_EXPIRY, 60 * 10); /* seconds */
4646
init(DEFAULT_RETURNABLE_DATA_SIZE, (1 << 20) * 4);
47+
init(SLOW_QUERY_THRESHOLD_MICRO_SECONDS, 10 * 1000 * 1000);
4748
}
4849

4950
bson::BSONObj DocLayerKnobs::dumpKnobs() const {

src/Knobs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class DocLayerKnobs : public Knobs {
3737
int MAX_RETURNABLE_DATA_SIZE;
3838
int CURSOR_EXPIRY;
3939
int DEFAULT_RETURNABLE_DATA_SIZE;
40+
int SLOW_QUERY_THRESHOLD_MICRO_SECONDS;
4041

4142
explicit DocLayerKnobs(bool randomize = false);
4243

0 commit comments

Comments
 (0)