Skip to content

Commit 9770442

Browse files
authored
Add logging so we can time the downsampling action (#137496)
We suspect that #137148 is caused by a legit timeout and not that it failed to notify the listener. In order to verify that we added some extra logging lines that allow us to better track the time. More details in #137148 (comment)
1 parent e1c852b commit 9770442

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/DownsampleTransportFailureIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
3131
import org.elasticsearch.test.ESIntegTestCase;
3232
import org.elasticsearch.test.InternalTestCluster;
33+
import org.elasticsearch.test.junit.annotations.TestIssueLogging;
3334
import org.elasticsearch.test.transport.MockTransportService;
3435
import org.elasticsearch.xcontent.XContentBuilder;
3536
import org.elasticsearch.xcontent.XContentFactory;
@@ -264,6 +265,10 @@ private void assertIndexDoesNotExist(final String nodeName, final String indexNa
264265
assertEquals("no such index [" + indexName + "]", targetIndexNotFoundException.getMessage());
265266
}
266267

268+
@TestIssueLogging(
269+
value = "org.elasticsearch.xpack.downsample.TransportDownsampleAction:DEBUG",
270+
issueUrl = "https://github.com/elastic/elasticsearch/issues/137148"
271+
)
267272
public void testNoDisruption() {
268273
// GIVEN
269274

@@ -278,6 +283,7 @@ public void testNoDisruption() {
278283
// WHEN nothing happens
279284

280285
// THEN
286+
logger.info("Executing downsample action from [{}] to [{}]", SOURCE_INDEX_NAME, TARGET_INDEX_NAME);
281287
final AcknowledgedResponse downsampleResponse = testCluster.masterClient()
282288
.execute(DownsampleAction.INSTANCE, downsampleRequest)
283289
.actionGet(TimeValue.timeValueMillis(DOWNSAMPLE_ACTION_TIMEOUT_MILLIS));

x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/TransportDownsampleAction.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ protected void masterOperation(
238238
ClusterState state,
239239
ActionListener<AcknowledgedResponse> listener
240240
) {
241+
logger.debug(
242+
"Starting downsampling [{}] with [{}] interval",
243+
request.getSourceIndex(),
244+
request.getDownsampleConfig().getFixedInterval()
245+
);
241246
long startTime = nowSupplier.get();
242247
String sourceIndexName = request.getSourceIndex();
243248
IndexNameExpressionResolver.assertExpressionHasNullOrDataSelector(sourceIndexName);
@@ -1025,6 +1030,7 @@ private void createDownsampleIndex(
10251030
taskQueue.submitTask("create-downsample-index [" + downsampleIndexName + "]", new DownsampleClusterStateUpdateTask(listener) {
10261031
@Override
10271032
public ClusterState execute(ClusterState currentState) throws Exception {
1033+
logger.debug("Creating downsample index [{}]", downsampleIndexName);
10281034
return metadataCreateIndexService.applyCreateIndexRequest(
10291035
currentState,
10301036
createIndexClusterStateUpdateRequest,
@@ -1086,6 +1092,7 @@ class UpdateDownsampleIndexSettingsActionListener implements ActionListener<Ackn
10861092

10871093
@Override
10881094
public void onResponse(final AcknowledgedResponse response) {
1095+
logger.debug("Preparing to refresh downsample index [{}]", downsampleIndexName);
10891096
final RefreshRequest request = new RefreshRequest(downsampleIndexName);
10901097
request.setParentTask(parentTask);
10911098
client.admin()
@@ -1150,6 +1157,7 @@ public void onResponse(final BroadcastResponse response) {
11501157

11511158
@Override
11521159
public ClusterState execute(ClusterState currentState) {
1160+
logger.debug("Updating downsample index status for [{}]", downsampleIndexName);
11531161
final ProjectMetadata project = currentState.metadata().getProject(projectId);
11541162
final IndexMetadata downsampleIndex = project.index(downsampleIndexName);
11551163
if (IndexMetadata.INDEX_DOWNSAMPLE_STATUS.get(downsampleIndex.getSettings()) == DownsampleTaskStatus.SUCCESS) {
@@ -1201,6 +1209,7 @@ class FlushActionListener implements ActionListener<AcknowledgedResponse> {
12011209

12021210
@Override
12031211
public void onResponse(final AcknowledgedResponse response) {
1212+
logger.debug("Preparing to flush downsample index [{}]", downsampleIndexName);
12041213
FlushRequest request = new FlushRequest(downsampleIndexName);
12051214
request.setParentTask(parentTask);
12061215
client.admin()
@@ -1239,12 +1248,14 @@ class MeasurementActionListener implements ActionListener<AcknowledgedResponse>
12391248
@Override
12401249
public void onResponse(final AcknowledgedResponse response) {
12411250
recordSuccessMetrics(startTime);
1251+
logger.debug("Downsampling measured successfully");
12421252
actionListener.onResponse(AcknowledgedResponse.TRUE);
12431253
}
12441254

12451255
@Override
12461256
public void onFailure(Exception e) {
12471257
recordSuccessMetrics(startTime);
1258+
logger.debug("Downsampling measured successfully", e);
12481259
this.actionListener.onFailure(e);
12491260
}
12501261

0 commit comments

Comments
 (0)