Skip to content
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

metrics: measure image transfers for image source operations #2271

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

jsternberg
Copy link
Collaborator

This measures the transfer size and duration for image pulls along with the
time spent extracting the image contents.

This measures the transfer size and duration for image pulls along with
the time spent extracting the image contents.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>

var reImageSourceType = regexp.MustCompile(`^\[.*] FROM `)

func detectImageSourceType(vertexName string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

My only nitpick is that a used-once, one-line function seems a bit spaghetti!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I sometimes like to do this because it creates parity with another section of the code and it also abstracts an area that I consider to be non-essential to the original code. In the place where this is used, you can see it's just trying to detect if the line is an image source. This code implements the specific behavior. The original section of code doesn't need to know what the exact pattern is or the details but it just knows it's an image source.

@tonistiigi tonistiigi merged commit eab5ccc into docker:master Mar 14, 2024
63 checks passed
@jsternberg jsternberg deleted the build-image-transfer-metric branch March 14, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants