code: func (c *ScrapeConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
  	*c = DefaultScrapeConfig
  	type plain ScrapeConfig
  	err := unmarshal((*plain)(c))
  	if err != nil {
  		return err
  	}
  	if len(c.JobName) == 0 {
  		return errors.New("job_name is empty")
  	}
  
  	// The UnmarshalYAML method of HTTPClientConfig is not being called because it's not a pointer.
  	// We cannot make it a pointer as the parser panics for inlined pointer structs.
  	// Thus we just do its validation here.
  	if err := c.HTTPClientConfig.Validate(); err != nil {
  		return err
  	}
  
  	// The UnmarshalYAML method of ServiceDiscoveryConfig is not being called because it's not a pointer.
  	// We cannot make it a pointer as the parser panics for inlined pointer structs.
  	// Thus we just do its validation here.
  	if err := c.ServiceDiscoveryConfig.Validate(); err != nil {
  		return err
  	}
  
  	// Check for users putting URLs in target groups.
  	if len(c.RelabelConfigs) == 0 {
  		for _, tg := range c.ServiceDiscoveryConfig.StaticConfigs {
  			for _, t := range tg.Targets {
  				if err := CheckTargetAddress(t[model.AddressLabel]); err != nil {
  					return err
  				}
  			}
  		}
  	}
  
  	for _, rlcfg := range c.RelabelConfigs {
  		if rlcfg == nil {
  			return errors.New("empty or null target relabeling rule in scrape config")
  		}
  	}
  	for _, rlcfg := range c.MetricRelabelConfigs {
  		if rlcfg == nil {
  			return errors.New("empty or null metric relabeling rule in scrape config")
  		}
  	}
  
  	// Add index to the static config target groups for unique identification
  	// within scrape pool.
  	for i, tg := range c.ServiceDiscoveryConfig.StaticConfigs {
  		tg.Source = fmt.Sprintf("%d", i)
  	}
  
  	return nil
  }
docs: // UnmarshalYAML implements the yaml.Unmarshaler interface.