The best way to evaluate the productivity of engineers would be to determine if their peers see them as a top performer, a net positive or a net negative. If somebody is a net negative, get rid of them. If somebody is a top performer, make sure they're compensated accordingly and kept happy so they don't leave. If somebody is a net positive then you should be satisfied that you aren't stuck with a net negative. Any attempt to evaluate software engineers beyond this is going to be inherently arbitrary.
If you invent arbitrary metrics, your engineers will often have to choose between doing work or gaming the metrics.