Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add tracing integration to profiling. #3276

Merged
merged 9 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 77 additions & 22 deletions CHANGELOG.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion cmd/tempo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/go-kit/log/level"
"github.com/grafana/dskit/flagext"
dslog "github.com/grafana/dskit/log"
"github.com/grafana/dskit/spanprofiler"
"github.com/grafana/dskit/tracing"
ot "github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -228,6 +229,8 @@ func installOpenTracingTracer(config *app.Config) (func(), error) {
if err != nil {
return nil, fmt.Errorf("error initialising tracer: %w", err)
}
ot.SetGlobalTracer(spanprofiler.NewTracer(ot.GlobalTracer()))

return func() {
if err := trace.Close(); err != nil {
level.Error(log.Logger).Log("msg", "error closing tracing", "err", err)
Expand Down Expand Up @@ -286,7 +289,7 @@ func installOpenTelemetryTracer(config *app.Config) (func(), error) {
bridgeTracer.SetWarningHandler(func(msg string) {
level.Warn(log.Logger).Log("msg", msg, "source", "BridgeTracer.OnWarningHandler")
})
ot.SetGlobalTracer(bridgeTracer)
ot.SetGlobalTracer(spanprofiler.NewTracer(bridgeTracer))

// Install the OpenCensus bridge
oc_bridge.InstallTraceBridge(oc_bridge.WithTracerProvider(tp))
Expand Down
8 changes: 4 additions & 4 deletions modules/distributor/distributor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,10 @@ func (r mockRing) ShuffleShardWithLookback(string, int, time.Duration, time.Time
return r
}

func (r mockRing) GetTokenRangesForInstance(_ string) (ring.TokenRanges, error) {
return nil, nil
}

func (r mockRing) InstancesCount() int {
return len(r.ingesters)
}
Expand All @@ -1506,7 +1510,3 @@ func (r mockRing) CleanupShuffleShardCache(string) {
func (r mockRing) GetInstanceState(string) (ring.InstanceState, error) {
return ring.ACTIVE, nil
}

func (r mockRing) GetTokenRangesForInstance(_ string) (ring.TokenRanges, error) {
return nil, nil
}
104 changes: 104 additions & 0 deletions vendor/github.com/grafana/dskit/spanprofiler/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 107 additions & 0 deletions vendor/github.com/grafana/dskit/spanprofiler/spanprofiler.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

109 changes: 109 additions & 0 deletions vendor/github.com/grafana/dskit/spanprofiler/tracer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ github.com/grafana/dskit/server
github.com/grafana/dskit/services
github.com/grafana/dskit/signals
github.com/grafana/dskit/spanlogger
github.com/grafana/dskit/spanprofiler
github.com/grafana/dskit/tenant
github.com/grafana/dskit/tracing
github.com/grafana/dskit/user
Expand Down
Loading