Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Add GlobalTracer and ActiveSpan #145

Merged
merged 3 commits into from
Jan 5, 2022
Merged

Add GlobalTracer and ActiveSpan #145

merged 3 commits into from
Jan 5, 2022

Conversation

arugal
Copy link
Member

@arugal arugal commented Jan 5, 2022

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

@arugal arugal added the enhancement New feature or request label Jan 5, 2022
@arugal arugal added this to the 1.4.0 milestone Jan 5, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 294 files.

Valid Invalid Ignored Fixed
2 52 240 0
Click to see the invalid file list
  • .github/workflows/ci.yaml
  • .github/workflows/plugin_test.yaml
  • .licenserc.yaml
  • Makefile
  • config_discovery.go
  • config_discovery_test.go
  • correlation.go
  • correlation_test.go
  • doc.go
  • example_trace_test.go
  • golangci.yml
  • internal/idgen/idgen.go
  • internal/idgen/idgen_test.go
  • internal/tool/error.go
  • internal/tool/os_util.go
  • internal/tool/time.go
  • log/context.go
  • log/context_test.go
  • log/doc.go
  • noop.go
  • noop_test.go
  • plugins/http/client.go
  • plugins/http/doc.go
  • plugins/http/example_http_test.go
  • plugins/http/server.go
  • plugins/http/test/client/client.go
  • plugins/http/test/docker/Dockerfile.http_client
  • plugins/http/test/docker/Dockerfile.http_server
  • plugins/http/test/docker-compose.yml
  • plugins/http/test/expected.data.yml
  • plugins/http/test/http_plugin_test.yaml
  • plugins/http/test/server/server.go
  • propagation/propagation.go
  • propagation/propagation_test.go
  • reporter/doc.go
  • reporter/grpc.go
  • reporter/grpc_test.go
  • reporter/log.go
  • sampler.go
  • sampler_test.go
  • segment.go
  • segment_test.go
  • span.go
  • span_opts.go
  • span_test.go
  • test/e2e/example-server/main.go
  • trace.go
  • trace_context.go
  • trace_context_test.go
  • trace_opts.go
  • trace_propagation_test.go
  • trace_test.go

@codecov-commenter
Copy link

codecov-commenter commented Jan 5, 2022

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.

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@wu-sheng wu-sheng merged commit a12c5be into master Jan 5, 2022
@arugal arugal deleted the context branch January 5, 2022 05:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get Span from ctx
3 participants