MCPcopy
hub / github.com/kopia/kopia / stop

Method stop

cli/observability_flags.go:270–296  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

268}
269
270func (c *observabilityFlags) stop(ctx context.Context) {
271 if c.dumpAllocatorStats {
272 gather.DumpStats(ctx)
273 }
274
275 if c.stopPusher != nil {
276 close(c.stopPusher)
277
278 c.pusherWG.Wait()
279 }
280
281 if c.traceProvider != nil {
282 if err := c.traceProvider.Shutdown(ctx); err != nil {
283 log(ctx).Warnf("unable to shutdown trace provicer: %v", err)
284 }
285 }
286
287 if c.saveMetrics {
288 if metricsDir, err := mkSubdirectories(c.outputDirectory, c.outputSubdirectoryName); err != nil {
289 log(ctx).Warnf("unable to create metrics output directory '%s': %v", metricsDir, err)
290 } else {
291 if err := prometheus.WriteToTextfile(filepath.Join(metricsDir, "kopia-metrics.prom"), prometheus.DefaultGatherer); err != nil {
292 log(ctx).Warnf("unable to write metrics to file: %v", err)
293 }
294 }
295 }
296}
297
298func (c *observabilityFlags) pushPeriodically(ctx context.Context, p *push.Pusher) {
299 defer c.pusherWG.Done()

Callers 1

runMethod · 0.95

Calls 4

DumpStatsFunction · 0.92
mkSubdirectoriesFunction · 0.85
ShutdownMethod · 0.80
WaitMethod · 0.65

Tested by

no test coverage detected