-
Notifications
You must be signed in to change notification settings - Fork 288
Conversation
Signed-off-by: Pavol Loffay <[email protected]>
return Propagator{enableBaggage: true, baggagePrefix: "baggage-"} | ||
} | ||
|
||
// NewZipkinB3HTTPHeaderPropagator creates a Propagator for extracting and injecting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported function NewZipkinB3HTTPHeaderPropagatorWithBaggage should be of the form "NewZipkinB3HTTPHeaderPropagatorWithBaggage ..."
zipkin/propagation.go
Outdated
@@ -66,6 +81,7 @@ func (p Propagator) Extract(abstractCarrier interface{}) (jaeger.SpanContext, er | |||
var spanID uint64 | |||
var parentID uint64 | |||
sampled := false | |||
var baggage map[string]string = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should drop = nil from declaration of var baggage; it is the zero value
zipkin/propagation.go
Outdated
@@ -24,12 +24,21 @@ import ( | |||
) | |||
|
|||
// Propagator is an Injector and Extractor | |||
type Propagator struct{} | |||
type Propagator struct{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File is not goimports-ed
zipkin/propagation_test.go
Outdated
) | ||
|
||
var ( | ||
rootSampledHeader = opentracing.TextMapCarrier{ | ||
"x-b3-traceid": "1", | ||
"x-b3-spanid": "2", | ||
"x-b3-sampled": "1", | ||
"baggage-foo": "bar", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File is not goimports-ed
Signed-off-by: Pavol Loffay <[email protected]>
The same question like in java imp jaegertracing/jaeger-client-java#438 (comment). Should it be enabled by default? should it contain enable flag? |
Codecov Report
@@ Coverage Diff @@
## master #319 +/- ##
==========================================
+ Coverage 87.31% 87.39% +0.07%
==========================================
Files 54 54
Lines 3011 3030 +19
==========================================
+ Hits 2629 2648 +19
Misses 271 271
Partials 111 111
Continue to review full report at Codecov.
|
Signed-off-by: Pavol Loffay <[email protected]>
zipkin/propagation.go
Outdated
|
||
// NewZipkinB3HTTPHeaderPropagator creates a Propagator for extracting and injecting | ||
// Zipkin HTTP B3 headers into SpanContexts. | ||
// Zipkin HTTP B3 headers into SpanContexts. Baggage is by default enabled and uses prefix | ||
// 'baggage-'. | ||
func NewZipkinB3HTTPHeaderPropagator() Propagator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use functional options here instead? We reduce the API surface area and it's backward and forward compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 it's nice design
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are various styles how this can be done. I have changed it slightly in the last commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go experts advise against using functional options and use option structs, because structs compose better (as evidenced by our duplication of tracer and config options).
The reason we traditionally used options is in cases where the existing API did not have configurability, in which case adding a vararg option list is backwards compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a resource on this? I remember someone talking about this but never read anything about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yurishkuro do you it's better to pass option struct to the "constructor" function (or whatever it's called).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for new code it might make sense to pass a struct with options.
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Related to jaegertracing/jaeger#755 (comment)