MCPcopy
hub / github.com/containerd/containerd / WithNamespace

Function WithNamespace

pkg/tracing/helpers_spanopts.go:28–38  ·  view source on GitHub ↗

WithNamespace adds containerd namespace attribute to spans when available. It is best-effort: if namespace is not present in the context, it does nothing.

(ctx context.Context)

Source from the content-addressed store, hash-verified

26// WithNamespace adds containerd namespace attribute to spans when available.
27// It is best-effort: if namespace is not present in the context, it does nothing.
28func WithNamespace(ctx context.Context) SpanOpt {
29 return func(config *StartConfig) {
30 ns, err := namespaces.NamespaceRequired(ctx)
31 if err != nil {
32 return
33 }
34 config.spanOpts = append(config.spanOpts,
35 trace.WithAttributes(Attribute("namespace", ns)),
36 )
37 }
38}

Callers 13

StartMethod · 0.92
KillMethod · 0.92
DeleteMethod · 0.92
ExecMethod · 0.92
ResizeMethod · 0.92
CreateMethod · 0.92
UpdateMethod · 0.92
DeleteMethod · 0.92
CreateMethod · 0.92
UpdateMethod · 0.92
DeleteMethod · 0.92
RunPodSandboxMethod · 0.92

Calls 2

NamespaceRequiredFunction · 0.92
AttributeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…