MCPcopy
hub / github.com/kopia/kopia / run

Method run

cli/observability_flags.go:125–146  ·  view source on GitHub ↗

spanName specifies the name of the span at the start of a trace. A tracer is started only when spanName is not empty.

(ctx context.Context, spanName string, f func(context.Context) error)

Source from the content-addressed store, hash-verified

123// spanName specifies the name of the span at the start of a trace. A tracer is
124// started only when spanName is not empty.
125func (c *observabilityFlags) run(ctx context.Context, spanName string, f func(context.Context) error) error {
126 if err := c.start(ctx); err != nil {
127 return errors.Wrap(err, "unable to start observability facilities")
128 }
129
130 defer c.stop(ctx)
131
132 if err := c.pf.start(ctx, filepath.Join(c.outputDirectory, c.outputSubdirectoryName)); err != nil {
133 return errors.Wrap(err, "failed to start profiling")
134 }
135
136 defer c.pf.stop(ctx)
137
138 if spanName != "" {
139 tctx, span := tracer.Start(ctx, spanName, oteltrace.WithSpanKind(oteltrace.SpanKindClient))
140 ctx = tctx
141
142 defer span.End()
143 }
144
145 return f(ctx)
146}
147
148func (c *observabilityFlags) start(ctx context.Context) error {
149 c.maybeStartListener(ctx)

Callers

nothing calls this directly

Calls 3

startMethod · 0.95
stopMethod · 0.95
StartMethod · 0.65

Tested by

no test coverage detected