Skip to content

perf(loki.secretfilter): Small improvements in redactLine#5994

Merged
kleimkuhler merged 4 commits intomainfrom
kleimkuhler/secretfilter-improvements
Apr 7, 2026
Merged

perf(loki.secretfilter): Small improvements in redactLine#5994
kleimkuhler merged 4 commits intomainfrom
kleimkuhler/secretfilter-improvements

Conversation

@kleimkuhler
Copy link
Copy Markdown
Member

@kleimkuhler kleimkuhler commented Apr 6, 2026

Brief description of Pull Request

Two small performance improvements to the loki.secretfilter hot path

Pull Request Details

  • Move origin label lookup out of the per-finding loop in redactLine
  • Remove per-redaction overhead of new hasher and fmt.Sprintf

Issue(s) fixed by this Pull Request

Notes to the Reviewer

PR Checklist

@kleimkuhler kleimkuhler requested a review from a team as a code owner April 6, 2026 16:02
@kleimkuhler kleimkuhler requested review from mikefat and removed request for a team April 6, 2026 16:02
@kleimkuhler
Copy link
Copy Markdown
Member Author

This will likely conflict with #5970

Comment thread internal/component/loki/secretfilter/secretfilter.go
@kleimkuhler kleimkuhler requested a review from kalleep April 6, 2026 16:12
Comment thread internal/component/loki/secretfilter/secretfilter.go Fixed
We originally opted for SHA1 in large part for speed - the goal with hashing
the secret is not to keep it entirely secret, but to efficiently conceal it
from all but the most determined attackers.

After running benchmarks, sha256 is 2.09% slower, and we're looking for
every gain we can take right now.
…ter-improvements

# Conflicts:
#	internal/component/loki/secretfilter/secretfilter.go
@kleimkuhler
Copy link
Copy Markdown
Member Author

After some team discussion, we changed back to sha1 as mentioned in the commit message

We originally opted for SHA1 in large part for speed - the goal with hashing
the secret is not to keep it entirely secret, but to efficiently conceal it
from all but the most determined attackers.

After running benchmarks, sha256 is 2.09% slower, and we're looking for
every gain we can take right now.

Copy link
Copy Markdown
Contributor

@mikefat mikefat left a comment

Choose a reason for hiding this comment

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

LGTM

@kleimkuhler kleimkuhler merged commit 529be75 into main Apr 7, 2026
51 checks passed
@kleimkuhler kleimkuhler deleted the kleimkuhler/secretfilter-improvements branch April 7, 2026 22:20
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants