code: func NewState(c Config, lg *log.Logger, tokens *token.Store) *State {
  	l := &State{
  		config:               c,
  		logger:               lg,
  		services:             make(map[string]*ServiceState),
  		checks:               make(map[types.CheckID]*CheckState),
  		checkAliases:         make(map[string]map[types.CheckID]chan<- struct{}),
  		metadata:             make(map[string]string),
  		tokens:               tokens,
  		notifyHandlers:       make(map[chan<- struct{}]struct{}),
  		managedProxies:       make(map[string]*ManagedProxy),
  		managedProxyHandlers: make(map[chan<- struct{}]struct{}),
  	}
  	l.SetDiscardCheckOutput(c.DiscardCheckOutput)
  	return l
  }
docs: // NewState creates a new local state for the agent.