it('should not set timestamp or duration on shared span', () => { const span = new Span(new TraceId({ traceId: 'a', parentId: new Some('b'), spanId: 'c' })); span.setName('GET'); span.setKind('SERVER'); span.setTimestamp(1); span.setDuration(1); span.setShared(true); const spanThrift = deserialize(THRIFT.encode(span)); expect(spanThrift.timestamp).to.equal(null); expect(spanThrift.duration).to.equal(null); });
})); span.setName('GET'); span.setKind('CLIENT'); span.setRemoteEndpoint(new Endpoint({ serviceName: 'there',
port: 8080 })); span.setKind('SERVER'); span.setTimestamp(1); span.setDuration(1);
it('should set timestamp and duration on client span', () => { const span = new Span(new TraceId({ traceId: 'a', parentId: new Some('b'), spanId: 'c' })); span.setName('GET'); span.setKind('SERVER'); span.setTimestamp(1); span.setDuration(1); const spanThrift = deserialize(THRIFT.encode(span)); expect(spanThrift.timestamp.toNumber()).to.equal(1); expect(spanThrift.duration.toNumber()).to.equal(1); });
it('should set timestamp and duration on client span', () => { const span = new Span(new TraceId({ traceId: 'a', parentId: new Some('b'), spanId: 'c' })); span.setName('GET'); span.setKind('SERVER'); span.setTimestamp(1); span.setDuration(1); const spanThrift = deserialize(THRIFT.encode(span)); expect(spanThrift.timestamp.toNumber()).to.equal(1); expect(spanThrift.duration.toNumber()).to.equal(1); });
it('should not set timestamp or duration on shared span', () => { const span = new Span(new TraceId({ traceId: 'a', parentId: new Some('b'), spanId: 'c' })); span.setName('GET'); span.setKind('SERVER'); span.setTimestamp(1); span.setDuration(1); span.setShared(true); const spanThrift = deserialize(THRIFT.encode(span)); expect(spanThrift.timestamp).to.equal(null); expect(spanThrift.duration).to.equal(null); });
})); span.setName('GET'); span.setKind('CLIENT'); span.setRemoteEndpoint(new Endpoint({ serviceName: 'there',
port: 8080 })); span.setKind('SERVER'); span.setTimestamp(1); span.setDuration(1);