hadoop-compat/src/main/java/com/twitter/elephantbird/util/HadoopCompat.java
public static Counter getCounter(TaskInputOutputContext context,
                                   String groupName, String counterName) {
    return (Counter) invoke(GET_COUNTER_METHOD, context, groupName, counterName);
  }
public static Counter getCounter(TaskInputOutputContext context,
                                   String groupName, String counterName) {
    return (Counter) invoke(GET_COUNTER_METHOD, context, groupName, counterName);
  }
Invoke getCounter() on TaskInputOutputContext. Works with both
Hadoop 1 and 2.