code: func Shutdown(c context.Context) {
  	state := GetState(c)
  	if store.IsNilStore(state.Store()) {
  		return
  	}
  
  	if state.flusher != nil {
  		logging.Debugf(c, "Stopping tsmon auto flush")
  		state.flusher.stop()
  		state.flusher = nil
  	}
  
  	// Flush logs errors inside.
  	Flush(c)
  
  	// Reset the state as if 'InitializeFromFlags' was never called.
  	Initialize(c, monitor.NewNilMonitor(), store.NewNilStore())
  }
docs: // Shutdown gracefully terminates the tsmon by doing the final flush and
  // disabling auto flush (if it was enabled).
  //
  // It resets Monitor and Store.
  //
  // Logs error to standard logger. Does nothing if tsmon wasn't initialized.