@@ -151,7 +151,7 @@ public void onFailure(Exception e) {
151
151
e .fillInStackTrace ();
152
152
assertThat (e .getStackTrace ().length , is (not (0 )));
153
153
listener .onFailure (e );
154
- listener = maybeWrapListenerForStackTrace (listener , TransportVersion .current (), "node" , shardId , threadPool );
154
+ listener = maybeWrapListenerForStackTrace (listener , TransportVersion .current (), "node" , shardId , 123L , threadPool );
155
155
isWrapped .set (true );
156
156
listener .onFailure (e );
157
157
}
@@ -160,16 +160,17 @@ public void testMaybeWrapListenerForStackTraceDebugLog() {
160
160
final String nodeId = "node" ;
161
161
final String index = "index" ;
162
162
ShardId shardId = new ShardId (index , index , 0 );
163
+ final long taskId = 123L ;
163
164
164
165
try (var mockLog = MockLog .capture (SearchService .class )) {
165
166
Configurator .setLevel (SearchService .class , Level .DEBUG );
166
167
final String exceptionMessage = "test exception message" ;
167
168
mockLog .addExpectation (
168
169
new MockLog .ExceptionSeenEventExpectation (
169
- format ("\" [%s]%s: failed to execute search request\" and an exception logged" , nodeId , shardId ),
170
+ format ("\" [%s]%s: failed to execute search request for task [%d] \" and an exception logged" , nodeId , shardId , taskId ),
170
171
SearchService .class .getCanonicalName (),
171
172
Level .DEBUG , // We will throw a 400-level exception, so it should only be logged at the debug level
172
- format ("[%s]%s: failed to execute search request" , nodeId , shardId ),
173
+ format ("[%s]%s: failed to execute search request for task [%d] " , nodeId , shardId , taskId ),
173
174
IllegalArgumentException .class ,
174
175
exceptionMessage
175
176
)
@@ -188,7 +189,7 @@ public void onFailure(Exception e) {
188
189
}
189
190
};
190
191
IllegalArgumentException e = new IllegalArgumentException (exceptionMessage ); // 400-level exception
191
- listener = maybeWrapListenerForStackTrace (listener , TransportVersion .current (), nodeId , shardId , threadPool );
192
+ listener = maybeWrapListenerForStackTrace (listener , TransportVersion .current (), nodeId , shardId , taskId , threadPool );
192
193
listener .onFailure (e );
193
194
}
194
195
}
@@ -197,15 +198,16 @@ public void testMaybeWrapListenerForStackTraceWarnLog() {
197
198
final String nodeId = "node" ;
198
199
final String index = "index" ;
199
200
ShardId shardId = new ShardId (index , index , 0 );
201
+ final long taskId = 123L ;
200
202
201
203
try (var mockLog = MockLog .capture (SearchService .class )) {
202
204
final String exceptionMessage = "test exception message" ;
203
205
mockLog .addExpectation (
204
206
new MockLog .ExceptionSeenEventExpectation (
205
- format ("\" [%s]%s: failed to execute search request\" and an exception logged" , nodeId , shardId ),
207
+ format ("\" [%s]%s: failed to execute search request for task [%d] \" and an exception logged" , nodeId , shardId , taskId ),
206
208
SearchService .class .getCanonicalName (),
207
209
Level .WARN , // We will throw a 500-level exception, so it should be logged at the warn level
208
- format ("[%s]%s: failed to execute search request" , nodeId , shardId ),
210
+ format ("[%s]%s: failed to execute search request for task [%d] " , nodeId , shardId , taskId ),
209
211
IllegalStateException .class ,
210
212
exceptionMessage
211
213
)
@@ -224,7 +226,7 @@ public void onFailure(Exception e) {
224
226
}
225
227
};
226
228
IllegalStateException e = new IllegalStateException (exceptionMessage ); // 500-level exception
227
- listener = maybeWrapListenerForStackTrace (listener , TransportVersion .current (), nodeId , shardId , threadPool );
229
+ listener = maybeWrapListenerForStackTrace (listener , TransportVersion .current (), nodeId , shardId , taskId , threadPool );
228
230
listener .onFailure (e );
229
231
}
230
232
}
0 commit comments