This repository has been archived by the owner on May 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from opentracing/rename-tracer
Renames OpenTracer to just Tracer; fixes minor lint issues
- Loading branch information
Showing
11 changed files
with
81 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# IntelliJ project files | ||
.idea/ | ||
api-golang.iml | ||
api-golang.ipr | ||
api-golang.iws | ||
|
||
# Test results | ||
*.cov | ||
*.html | ||
test.log | ||
|
||
# Build dir | ||
build/ |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
|
||
.DEFAULT_GOAL := test | ||
|
||
.PHONY: test | ||
test: | ||
go test ./... | ||
|
||
.PHONY: lint | ||
lint: | ||
golint ./... | ||
|
||
.PHONY: vet | ||
vet: | ||
go vet ./... | ||
|
||
.PHONY: example | ||
example: | ||
go build -o build/dapperish-example ./examples/dapperish/. | ||
./build/dapperish-example |
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,64 +1,64 @@ | ||
package opentracing | ||
|
||
var ( | ||
defaultOpenTracer OpenTracer = noopOpenTracer{noopTraceContextSource{}} | ||
defaultTracer Tracer = noopTracer{noopTraceContextSource{}} | ||
) | ||
|
||
// InitDefaultTracer sets the [singleton] OpenTracer returned by | ||
// InitDefaultTracer sets the [singleton] opentracing.Tracer returned by | ||
// DefaultTracer(). Those who use DefaultTracer (rather than directly manage an | ||
// OpenTracer instance) should call InitDefaultTracer as early as possible in | ||
// opentracing.Tracer instance) should call InitDefaultTracer as early as possible in | ||
// main(), prior to calling the `StartTrace` (etc) global funcs below. Prior to | ||
// calling `InitDefaultTracer`, any Spans started via the `StartTrace` (etc) | ||
// globals are noops. | ||
func InitDefaultTracer(tracer OpenTracer) { | ||
defaultOpenTracer = tracer | ||
func InitDefaultTracer(tracer Tracer) { | ||
defaultTracer = tracer | ||
} | ||
|
||
// DefaultTracer returns the global singleton `OpenTracer` implementation. | ||
// DefaultTracer returns the global singleton `Tracer` implementation. | ||
// Before `InitDefaultTracer()` is called, the `DefaultTracer()` is a noop | ||
// implementation that drops all data handed to it. | ||
func DefaultTracer() OpenTracer { | ||
return defaultOpenTracer | ||
func DefaultTracer() Tracer { | ||
return defaultTracer | ||
} | ||
|
||
// StartTrace defers to `OpenTracer.StartTrace`. See `DefaultTracer()`. | ||
// StartTrace defers to `Tracer.StartTrace`. See `DefaultTracer()`. | ||
func StartTrace(operationName string) Span { | ||
return defaultOpenTracer.StartTrace(operationName) | ||
return defaultTracer.StartTrace(operationName) | ||
} | ||
|
||
// JoinTrace defers to `OpenTracer.JoinTrace`. See `DefaultTracer()`. | ||
// JoinTrace defers to `Tracer.JoinTrace`. See `DefaultTracer()`. | ||
func JoinTrace(operationName string, parent interface{}) Span { | ||
return defaultOpenTracer.JoinTrace(operationName, parent) | ||
return defaultTracer.JoinTrace(operationName, parent) | ||
} | ||
|
||
// MarshalTraceContextBinary defers to | ||
// `TraceContextMarshaler.MarshalTraceContextBinary`. | ||
// | ||
// See `DefaultTracer()`. | ||
func MarshalTraceContextBinary(ctx TraceContext) ([]byte, []byte) { | ||
return defaultOpenTracer.MarshalTraceContextBinary(ctx) | ||
return defaultTracer.MarshalTraceContextBinary(ctx) | ||
} | ||
|
||
// MarshalTraceContextStringMap defers to | ||
// `TraceContextMarshaler.MarshalTraceContextStringMap`. | ||
// | ||
// See `DefaultTracer()`. | ||
func MarshalTraceContextStringMap(ctx TraceContext) (map[string]string, map[string]string) { | ||
return defaultOpenTracer.MarshalTraceContextStringMap(ctx) | ||
return defaultTracer.MarshalTraceContextStringMap(ctx) | ||
} | ||
|
||
// UnmarshalTraceContextBinary defers to | ||
// `TraceContextUnmarshaler.UnmarshalTraceContextBinary`. | ||
// | ||
// See `DefaultTracer()`. | ||
func UnmarshalTraceContextBinary(traceContextID []byte, traceTags []byte) (TraceContext, error) { | ||
return defaultOpenTracer.UnmarshalTraceContextBinary(traceContextID, traceTags) | ||
return defaultTracer.UnmarshalTraceContextBinary(traceContextID, traceTags) | ||
} | ||
|
||
// UnmarshalTraceContextStringMap defers to | ||
// `TraceContextUnmarshaler.UnmarshaTraceContextStringMap`. | ||
// | ||
// See `DefaultTracer()`. | ||
func UnmarshalTraceContextStringMap(traceContextID map[string]string, traceTags map[string]string) (TraceContext, error) { | ||
return defaultOpenTracer.UnmarshalTraceContextStringMap(traceContextID, traceTags) | ||
return defaultTracer.UnmarshalTraceContextStringMap(traceContextID, traceTags) | ||
} |
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