Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Remove request id in response listener logging #1027

Conversation

dai-chen
Copy link
Member

@dai-chen dai-chen commented Feb 3, 2021

Issue #, if available: N/A

Description of changes: For some reason, request ID in thread context may not be populated. In response listener, another exception thrown from work thread when logging. In this case, Kibana hung there due to the uncaught exception.

java.lang.IllegalStateException: Request id not present in current context
  at com.amazon.opendistroforelasticsearch.sql.legacy.utils.LogUtils.getRequestId(LogUtils.java:54) ~[?:?]
  at com.amazon.opendistroforelasticsearch.sql.legacy.plugin.RestSQLQueryAction.logAndPublishMetrics(RestSQLQueryAction.java:217) ~[?:?]
  at com.amazon.opendistroforelasticsearch.sql.legacy.plugin.RestSQLQueryAction.access$200(RestSQLQueryAction.java:74) ~[?:?]
  at com.amazon.opendistroforelasticsearch.sql.legacy.plugin.RestSQLQueryAction$2.onFailure(RestSQLQueryAction.java:197) ~[?:?]
  at com.amazon.opendistroforelasticsearch.sql.elasticsearch.executor.ElasticsearchExecutionEngine.lambda$execute$0(ElasticsearchExecutionEngine.java:57) ~[?:?]
  at com.amazon.opendistroforelasticsearch.sql.elasticsearch.client.ElasticsearchNodeClient.lambda$withCurrentContext$5(ElasticsearchNodeClient.java:188) ~[?:?]
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:660) ~[elasticsearch-7.9.1.jar:7.9.1]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
  at java.lang.Thread.run(Thread.java:834) [?:?]

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Feb 3, 2021

Codecov Report

Merging #1027 (c505f10) into develop (d7cfad6) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #1027   +/-   ##
==========================================
  Coverage      99.87%   99.87%           
- Complexity      2415     2474   +59     
==========================================
  Files            234      236    +2     
  Lines           5544     5623   +79     
  Branches         358      362    +4     
==========================================
+ Hits            5537     5616   +79     
  Misses             5        5           
  Partials           2        2           
Impacted Files Coverage Δ Complexity Δ
...arch/data/value/ElasticsearchExprValueFactory.java 100.00% <0.00%> (ø) 80.00% <0.00%> (+20.00%)
...ticsearch/data/utils/ElasticsearchJsonContent.java 100.00% <0.00%> (ø) 20.00% <0.00%> (?%)
...ch/sql/elasticsearch/data/utils/ObjectContent.java 100.00% <0.00%> (ø) 19.00% <0.00%> (?%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7cfad6...c505f10. Read the comment docs.

@dai-chen dai-chen closed this Feb 3, 2021
@dai-chen dai-chen reopened this Feb 4, 2021
@dai-chen dai-chen added the SQL label Feb 4, 2021
@dai-chen dai-chen self-assigned this Feb 4, 2021
@dai-chen dai-chen marked this pull request as ready for review February 4, 2021 03:44
Copy link
Contributor

@penghuo penghuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dai-chen dai-chen merged commit 316726c into opendistro-for-elasticsearch:develop Feb 4, 2021
@dai-chen dai-chen deleted the fix-log-request-id-issue branch February 4, 2021 22:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants