// buildCatalog builds a catalog from the list of pending metric definitions. It is safe to call this method multiple
// times. This method is thread-safe.
c.Lock()
defer c.Unlock()
r := make(catalog, len(c.definitions))
for _, d := range c.definitions {
if original, ok := r[d.name]; ok {
return nil, fmt.Errorf(
"%w: metric %q already defined with %+v. Cannot redefine with %+v",