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

Log correlation for operator APM traces #5883

Merged
merged 20 commits into from
Aug 17, 2022
Merged

Conversation

pebrc
Copy link
Collaborator

@pebrc pebrc commented Jul 20, 2022

Add log correlation to APM tracing. This replaces global log variables with loggers retrieved from a context object which carries the necessary transaction and span information for correlation.

@botelastic botelastic bot added the triage label Jul 20, 2022
@pebrc pebrc added the >enhancement Enhancement of existing functionality label Jul 20, 2022
@botelastic botelastic bot removed the triage label Jul 20, 2022
@pebrc pebrc marked this pull request as ready for review July 22, 2022 12:59
@naemono naemono self-assigned this Aug 2, 2022
Copy link
Contributor

@naemono naemono left a comment

Choose a reason for hiding this comment

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

Haven't finished review yet. Couple questions from start of review.

@@ -107,7 +107,7 @@ func buildOutputConfig(params Params) (*settings.CanonicalConfig, error) {
return settings.NewCanonicalConfig(), nil
}

credentials, err := association.ElasticsearchAuthSettings(params.Client, assoc)
credentials, err := association.ElasticsearchAuthSettings(params.Context, params.Client, assoc)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not exactly related to this PR, but why are we storing context?

https://pkg.go.dev/context#pkg-overview

Do not store Contexts inside a struct type; instead, pass a Context explicitly to each function that needs it. The Context should be the first parameter, typically named ctx:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess because the struct here is just a parameter object but I agree it is maybe not ideal.

pkg/controller/association/reconciler.go Outdated Show resolved Hide resolved
@pebrc pebrc requested a review from naemono August 16, 2022 07:05
Copy link
Contributor

@naemono naemono left a comment

Choose a reason for hiding this comment

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

lgtm.

@pebrc pebrc merged commit 85aa75b into elastic:main Aug 17, 2022
@pebrc pebrc added the v2.5.0 label Oct 5, 2022
@pebrc pebrc changed the title Log correlation Log correlation for operator APM traces Oct 5, 2022
fantapsody pushed a commit to fantapsody/cloud-on-k8s that referenced this pull request Feb 7, 2023
Add log correlation to APM tracing. This replaces global log variables with loggers retrieved from a context object which carries the necessary transaction and span information for correlation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v2.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants