case KEY: if (value == null) { unsetKey(); } else { setKey((String)value); unsetVType(); } else { setVType((TagType)value); unsetVStr(); } else { setVStr((String)value); unsetVDouble(); } else { setVDouble((Double)value); unsetVBool(); } else { setVBool((Boolean)value); unsetVLong(); } else { setVLong((Long)value); unsetVBinary(); } else { setVBinary((ByteBuffer)value);
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof Tag) return this.equals((Tag)that); return false; }
@Override public Tag apply(final Double value) { final Tag tag = new Tag(); tag.setVType(TagType.DOUBLE); tag.setVDouble(value); return tag; } };
assertThat(span.tags) .containsExactly( new Tag("BOOL", TagType.BOOL).setVBool(false), new Tag("LONG", TagType.LONG).setVLong(Long.MAX_VALUE), new Tag("span.kind", TagType.STRING).setVStr("server"), new Tag("STRING", TagType.STRING) .setVStr( "Judge of a man by his questions rather than by his answers. -- Voltaire")); assertThat(log.fields) .containsExactly( new Tag("message", TagType.STRING).setVStr("annotation #1"), new Tag("bool", TagType.BOOL).setVBool(true), new Tag("long", TagType.LONG).setVLong(1337L), new Tag("string", TagType.STRING) .setVStr("Kind words do not cost much. Yet they accomplish much. -- Pascal")); log = span.logs.get(1); assertThat(log.timestamp).isEqualTo(1519629871123456L); assertThat(log.fields) .containsExactly( new Tag("message", TagType.STRING).setVStr("sent message"), new Tag("id", TagType.LONG).setVLong(42L), new Tag("compressed_size", TagType.LONG).setVLong(69), new Tag("uncompressed_size", TagType.LONG).setVLong(96));
@Override public void read(org.apache.thrift.protocol.TProtocol prot, Log struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.timestamp = iprot.readI64(); struct.setTimestampIsSet(true); { org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.fields = new ArrayList<Tag>(_list5.size); Tag _elem6; for (int _i7 = 0; _i7 < _list5.size; ++_i7) { _elem6 = new Tag(); _elem6.read(iprot); struct.fields.add(_elem6); } } struct.setFieldsIsSet(true); } }
public Object getFieldValue(_Fields field) { switch (field) { case KEY: return getKey(); case V_TYPE: return getVType(); case V_STR: return getVStr(); case V_DOUBLE: return Double.valueOf(getVDouble()); case V_BOOL: return Boolean.valueOf(isVBool()); case V_LONG: return Long.valueOf(getVLong()); case V_BINARY: return getVBinary(); } throw new IllegalStateException(); }
final long timestampsInMicros = timestampToMicros(event.getTimestamp()); final Tag tagMessageId = new Tag(MESSAGE_EVENT_ID, TagType.LONG).setVLong(event.getEvent().getMessageId()); final Tag tagCompressedSize = new Tag(MESSAGE_EVENT_COMPRESSED_SIZE, TagType.LONG) .setVLong(event.getEvent().getCompressedMessageSize()); final Tag tagUncompressedSize = new Tag(MESSAGE_EVENT_UNCOMPRESSED_SIZE, TagType.LONG) .setVLong(event.getEvent().getUncompressedMessageSize()); logs.add( new Log(
public Tag deepCopy() { return new Tag(this); }
private static List<Tag> attributesToTags( final Map<String, AttributeValue> attributes, @Nullable final Tag extraTag) { final List<Tag> tags = Lists.newArrayListWithExpectedSize(attributes.size() + 1); for (final Map.Entry<String, AttributeValue> entry : attributes.entrySet()) { final Tag tag = entry .getValue() .match( stringAttributeConverter, booleanAttributeConverter, longAttributeConverter, doubleAttributeConverter, defaultAttributeConverter); tag.setKey(entry.getKey()); tags.add(tag); } if (extraTag != null) { tags.add(extraTag); } return tags; }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, Process struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.serviceName = iprot.readString(); struct.setServiceNameIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.tags = new ArrayList<Tag>(_list37.size); Tag _elem38; for (int _i39 = 0; _i39 < _list37.size; ++_i39) { _elem38 = new Tag(); _elem38.read(iprot); struct.tags.add(_elem38); } } struct.setTagsIsSet(true); } } }
/** * Performs a deep copy on <i>other</i>. */ public Log(Log other) { __isset_bitfield = other.__isset_bitfield; this.timestamp = other.timestamp; if (other.isSetFields()) { List<Tag> __this__fields = new ArrayList<Tag>(other.fields.size()); for (Tag other_element : other.fields) { __this__fields.add(new Tag(other_element)); } this.fields = __this__fields; } }
/** * Performs a deep copy on <i>other</i>. */ public Process(Process other) { if (other.isSetServiceName()) { this.serviceName = other.serviceName; } if (other.isSetTags()) { List<Tag> __this__tags = new ArrayList<Tag>(other.tags.size()); for (Tag other_element : other.tags) { __this__tags.add(new Tag(other_element)); } this.tags = __this__tags; } }
List<Tag> __this__tags = new ArrayList<Tag>(other.tags.size()); for (Tag other_element : other.tags) { __this__tags.add(new Tag(other_element));