Slave_heartbeat_period currently shows the value for the connection with an empty name, even if default_master_connection is set differently.
Same for Slave_received_heartbeats.
A test case for heartbeats is below. It is supposed to be used with my.cnf from the multi_source suite. There is no need to add the test to the suite, it will be a part of a bigger test.
I don't have a strong opinion whether Slave_retried_transactions should be local or global, I guess either is fine, but if it's global, it should show the total number of retried transactions for all slaves, which now does not seem to be the case. I will add a test case for it when we have a decision how it should work.
Slave_open_temp_tables seems to show the overall number of open temporary tables across all slaves, which probably makes sense, since the idea is to use it to make sure that it's save to shutdown the slave server, which means we need to know that there are no open temporary tables across all replication connections. So, it already works.
Test case for heartbeats. The idea is the following:
in initial configuration, it sets different master_heartbeat_period for two connections, and later checks the value of 'Slave_heartbeat_period'. Currently it shows the same value for both connections (I believe it always shows the value of an anonymous connection, whether it's configured or not).
then, the slave is stopped, the period is changed to a really short value (1-2 sec), started again, and the test waits for the value of Slave_received_heartbeats to be increased. First, it does so for the anonymous connection, and waits for 2 heartbeats. Then it stops the slave, switches default_master_connection to a named connection, and attempts to do the same, only now it waits for 1 heartbeat. The waiting ends with a timeout, because the variable still shows the value of the anonymous connection (2), so it never becomes equal 1.