Skip to content

feat: Improve faro.receiver.sourcemaps caching strategy#4337

Merged
kalleep merged 40 commits intografana:mainfrom
mateagluhak:improve-faro-receiver-sourcemap-caching
Jan 21, 2026
Merged

feat: Improve faro.receiver.sourcemaps caching strategy#4337
kalleep merged 40 commits intografana:mainfrom
mateagluhak:improve-faro-receiver-sourcemap-caching

Conversation

@mateagluhak
Copy link
Contributor

@mateagluhak mateagluhak commented Sep 3, 2025

PR Description

Alloy currently stores all source maps in memory (cache) indefinitely. This can become an issue if you are running an instance with a lot of big source maps where frontend application versions often change as it can lead to OOM. I've added an option to clear source maps from cache if they were not used after the specified time has passed.
In this PR I've also changed the behavior of the cache when download/parsing of sourcemaps fails. Before, errors would be cached and download would not be retried. With this solution you can specify an interval in which you want to check if there are any errors cached and remove them, after which Alloy will reattempt to download.

Which issue(s) this PR fixes

No issue filed.

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated

…ps can be removed from cache if cache minimum ttl is specified
@mateagluhak mateagluhak requested review from a team and clayton-cornell as code owners September 3, 2025 15:29
@CLAassistant
Copy link

CLAassistant commented Sep 3, 2025

CLA assistant check
All committers have signed the CLA.

@clayton-cornell clayton-cornell requested a review from a team September 4, 2025 19:35
Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Sep 25, 2025
@mateagluhak mateagluhak requested a review from kalleep September 26, 2025 12:22
@mateagluhak
Copy link
Contributor Author

mateagluhak commented Dec 10, 2025

Hi @kalleep, any updates on this?

@mateagluhak mateagluhak requested a review from kalleep December 15, 2025 14:42
@mateagluhak mateagluhak requested a review from kalleep December 16, 2025 11:36
@kalleep kalleep changed the title Improvements to cache for source maps (faro.receiver.sourcemaps) feat: improve faro.receiver.sourcemaps caching strategy Jan 14, 2026
@kalleep kalleep changed the title feat: improve faro.receiver.sourcemaps caching strategy feat: Improve faro.receiver.sourcemaps caching strategy Jan 14, 2026
Copy link
Contributor

@kalleep kalleep left a comment

Choose a reason for hiding this comment

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

Looks good, just one more comment!

@mateagluhak
Copy link
Contributor Author

Looks good, just one more comment!

Hey @kalleep, I've changed RWMutex to Mutex in sourcemap cache.

@kalleep
Copy link
Contributor

kalleep commented Jan 19, 2026

Great there are some linting issues https://github.com/grafana/alloy/actions/runs/21137540434/job/60791161970?pr=4337

@clayton-cornell
Copy link
Contributor

Revisited the docs and suggested some improvements

mateagluhak and others added 6 commits January 21, 2026 14:45
Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
@mateagluhak
Copy link
Contributor Author

mateagluhak commented Jan 21, 2026

Great there are some linting issues https://github.com/grafana/alloy/actions/runs/21137540434/job/60791161970?pr=4337

I've removed the unnecessary whitespaces.

@kalleep kalleep merged commit 41e655c into grafana:main Jan 21, 2026
44 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age type/docs Docs Squad label across all Grafana Labs repos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants