feat: opentracing in query execution runtime
parent
578f97d0b7
commit
74ba877cb9
|
@ -7,6 +7,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/flux"
|
||||
"github.com/influxdata/influxdb"
|
||||
"github.com/influxdata/influxdb/cmd/influxd/generate"
|
||||
"github.com/influxdata/influxdb/cmd/influxd/inspect"
|
||||
|
@ -45,6 +46,11 @@ func init() {
|
|||
rootCmd.AddCommand(launcher.NewCommand())
|
||||
rootCmd.AddCommand(generate.Command)
|
||||
rootCmd.AddCommand(inspect.NewCommand())
|
||||
|
||||
// TODO: this should be removed in the future: https://github.com/influxdata/influxdb/issues/16220
|
||||
if os.Getenv("QUERY_TRACING") == "1" {
|
||||
flux.EnableExperimentalTracing()
|
||||
}
|
||||
}
|
||||
|
||||
// find determines the default behavior when running influxd.
|
||||
|
|
|
@ -45,7 +45,14 @@ type Source struct {
|
|||
func (s *Source) Run(ctx context.Context) {
|
||||
labelValues := s.m.getLabelValues(ctx, s.orgID, s.op)
|
||||
start := time.Now()
|
||||
err := s.runner.run(ctx)
|
||||
var err error
|
||||
if flux.IsExperimentalTracingEnabled() {
|
||||
span, ctxWithSpan := tracing.StartSpanFromContextWithOperationName(ctx, "source-"+s.op)
|
||||
err = s.runner.run(ctxWithSpan)
|
||||
span.Finish()
|
||||
} else {
|
||||
err = s.runner.run(ctx)
|
||||
}
|
||||
s.m.recordMetrics(labelValues, start)
|
||||
for _, t := range s.ts {
|
||||
t.Finish(s.id, err)
|
||||
|
|
Loading…
Reference in New Issue