public override bool Equals(object o) { if (o == this) { return(true); } if (!(o is ZipkinSpan)) { return(false); } ZipkinSpan that = (ZipkinSpan)o; return(TraceId.Equals(that.TraceId) && ((ParentId == null) ? (that.ParentId == null) : ParentId.Equals(that.ParentId)) && Id.Equals(that.Id) && Kind.Equals(that.Kind) && ((Name == null) ? (that.Name == null) : Name.Equals(that.Name)) && (Timestamp == that.Timestamp) && (Duration == that.Duration) && ((LocalEndpoint == null) ? (that.LocalEndpoint == null) : LocalEndpoint.Equals(that.LocalEndpoint)) && ((RemoteEndpoint == null) ? (that.RemoteEndpoint == null) : RemoteEndpoint.Equals(that.RemoteEndpoint)) && Annotations.SequenceEqual(that.Annotations) && Tags.SequenceEqual(that.Tags) && (Debug == that.Debug) && (Shared == that.Shared)); }
internal ZipkinSpan GenerateSpan(ISpanData spanData, ZipkinEndpoint localEndpoint) { ISpanContext context = spanData.Context; long startTimestamp = ToEpochMicros(spanData.StartTimestamp); long endTimestamp = ToEpochMicros(spanData.EndTimestamp); ZipkinSpan.Builder spanBuilder = ZipkinSpan.NewBuilder() .TraceId(EncodeTraceId(context.TraceId)) .Id(EncodeSpanId(context.SpanId)) .Kind(ToSpanKind(spanData)) .Name(spanData.Name) .Timestamp(ToEpochMicros(spanData.StartTimestamp)) .Duration(endTimestamp - startTimestamp) .LocalEndpoint(localEndpoint); if (spanData.ParentSpanId != null && spanData.ParentSpanId.IsValid) { spanBuilder.ParentId(EncodeSpanId(spanData.ParentSpanId)); } foreach (var label in spanData.Attributes.AttributeMap) { spanBuilder.PutTag(label.Key, AttributeValueToString(label.Value)); } Status status = spanData.Status; if (status != null) { spanBuilder.PutTag(STATUS_CODE, status.CanonicalCode.ToString()); if (status.Description != null) { spanBuilder.PutTag(STATUS_DESCRIPTION, status.Description); } } foreach (var annotation in spanData.Annotations.Events) { spanBuilder.AddAnnotation( ToEpochMicros(annotation.Timestamp), annotation.Event.Description); } foreach (var networkEvent in spanData.MessageEvents.Events) { spanBuilder.AddAnnotation( ToEpochMicros(networkEvent.Timestamp), networkEvent.Event.Type.ToString()); } return(spanBuilder.Build()); }