code: func (w *influxDBWriter) Write(bp influxdb.BatchPoints) error {
  	c, err := w.initWriteClient()
  	if err != nil {
  		return err
  	}
  
  	defer c.Close()
  
  	if writeErr := c.Write(bp); writeErr != nil {
  		ctx := log.With(context.Background(), log.Str(log.MetricsProviderName, "influxdb"))
  		log.FromContext(ctx).Errorf("Error while writing to InfluxDB: %s", writeErr.Error())
  
  		if handleErr := w.handleWriteError(ctx, c, writeErr); handleErr != nil {
  			return handleErr
  		}
  		// Retry write after successful handling of writeErr
  		return c.Write(bp)
  	}
  	return nil
  }
docs: // Write creates a http or udp client and attempts to write BatchPoints.
  // If a "database not found" error is encountered, a CREATE DATABASE
  // query is attempted when using protocol http.