def register(self, collector):
with self._lock:<EOL><INDENT>names = self._get_names(collector)<EOL>duplicates = set(self._names_to_collectors).intersection(names)<EOL>if duplicates:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(<EOL>duplicates))<EOL><DEDENT>for name in names:<EOL><INDENT>self._names_to_collectors[name] = collector<EOL><DEDENT>self._collector_to_names[collector] = names<EOL><DEDENT>
Add a collector to the registry.