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

Adds minimal traceparent header support to Elasticsearch backport(#74210) #75331

Merged
merged 5 commits into from
Aug 3, 2021

Conversation

pgomulka
Copy link
Contributor

@pgomulka pgomulka commented Jul 14, 2021

This adds just enough support for the traceparent header to be useful in es7
Contrary to es8 in 7.x branch the logs are in custom JSON format - not in ECS.
trace.id is added to deprecation, slow logs and server JSON logs

backport #74210

This adds just enough support for the traceparent header to be useful in es8.
Since Elasticsearch already logs in ECS format extending it with support for transaction.id and trace.id is a quick win.
This allows us to surface server/deprecation slow logs from an instrumented application using the Trace Logs feature.
Parsing `traceparent` in http layer and populating tasks with `trace_id` which is preserved in thread context.
@pgomulka pgomulka self-assigned this Jul 14, 2021
@pgomulka pgomulka changed the title Adds minimal traceparent header support to Elasticsearch (#74210) Adds minimal traceparent header support to Elasticsearch backport(#74210) Jul 14, 2021
@pgomulka pgomulka added :Core/Infra/Logging Log management and logging utilities backport labels Jul 14, 2021
@pgomulka pgomulka marked this pull request as ready for review July 14, 2021 15:04
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jul 14, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@@ -63,7 +63,7 @@ appender.deprecation_rolling.name = deprecation_rolling
appender.deprecation_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.json
appender.deprecation_rolling.layout.type = ESJsonLayout
appender.deprecation_rolling.layout.type_name = deprecation.elasticsearch
appender.deprecation_rolling.layout.esmessagefields=x-opaque-id
appender.deprecation_rolling.layout.esmessagefields=x-opaque-id,key
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pgomulka pgomulka requested a review from pugnascotia July 21, 2021 07:41
@@ -310,6 +310,14 @@ public static String getXOpaqueId() {
.orElse("");
}

public static String getTraceId() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this called anywhere? TraceIdConverter has its own implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good find. I have removed that method.

@pgomulka pgomulka requested a review from pugnascotia July 30, 2021 10:31
@pgomulka pgomulka merged commit 6d2dd1f into elastic:7.x Aug 3, 2021
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Dec 8, 2021
elastic#75331 missed adding
trace.id to indexed deprecation logs (they use ECSJsonLayout instead of
ESJsonLayout).
pgomulka added a commit that referenced this pull request Dec 9, 2021
#75331 missed adding
trace.id to indexed deprecation logs (these use ECSJsonLayout instead of
ESJsonLayout).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Core/Infra/Logging Log management and logging utilities Team:Core/Infra Meta label for core/infra team v7.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants