Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSDB: RollupShardIndexer improve logger #88416

Merged
merged 5 commits into from
Jul 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class RollupShardIndexer {
}

public RollupIndexerAction.ShardRollupResponse execute() throws IOException {
long startTime = System.currentTimeMillis();
BulkProcessor bulkProcessor = createBulkProcessor();
try (searcher; bulkProcessor) {
// TODO: add cancellations
Expand All @@ -138,11 +139,12 @@ public RollupIndexerAction.ShardRollupResponse execute() throws IOException {
}

logger.info(
"Shard {} successfully sent [{}], indexed [{}], failed [{}]",
"Shard [{}] successfully sent [{}], indexed [{}], failed [{}], took [{}]",
indexShard.shardId(),
numSent.get(),
numIndexed.get(),
numFailed.get()
numFailed.get(),
TimeValue.timeValueMillis(System.currentTimeMillis() - startTime)
);

if (numIndexed.get() != numSent.get()) {
Expand Down Expand Up @@ -239,13 +241,15 @@ public void collect(int docId, long owningBucketOrd) throws IOException {
lastHistoTimestamp = rounding.round(timestamp);
}

logger.trace(
"Doc: [{}] - _tsid: [{}], @timestamp: [{}}] -> rollup bucket ts: [{}]",
docId,
DocValueFormat.TIME_SERIES_ID.format(tsid),
timestampFormat.format(timestamp),
timestampFormat.format(lastHistoTimestamp)
);
if (logger.isTraceEnabled()) {
logger.trace(
"Doc: [{}] - _tsid: [{}], @timestamp: [{}}] -> rollup bucket ts: [{}]",
docId,
DocValueFormat.TIME_SERIES_ID.format(tsid),
timestampFormat.format(timestamp),
timestampFormat.format(lastHistoTimestamp)
);
}

/*
* Sanity checks to ensure that we receive documents in the correct order
Expand Down Expand Up @@ -349,11 +353,14 @@ public RollupBucketBuilder init(BytesRef tsid, long timestamp) {
this.timestamp = timestamp;
this.docCount = 0;
this.metricFieldProducers.values().stream().forEach(p -> p.reset());
logger.trace(
"New bucket for _tsid: [{}], @timestamp: [{}]",
DocValueFormat.TIME_SERIES_ID.format(tsid),
timestampFormat.format(timestamp)
);
if (logger.isTraceEnabled()) {
logger.trace(
"New bucket for _tsid: [{}], @timestamp: [{}]",
DocValueFormat.TIME_SERIES_ID.format(tsid),
timestampFormat.format(timestamp)
);
}

return this;
}

Expand Down