code: func initInfluxDBClient(ctx context.Context, config *types.InfluxDB) *influx.Influx {
  	logger := log.FromContext(ctx)
  
  	// TODO deprecated: move this switch into configuration.SetEffectiveConfiguration when web provider will be removed.
  	switch config.Protocol {
  	case protocolUDP:
  		if len(config.Database) > 0 || len(config.RetentionPolicy) > 0 {
  			logger.Warn("Database and RetentionPolicy options have no effect with UDP.")
  			config.Database = ""
  			config.RetentionPolicy = ""
  		}
  	case protocolHTTP:
  		if u, err := url.Parse(config.Address); err == nil {
  			if u.Scheme != "http" && u.Scheme != "https" {
  				logger.Warnf("InfluxDB address %s should specify a scheme (http or https): falling back on HTTP.", config.Address)
  				config.Address = "http://" + config.Address
  			}
  		} else {
  			logger.Errorf("Unable to parse the InfluxDB address %v: falling back on UDP.", err)
  			config.Protocol = protocolUDP
  			config.Database = ""
  			config.RetentionPolicy = ""
  		}
  	default:
  		logger.Warnf("Unsupported protocol %s: falling back on UDP.", config.Protocol)
  		config.Protocol = protocolUDP
  		config.Database = ""
  		config.RetentionPolicy = ""
  	}
  
  	return influx.New(
  		map[string]string{},
  		influxdb.BatchPointsConfig{
  			Database:        config.Database,
  			RetentionPolicy: config.RetentionPolicy,
  		},
  		kitlog.LoggerFunc(func(keyvals ...interface{}) error {
  			log.WithoutContext().WithField(log.MetricsProviderName, "influxdb").Info(keyvals)
  			return nil
  		}))
  }
docs: // initInfluxDBTicker creates a influxDBClient