Long-duration gamma-ray bursts (GRBs) are powerful probes of the star formation history of the universe, but the correlation between the two depends on the highly debated presence and strength of a metallicity bias. To investigate this correlation, we use a phenomenological model that successfully describes star formation rates, luminosities, and stellar masses of star-forming galaxies and apply it to GRB production. We predict the luminosities, stellar masses, and metallicities of host galaxies depending on the presence (or absence) of a metallicity bias. Our best-fitting model includes a moderate metallicity bias, broadly consistent with the large majority of the long-duration GRBs in metal-poor environments originating from a collapsar (probability ~83%, with [0.74;0.91] range at 90% confidence level), but with a secondary contribution (~17%) from a metal-independent production channel, such as binary evolution. Because of the mass-metallicity relation of galaxies, the maximum likelihood model predicts that the metal-independent channel becomes dominant at z~~2), there is tension with low-redshift observations, since a significant fraction of GRB hosts are predicted to have (near) solar metallicity. This is in contrast to observations, unless obscured, metal-rich hosts are preferentially missed in current data sets, and suggests that lower efficiencies of the metal-independent GRB channel might be preferred following a comprehensive fit that includes metallicity of GRB hosts from complete samples. Overall, we are able to clearly establish the presence of a metallicity bias for GRB production, but continued characterization of GRB host galaxies is needed to quantify its strength.