You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: provider.go
    path of file: ./repos/erda/internal/tools/monitor/extensions/loghub/sls-log-to-metric
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed unde
    
func (p *provider) Init(ctx servicehub.Context) error {
	p.projects = make(map[string]map[string]*LogStore)
	for _, item := range p.Cfg.LogStores {
		if len(item.Project) <= 0 || len(item.Store) <= 0 || len(item.Type) <= 0 {
			return fmt.Errorf("project、store、type is required")
		}
		logStores := p.projects[item.Store]
		if logStores == nil {
			logStores = make(map[string]*LogStore)
			p.projects[item.Store] = logStores
		}
		logStore := item
		logStores[item.Store] = &logStore
	}
	if len(p.Cfg.Account.AccessKey) <= 0 || len(p.Cfg.Account.AccessSecretKey) <= 0 {
		return fmt.Errorf("ali_access_key and ali_access_secret_key is required")
	}
	if len(p.Cfg.Account.Endpoints) <= 0 {
		p.Cfg.Account.Endpoints = Endpoints
	}
	p.manager = newConsumerManager(p.Log, &p.Cfg.Account, p.Cfg.ProjectsReloadInterval, p)
	return nil
}