Skip to content

cri: add tracing spans for image pull and sandbox setup paths - #12628

Merged
estesp merged 1 commit into
containerd:mainfrom
Cindia-blue:tracing-minimal
Aug 12, 2026
Merged

estesp merged 1 commit into
containerd:mainfrom
Cindia-blue:tracing-minimal

Conversation

@Cindia-blue

@Cindia-blue Cindia-blue commented Dec 4, 2025 •

Copy link
Copy Markdown
Contributor

This PR adds opt-in tracing spans/attributes in CRI image pull and selected sandbox-related paths to improve debugging and correlation (e.g., sandbox.id/pod metadata). If maintainers prefer a smaller diff, I’m happy to split this into a pull-only PR plus follow-ups.

Signed-off-by: Cindy Li [email protected]

@mikebrow mikebrow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we already have spans coving the CRI calls.. could you explain what is broken?

@Cindia-blue Cindia-blue changed the title feat(tracing): add minimal distributed tracing spans to CRI and core … cri: add tracing spans for image pull and sandbox setup paths Dec 30, 2025
@Cindia-blue
Cindia-blue force-pushed the tracing-minimal branch 2 times, most recently from 92faec9 to 95bc7a9 Compare December 30, 2025 20:59
@Cindia-blue
Cindia-blue force-pushed the tracing-minimal branch 10 times, most recently from 19f213b to 985ef17 Compare December 30, 2025 22:15
Copilot AI review requested due to automatic review settings July 31, 2026 18:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

client/pull.go:204

  • Tracing attribute names are expected to be lower-case and dot-separated (see docs/tracing.md attribute naming conventions). target.mediaType uses camelCase and will make querying/aggregation inconsistent with other attributes like descriptor.media.type.
		tracing.Attribute("target.mediaType", desc.MediaType),

Copilot AI review requested due to automatic review settings August 1, 2026 20:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

client/pull.go:206

  • Attribute keys here diverge from the repo’s tracing conventions and existing image-pull spans: (1) target.mediaType uses camelCase but docs/tracing.md specifies lower-case, dot-separated attribute names; (2) for image-pull paths this repo consistently uses image.ref (e.g. client/pull.go:79, internal/cri/server/images/image_pull.go:173-176), so container.image.ref is misleading in this context.
		tracing.Attribute("container.image.ref", ref),
		tracing.Attribute("image.name", name),
		tracing.Attribute("target.mediaType", desc.MediaType),
		tracing.Attribute("image.digest", desc.Digest.String()),
	)

Copilot AI review requested due to automatic review settings August 3, 2026 15:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (2)

client/pull.go:290

  • target.mediaType/image.digest are set before converterFunc runs. When isConvertible is true, desc can change, so these attributes may end up reflecting the pre-conversion descriptor. Consider re-setting them after a successful conversion so the span reflects the final target.
	if isConvertible {
		convertCtx, convertSpan := tracing.StartSpan(ctx, tracing.Name(pullSpanPrefix, "convert_manifest"))
		desc, err = converterFunc(convertCtx, desc)
		convertSpan.SetStatus(err)
		convertSpan.End()

client/pull.go:206

  • The attribute key image.name is inconsistent with other client tracing attributes (e.g., container.image.ref in this function and client/client.go). Using the container.image.* namespace (and OTel semantic conventions) will make traces easier to query consistently.
	span.SetAttributes(
		tracing.Attribute("container.image.ref", ref),
		tracing.Attribute("image.name", name),
		tracing.Attribute("target.mediaType", desc.MediaType),
		tracing.Attribute("image.digest", desc.Digest.String()),
	)

@Cindia-blue

Copy link
Copy Markdown
Contributor Author

Hi @mikebrow — thanks for the update on Aug 3. CI is now green. Is there anything else you’d like me to address before this is ready for approval or merge?

Copilot AI review requested due to automatic review settings August 6, 2026 01:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

client/pull.go:206

  • In this image-pull tracing span, the attribute key uses container.image.ref, but other image-focused tracing in this codebase uses image.ref (e.g., CRI image pull). Using container.* here makes cross-span queries inconsistent and suggests container semantics rather than image semantics.
		tracing.Attribute("container.image.ref", ref),
		tracing.Attribute("image.name", name),
		tracing.Attribute("target.mediaType", desc.MediaType),
		tracing.Attribute("image.digest", desc.Digest.String()),

@mikebrow mikebrow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@github-project-automation github-project-automation Bot moved this from Needs Triage to Review In Progress in Pull Request Review Aug 12, 2026
@fuweid
fuweid added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
@estesp
estesp added this pull request to the merge queue Aug 12, 2026
Merged via the queue into containerd:main with commit 01836f0 Aug 12, 2026
88 of 90 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cri Container Runtime Interface (CRI) kind/feature size/S

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants