-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
refactor: Remove unnecessary spanlogger usage #13255
Conversation
pkg/logql/engine.go
Outdated
@@ -265,7 +263,7 @@ func (q *query) Exec(ctx context.Context) (logqlmodel.Result, error) { | |||
queueTime, _ := ctx.Value(httpreq.QueryQueueTimeHTTPHeader).(time.Duration) | |||
|
|||
statResult := statsCtx.Result(time.Since(start), queueTime, q.resultLength(data)) | |||
statResult.Log(level.Debug(spLogger)) | |||
statResult.LogWithSpan(sp) |
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.
I wonder about a little bit different approach where we leave the original stats.Log() method and use that to print the stats in metrics.go.
But here do: sp.LogKV(statResult.KVList()...)
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.
i like your style more but fyi we use LogWithSpan
at other places. I'll try using LogKV
there too then.
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.
pushed 0c9570a addressing it
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!
What this PR does / why we need it:
Historically, we've been using
spanlogger
to enrich our spans. That isn't the right usage for it (as of now), as they'll be emitting log lines. Our current usage is causing:With this PR I'm moving away from
spanlogger
all places where the log message is too bad or nonexistent. That's because these cases are indicating we don't care about that log line at all, and only about the data injected in the span.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Checklist
CONTRIBUTING.md
guide (required)feat
PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.docs/sources/setup/upgrade/_index.md
production/helm/loki/Chart.yaml
and updateproduction/helm/loki/CHANGELOG.md
andproduction/helm/loki/README.md
. Example PRdeprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR