This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed sarama instrumentation and introduced ContextExt interface
Sarama instrumentation was identifying spans with a non-unique and unelibale key which caused a number of issues with span reporting as some spans were not being finished. This commit replaces the said key with the span ID. This span ID is extracted from the kafka message headers and used to identify any pending spans. This requires Kafka (not sarama) version 0.11.0 or newer which was released in 2017. To enable using span IDs in sarama instrumentation, this commit also extends the span interface to add a ContextExt() method. This allows our implementation of Spans to access span IDs while still remaining compatible with OpenTracing Span. Alternatively, we could have added a utility method like `trace.SpanID(ctx)` but we'd have to account for failure and then insrumentation would have to conditionally create and manage spans.
- Loading branch information
Showing
10 changed files
with
88 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package tracer | ||
|
||
import ( | ||
"testing" | ||
"regexp" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestTraceParent(t *testing.T) { | ||
func TestTraceParent(t *testing.T) { | ||
tracer := newTracer() | ||
span := tracer.StartSpan("web.request").(*span) | ||
traceParent,ok := FormatAsTraceParent(span.Context()) | ||
traceParent, ok := FormatAsTraceParent(span.Context()) | ||
|
||
assert := assert.New(t) | ||
assert.True(ok) | ||
matched,_ := regexp.MatchString("^traceparent;desc=\"00-[0-9a-f]{32}-[0-9a-f]{16}-01\"$", traceParent) | ||
matched, _ := regexp.MatchString("^traceparent;desc=\"00-[0-9a-f]{32}-[0-9a-f]{16}-01\"$", traceParent) | ||
assert.True(matched) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters