Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add filecache prometheus metrics#18089

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 8 commits intomainfromstevenmasley/file_cache_metrics
May 30, 2025

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedMay 28, 2025
edited
Loading

Dynamic parameters has an in memory file cache. This adds prometheus metrics to monitor said cache.

Closescoder/internal#554

@EmyrkEmyrk requested a review fromaslilacMay 28, 2025 20:57
Comment on lines +201 to +204
ev, err := entry.value.Load()
if err == nil {
c.currentCacheSize.Add(-1 * float64(ev.size))
}
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This feels really unfortunate, but it is all cached so it's not an expensive call.

}

content := bytes.NewBuffer(file.Data)
return archivefs.FromTarReader(content), nil
return archivefs.FromTarReader(content),int64(content.Len()),nil
Copy link
Member

Choose a reason for hiding this comment

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

hmm. I really dislike trusting honest reporting of size here. is there not some way we could inspect the size of this entire object from inside the cache at runtime? there might not be but it'd be super slick

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I don't think there is without doing some recursiveStat() call on all the files in the filesystem.

Right here is the cheapest place to do it. If we ever add a compression layer, then this won't be 100% accurate, but at present it does indicate the total number of bytes held in memory by the cache entry.

@EmyrkEmyrk requested a review fromaslilacMay 30, 2025 15:07
@EmyrkEmyrk merged commit9db114d intomainMay 30, 2025
34 checks passed
@EmyrkEmyrk deleted the stevenmasley/file_cache_metrics branchMay 30, 2025 16:54
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 30, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@aslilacaslilacaslilac approved these changes

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Add Prometheus metrics for the Parameters file cache
2 participants
@Emyrk@aslilac

[8]ページ先頭

©2009-2025 Movatter.jp