SkyAPM / go2sky

Distributed tracing and monitor SDK in Go for Apache SkyWalking APM
https://skywalking.apache.org/
Apache License 2.0
448 stars 122 forks source link

Add GlobalTracer and ActiveSpan #145

Closed arugal closed 2 years ago

arugal commented 2 years ago

GlobalTracer

tracer, _ := NewTracer("service")

// registers `tracer` as the global Tracer.
SetGlobalTracer(tracer)

// returns the registered global Tracer
tracer1 := GetGlobalTracer()

ActiveSpan

tracer, _ := NewTracer("service")
_, ctx, err := tracer.CreateLocalSpan(context.Background())
if err != nil {
  t.Error(err)
}

activeSpan := ActiveSpan(ctx)

resolve #96

codecov-commenter commented 2 years ago

Codecov Report

Merging #145 (b23a5f4) into master (0f9874e) will increase coverage by 0.47%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #145      +/-   ##
==========================================
+ Coverage   70.38%   70.86%   +0.47%     
==========================================
  Files          17       18       +1     
  Lines         915      930      +15     
==========================================
+ Hits          644      659      +15     
  Misses        224      224              
  Partials       47       47              
Impacted Files Coverage Δ
trace.go 82.47% <ø> (ø)
trace_context.go 100.00% <100.00%> (ø)
trace_state.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0f9874e...b23a5f4. Read the comment docs.