fix(spanlogger): set span error tag when log level is error#7685
Open
Goutham-Annem wants to merge 3 commits into
Open
fix(spanlogger): set span error tag when log level is error#7685Goutham-Annem wants to merge 3 commits into
Goutham-Annem wants to merge 3 commits into
Conversation
The /ingester/flush, /ingester/shutdown, /flush, and /shutdown endpoints previously accepted GET requests, making it possible to accidentally trigger a destructive ingester operation by clicking a link in a browser or by a pre-fetch proxy following links on the index page. Changes: - Route registration for flush/shutdown changed from ["GET","POST"] to ["POST"]. A browser GET (or curl without -X POST) now returns 405 Method Not Allowed. - Index page template updated to render links in the "Dangerous:" section as HTML <form method="POST"> submit buttons rather than plain <a href> anchors, preventing browser-initiated GET requests while keeping the UI functional. - tools/migrate-ingester-statefulsets.sh updated to use `wget --post-data=""` (BusyBox wget supports this flag) so the script continues to work after the GET handler is removed. - Two tests added/extended to assert the POST-form rendering for dangerous links. Fixes cortexproject#3243 Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
Reflects the change introduced in pkg/api/api.go that removed GET from the allowed methods for /ingester/flush, /flush, /ingester/shutdown, and /shutdown. Browsers and scripts must now use POST to trigger these operations. Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
When SpanLogger.Log() is called with level=error in the key-value pairs, the associated span's error tag was not being set, so errors logged through SpanLogger were invisible as errors in tracing UIs. Scan the kvps in Log() for a level=error pair and call ext.Error.Set when found, consistent with the existing Error() method behaviour. Fixes cortexproject#3016 Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
SpanLogger.Log()is called withlevel=errorin the key-value pairs, the associated span's error tag was not being set. This meant errors logged throughSpanLoggerwere invisible as errors in distributed tracing UIs.Changes
Log(), scan the kvps for alevel=errorpair and callext.Error.Set(s.Span, true)— consistent with how the existingError()method behaves.TestSpanLogger_Log_SetsErrorTagOnErrorLevelto verify the behaviour using a mock tracer span.Test
Fixes #3016