Skip to content

atelet: add image provider metrics - #4027

Closed
yuekui2 wants to merge 1 commit into
agent-substrate:mainfrom
yuekui2:ipp-upstream/4-metrics
Closed

yuekui2 wants to merge 1 commit into
agent-substrate:mainfrom
yuekui2:ipp-upstream/4-metrics

Conversation

@yuekui2

@yuekui2 yuekui2 commented Nov 20, 2026

Copy link
Copy Markdown

Part of #4023.

Adds ate.imageprovider.requests, ate.imageprovider.duration and
ate.imageprovider.auth_refresh.failures, with the ate.imageprovider.outcome
and ate.imageprovider.provider attributes, to the metric registry.

Testing: hack/verify/metrics.sh; go test -race ./cmd/atelet/....

I used an AI agent to port these commits from our fork and draft this description. I reviewed the code and commit messages.

atelet will ask an image provider plugin to prepare image layers and fall
back to the image cache when the plugin declines or fails, and will
refresh the registry credentials of plugin leases. Add the
ate.imageprovider.requests counter and the ate.imageprovider.duration
histogram, labeled by provider and outcome, and the
ate.imageprovider.auth_refresh.failures counter, labeled by provider, to
the registry, ateattr, atelet's instruments and the observability guide.
Comment thread cmd/atelet/metrics.go
}

// recordImageProviderAuthRefreshFailure records one failed RefreshAuth call.
func (i *Instruments) recordImageProviderAuthRefreshFailure(ctx context.Context, provider string) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nothing calls this until #4030 and there's no test for it either. Does the unused lint pass on this? If not, could it move to #4030, or get a test here like the one for recordImageProvider?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Moved the auth refresh failures counter to #4030, next to its caller, with a test.

Comment thread cmd/atelet/metrics.go
}

// recordImageProvider records one request to the image provider plugin.
func (i *Instruments) recordImageProvider(ctx context.Context, provider, outcome string, d time.Duration) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Only the test calls these here; #4028 adds the first real caller and #4030 the auth-refresh one. Have you considered landing each metric with the code that emits it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Agreed. I closed #4027. The requests and duration instruments are now a commit at the start of #4028, right before the code that records them, and the auth refresh counter is in #4030.

Comment thread cmd/atelet/metrics.go
imageProviderDuration, err := meter.Float64Histogram(
imageProviderDurationMetric,
metric.WithUnit("s"),
metric.WithDescription("Time the image provider plugin takes to prepare an image's layers on the node."),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In #4028 the fallback and error samples include the cache pull, so this isn't only plugin time. Should the description say so, or should only the plugin call be timed? Also, will 60s buckets cover a fallback pull?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The duration now covers only the plugin calls, CanProvide plus PrepareImage, and the description says so. ate.imagecache.requests already measures the cache pull. The plugin calls are bounded at 65s by the timeouts in #4028, so the 60s top bucket plus +Inf covers them.

Comment on lines +602 to +604
brief: >
The plugin declined the image or failed. atelet used the image
cache instead.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A decline is expected but a plugin error is an outage, and both count as fallback. Could declined be its own outcome, or the plugin failure carry error.type like imagecache does?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Split it. Outcomes are now success, declined and error, all about the plugin. error carries error.type: the gRPC status code, or invalid_result when atelet rejects the plugin's answer. Whether the cache pull then worked is on ate.imagecache.requests.

brief: The plugin and the image cache both failed.
- id: ate.imageprovider.provider
stability: development
brief: The name of the image provider plugin.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This comes from the plugin's reported name, which is image-provider until the first reply. Is a series split at startup ok, or should atelet set the label from config?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

atelet no longer asks or counts when the plugin socket is missing, so nodes without a plugin record nothing here. Until the plugin first answers, the label is unknown, which now only shows up for a plugin that never answered.

@yuekui2

yuekui2 commented Nov 24, 2026

Copy link
Copy Markdown
Author

Closing. The metrics commit is now part of the #4028 stack, and the auth refresh counter moved to #4030, so each metric lands with the code that records it.

@yuekui2 yuekui2 closed this Nov 24, 2026
@yuekui2
yuekui2 deleted the ipp-upstream/4-metrics branch November 24, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants