-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Add trace.id to indexed deprecation logs #81524
Add trace.id to indexed deprecation logs #81524
Conversation
elastic#75331 missed adding trace.id to indexed deprecation logs (they use ECSJsonLayout instead of ESJsonLayout).
Pinging @elastic/es-core-infra (Team:Core/Infra) |
@elasticmachine run elasticsearch-ci/packaging-tests-windows-sample |
@@ -52,7 +52,7 @@ public static String getTraceId() { | |||
public void format(LogEvent event, StringBuilder toAppendTo) { | |||
String traceId = getTraceId(); | |||
if (traceId != null) { | |||
toAppendTo.append("\"trace.id\": \"" + traceId + "\""); | |||
toAppendTo.append(traceId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this change? Is it so that we can reuse the traceId formatter in EcsJsonLayout.java?
I wonder if this changes behaviour a bit, previously if traceId was null the format would not append anything, but now we might get "trace.id:null". Is that OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe notEmpty is smart enough ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, notEmpty will check if any of the variables in its "body" are evaluated .
There should be no field name if the value is null
and yes, the reason for this change was to reuse it in ECSJasonLayout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
#75331 missed adding
trace.id to indexed deprecation logs (these use ECSJsonLayout instead of
ESJsonLayout).
gradle check
?