The cobra effect occurs when an attempted solution to a problem makes the problem worse, as a type of unintended consequence.
History
According to reports from the 1800s, the British Empire wanted to reduce deaths caused by cobra bites in Delhi. Thinking the best solution was to reduce the number of cobras, the locals were offered a financial incentive for every cobra skin. Some locals saw an opportunity to earn money by farming cobras. When the government become aware of this, they removed the incentive, cobra farmers released their snakes, and the overall cobra population increased.
Applying to Metrics
Let's use a metric like Velocity, for example. Management wants the teams to deliver more product so it can get more returns on its investment. Management begins to measure how much the teams are completing, by linking productivity and velocity (rather than to use it to understand capacity). To make things more interesting, not only does management ask the teams how much they can produce but then offers some kind of incentive for reaching the velocity goal. What do you think will happen?
Velocity
At the end of each iteration, sprint or planning increment, a team adds up estimates associated with work that was completed during that timeframe. This total is called velocity. If you're using a flow-based approach, you may call this throughput or something else. Either way, we're trying to measure stuff we got done and that we could potentially ship. If you have a stable team and stable velocity, you could better understand team capacity for future commitments.
The Effect
If you're not careful, incentivizing teams around velocity may have the cobra effect. First, they may throttle back their commitments. Week one they commit to 100 points. The next week they commit to 80 points. If they get everything done that they commit to, they get the reward and management gets 20% less delivered. Alternately, the team may begin to pad their estimates. Week one they commit to 100 points. The next week they pad every estimate by 20%. They still commit 100 points. They just inflate estimates for the same effort. Again, they are rewarded.
What can you do?
First, if you can't link your metric back to the key results you're looking for or the outcomes you desire, it's probably a bad idea to use this metric. Know why you need this information! I use velocity to understand team capacity. That's it! Remember that choosing to use this metric comes with risks. When you're trying to measure people, there has to be a certain level of trust and safety. You trust the people giving you the estimates are being honest and forthcoming. You trust that they understand why (you believe) the data is important to you and the company. You will get bad information, if the team does not feel safe. Don't use this metric as a stick to punish them. If you do, this metric can most certainly come back and bite you.