Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Update udpTransport to only send Jaeger.thrift #147

Merged
merged 8 commits into from
Jun 2, 2017

Conversation

black-adder
Copy link
Contributor

@black-adder black-adder commented May 2, 2017

  • Need to remove the notion of peer in span.go and use the tags instead
  • Update thrift_span.go to accommodate the above change
  • Pass in logger to transport layer so that it can log errors if the batch is too big and our checks didn't suffice

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.3%) to 83.755% when pulling 86602b2 on do_something_useful into ea8f4c2 on master.

"github.com/uber/jaeger-client-go/thrift-gen/agent"
"github.com/uber/jaeger-client-go/thrift-gen/jaeger"
"github.com/uber/jaeger-client-go/thrift-gen/sampling"
"github.com/uber/jaeger-client-go/thrift-gen/zipkincore"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still a dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aye since MockAgent has to implement EmitZipkinBatch until it can be removed from thrift.idl


const defaultUDPSpanServerHostPort = "localhost:5775"
const defaultUDPSpanServerHostPort = "localhost:6831"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

port 5775 on the agent is for zipkin-compact, 6831 is for jaeger-compact

if s.process == nil {
s.process = &j.Process{
ServiceName: span.tracer.serviceName,
Tags: buildTags(span.tracer.tags),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this ever change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, tracer level tags are set once in the constructor and that's it.

@@ -78,14 +79,19 @@ func NewAgentClientUDP(hostPort string, maxPacketSize int) (*AgentClientUDP, err

// EmitZipkinBatch implements EmitZipkinBatch() of Agent interface
func (a *AgentClientUDP) EmitZipkinBatch(spans []*zipkincore.Span) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is gonna go away right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but to remove it here I need to remove it from the thrift.idl and to do that I need to remove this from all the clients first. So just stubbing out for now.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 85.135% when pulling 54fc44f on do_something_useful into ea8f4c2 on master.

@black-adder black-adder changed the title [WIP] Update udpTransport to only send Jaeger.thrift Update udpTransport to only send Jaeger.thrift May 3, 2017
span.go Outdated
}
if !handled {
s.tags = append(s.tags, Tag{key: key, value: value})
if !handler(s, key, value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think once we switch to jaeger.thrift, the only special handler we need is for sampling.priority

jaeger_span.go Outdated
// buildJaegerSpan builds jaeger span based on internal span.
func buildJaegerSpan(span *Span) *j.Span {
// BuildJaegerSpan builds jaeger span based on internal span.
func BuildJaegerSpan(span *Span) *j.Span {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BuildJaegerThrift(Span) would be better name. And the file name jaeger_thrift_span.go.

@@ -102,7 +102,7 @@ func TestSpanPropagator(t *testing.T) {
sp.duration, sp.startTime = exp.duration, exp.startTime
}
assert.Equal(t, exp.context, sp.context, formatName)
assert.Equal(t, expTags, sp.tags, formatName)
assert.Equal(t, expTags, sp.tags[1:] /*skip span.kind tag*/, formatName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if no code in the test has changed, why does the outcome change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ext.RPCServerOption(childCtx) adds the span.kind=server tag which was previously handled 'specially'

reporter_test.go Outdated
s.Equal(2, len(zSpan.Annotations), "expecting two annotations for events")
s.Equal(len(expected), len(zSpan.BinaryAnnotations),
span := s.collector.Spans()[0]
s.Equal(2, len(span.logs), "expecting two annotations for events")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: fix message. "expecting two logs" ?

reporter_test.go Outdated
s.Equal(len(expected), len(zSpan.BinaryAnnotations),
span := s.collector.Spans()[0]
s.Equal(2, len(span.logs), "expecting two annotations for events")
s.Equal(len(expected), len(span.tags),
"expecting %d binary annotations", len(expected))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: fix message - shouldn't be mentioning annotations anywhere

@@ -127,13 +122,9 @@ func (s *reporterSuite) TestClientSpanAnnotations() {
sp.Finish()
s.flushReporter()
s.Equal(2, len(s.collector.Spans()))
zSpan := s.collector.Spans()[0] // child span is reported first
s.EqualValues(zSpan.ID, sp2.(*Span).context.spanID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a flag to use / not-use zipkin's one-span-per-rpc model? I'd expect the span ID check to be there.

assert.True(t, overhead <= emitSpanBatchOverhead,
"test %d, n=%d, expected overhead %d <= %d", i, n, overhead, emitSpanBatchOverhead)
overhead := transport.Len() - n*spanSize - processSize
assert.True(t, overhead <= emitBatchOverhead,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add t.Logf("span count: %d, overhead: %d", n, overhead)? I am curious if it's less than 30 bytes now - I don't like leaving unexplained magic numbers in the code.

require.Equal(t, 1, len(spans), "agent should have received the span")
assert.Equal(t, span.Name, spans[0].Name)
batches := agent.GetJaegerBatches()
require.Equal(t, 1, len(batches), "agent should have received the batch")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require 1 span

spans := agent.GetZipkinSpans()
require.Equal(t, test.expectSpansFlushed, len(spans), test.description)
batches := agent.GetJaegerBatches()
if test.expectSpansFlushed > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not an equivalent test - what if this condition is false?

@@ -149,23 +176,29 @@ func TestUDPSenderAppend(t *testing.T) {
if test.expectFlush {
time.Sleep(5 * time.Millisecond)
}
spans := agent.GetZipkinSpans()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could minimize the changes to the tests if you extract spans var from batch[0].

@@ -132,11 +159,11 @@ func TestUDPSenderAppend(t *testing.T) {
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may want to add another control variable expectBatchesFlushed to avoid doing if statements in the test

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 85.246% when pulling 4666122 on do_something_useful into 39b0a42 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 85.246% when pulling cea1de5 on do_something_useful into 39b0a42 on master.

@black-adder black-adder force-pushed the do_something_useful branch from cea1de5 to 8ad14a5 Compare June 2, 2017 15:24
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 85.311% when pulling 8ad14a5 on do_something_useful into bcb0e9e on master.

@black-adder black-adder merged commit fda19be into master Jun 2, 2017
@black-adder black-adder deleted the do_something_useful branch June 2, 2017 15:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants