fraction of mass of a star or other kind of astronomical object that is not in hydrogen or helium

Metallicity is a term in astronomy. It means the amount of elements that are heavier than hydrogen and helium.

The globular cluster M80. Stars in globular clusters are mainly older metal-poor members of Population II stars.

Most of the normal physical matter in the Universe is either hydrogen or helium. Astronomers use the word "metals" as a convenient short term for "all elements except hydrogen and helium". This is different from the usual chemical or physical definition of a metal as an electrically conducting solid.

Stars and nebulae with plenty of heavier elements are called "metal-rich", even though many of those elements are non-metals in chemistry.

The heavier elements come from stellar nucleosynthesis. Most elements heavier than hydrogen and helium in the Universe ("metals") are formed in the cores of stars. Over time, stellar winds and supernovae put the metals into the surrounding environment, enriching the interstellar medium. There it is material for the birth of new stars. Older generations of stars, which formed in the metal-poor early Universe, generally have lower metallicities than those of younger generations, which formed in a more metal-rich Universe.