use locks for modifying metrics and add get and set methods to the
metrics API