HTRACE-260. htrace-zipkin should not set the obsolete duration field in thrift (Adrian Cole via Colin P. McCabe)
diff --git a/htrace-zipkin/src/main/java/com/twitter/zipkin/gen/Annotation.java b/htrace-zipkin/src/main/java/com/twitter/zipkin/gen/Annotation.java
index 70cb0b6..91cbad7 100644
--- a/htrace-zipkin/src/main/java/com/twitter/zipkin/gen/Annotation.java
+++ b/htrace-zipkin/src/main/java/com/twitter/zipkin/gen/Annotation.java
@@ -36,7 +36,6 @@
   private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)1);
   private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)2);
   private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRUCT, (short)3);
-  private static final org.apache.thrift.protocol.TField DURATION_FIELD_DESC = new org.apache.thrift.protocol.TField("duration", org.apache.thrift.protocol.TType.I32, (short)4);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -47,14 +46,12 @@
   public long timestamp; // required
   public String value; // required
   public Endpoint host; // optional
-  public int duration; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
     TIMESTAMP((short)1, "timestamp"),
     VALUE((short)2, "value"),
-    HOST((short)3, "host"),
-    DURATION((short)4, "duration");
+    HOST((short)3, "host");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -75,8 +72,6 @@
           return VALUE;
         case 3: // HOST
           return HOST;
-        case 4: // DURATION
-          return DURATION;
         default:
           return null;
       }
@@ -120,7 +115,6 @@
   private static final int __TIMESTAMP_ISSET_ID = 0;
   private static final int __DURATION_ISSET_ID = 1;
   private byte __isset_bitfield = 0;
-  private _Fields optionals[] = {_Fields.HOST,_Fields.DURATION};
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -130,8 +124,6 @@
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     tmpMap.put(_Fields.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Endpoint.class)));
-    tmpMap.put(_Fields.DURATION, new org.apache.thrift.meta_data.FieldMetaData("duration", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Annotation.class, metaDataMap);
   }
@@ -161,7 +153,6 @@
     if (other.isSetHost()) {
       this.host = new Endpoint(other.host);
     }
-    this.duration = other.duration;
   }
 
   public Annotation deepCopy() {
@@ -174,8 +165,6 @@
     this.timestamp = 0;
     this.value = null;
     this.host = null;
-    setDurationIsSet(false);
-    this.duration = 0;
   }
 
   public long getTimestamp() {
@@ -249,29 +238,6 @@
     }
   }
 
-  public int getDuration() {
-    return this.duration;
-  }
-
-  public Annotation setDuration(int duration) {
-    this.duration = duration;
-    setDurationIsSet(true);
-    return this;
-  }
-
-  public void unsetDuration() {
-    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DURATION_ISSET_ID);
-  }
-
-  /** Returns true if field duration is set (has been assigned a value) and false otherwise */
-  public boolean isSetDuration() {
-    return EncodingUtils.testBit(__isset_bitfield, __DURATION_ISSET_ID);
-  }
-
-  public void setDurationIsSet(boolean value) {
-    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DURATION_ISSET_ID, value);
-  }
-
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case TIMESTAMP:
@@ -298,14 +264,6 @@
       }
       break;
 
-    case DURATION:
-      if (value == null) {
-        unsetDuration();
-      } else {
-        setDuration((Integer)value);
-      }
-      break;
-
     }
   }
 
@@ -320,9 +278,6 @@
     case HOST:
       return getHost();
 
-    case DURATION:
-      return Integer.valueOf(getDuration());
-
     }
     throw new IllegalStateException();
   }
@@ -340,8 +295,6 @@
       return isSetValue();
     case HOST:
       return isSetHost();
-    case DURATION:
-      return isSetDuration();
     }
     throw new IllegalStateException();
   }
@@ -386,15 +339,6 @@
         return false;
     }
 
-    boolean this_present_duration = true && this.isSetDuration();
-    boolean that_present_duration = true && that.isSetDuration();
-    if (this_present_duration || that_present_duration) {
-      if (!(this_present_duration && that_present_duration))
-        return false;
-      if (this.duration != that.duration)
-        return false;
-    }
-
     return true;
   }
 
@@ -441,16 +385,6 @@
         return lastComparison;
       }
     }
-    lastComparison = Boolean.valueOf(isSetDuration()).compareTo(typedOther.isSetDuration());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetDuration()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.duration, typedOther.duration);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
     return 0;
   }
 
@@ -492,12 +426,6 @@
       }
       first = false;
     }
-    if (isSetDuration()) {
-      if (!first) sb.append(", ");
-      sb.append("duration:");
-      sb.append(this.duration);
-      first = false;
-    }
     sb.append(")");
     return sb.toString();
   }
@@ -571,14 +499,6 @@
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 4: // DURATION
-            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
-              struct.duration = iprot.readI32();
-              struct.setDurationIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -609,11 +529,6 @@
           oprot.writeFieldEnd();
         }
       }
-      if (struct.isSetDuration()) {
-        oprot.writeFieldBegin(DURATION_FIELD_DESC);
-        oprot.writeI32(struct.duration);
-        oprot.writeFieldEnd();
-      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -641,9 +556,6 @@
       if (struct.isSetHost()) {
         optionals.set(2);
       }
-      if (struct.isSetDuration()) {
-        optionals.set(3);
-      }
       oprot.writeBitSet(optionals, 4);
       if (struct.isSetTimestamp()) {
         oprot.writeI64(struct.timestamp);
@@ -654,9 +566,6 @@
       if (struct.isSetHost()) {
         struct.host.write(oprot);
       }
-      if (struct.isSetDuration()) {
-        oprot.writeI32(struct.duration);
-      }
     }
 
     @Override
@@ -676,10 +585,6 @@
         struct.host.read(iprot);
         struct.setHostIsSet(true);
       }
-      if (incoming.get(3)) {
-        struct.duration = iprot.readI32();
-        struct.setDurationIsSet(true);
-      }
     }
   }
 
diff --git a/htrace-zipkin/src/main/java/com/twitter/zipkin/gen/zipkinCoreConstants.java b/htrace-zipkin/src/main/java/com/twitter/zipkin/gen/zipkinCoreConstants.java
index f3e1cde..ad680a4 100644
--- a/htrace-zipkin/src/main/java/com/twitter/zipkin/gen/zipkinCoreConstants.java
+++ b/htrace-zipkin/src/main/java/com/twitter/zipkin/gen/zipkinCoreConstants.java
@@ -40,4 +40,11 @@
 
   public static final String SERVER_RECV = "sr";
 
+  public static final String WIRE_SEND = "ws";
+
+  public static final String WIRE_RECV = "wr";
+
+  public static final String CLIENT_ADDR = "ca";
+
+  public static final String SERVER_ADDR = "sa";
 }
diff --git a/htrace-zipkin/src/main/java/org/apache/htrace/zipkin/HTraceToZipkinConverter.java b/htrace-zipkin/src/main/java/org/apache/htrace/zipkin/HTraceToZipkinConverter.java
index 8499244..dc4e9bc 100644
--- a/htrace-zipkin/src/main/java/org/apache/htrace/zipkin/HTraceToZipkinConverter.java
+++ b/htrace-zipkin/src/main/java/org/apache/htrace/zipkin/HTraceToZipkinConverter.java
@@ -187,7 +187,6 @@
       annotation.setTimestamp(time * 1000);
     }
 
-    annotation.setDuration(1);
     annotation.setValue(value);
     return annotation;
   }
diff --git a/htrace-zipkin/src/main/thrift/zipkinCore.thrift b/htrace-zipkin/src/main/thrift/zipkinCore.thrift
index a14b888..30dab0f 100644
--- a/htrace-zipkin/src/main/thrift/zipkinCore.thrift
+++ b/htrace-zipkin/src/main/thrift/zipkinCore.thrift
@@ -14,13 +14,18 @@
 namespace java com.twitter.zipkin.gen
 namespace rb Zipkin
 
-//************** Collection related structs **************
-
-// these are the annotations we always expect to find in a span
+//************** Common annotation values **************
 const string CLIENT_SEND = "cs"
 const string CLIENT_RECV = "cr"
 const string SERVER_SEND = "ss"
 const string SERVER_RECV = "sr"
+const string WIRE_SEND = "ws"
+const string WIRE_RECV = "wr"
+
+//************** Common binary annotation keys **************
+const string CLIENT_ADDR = "ca"
+const string SERVER_ADDR = "sa"
+
 
 // this represents a host and port in a network
 struct Endpoint {
@@ -34,7 +39,7 @@
   1: i64 timestamp                 // microseconds from epoch
   2: string value                  // what happened at the timestamp?
   3: optional Endpoint host        // host this happened on
-  4: optional i32 duration         // how long did the operation take? microseconds
+  // 4: optional i32 OBSOLETE_duration         // how long did the operation take? microseconds
 }
 
 enum AnnotationType { BOOL, BYTES, I16, I32, I64, DOUBLE, STRING }