Skip to content

Commit

Permalink
Add tracing to the query server (#454)
Browse files Browse the repository at this point in the history
The standalone query server already has tracing enabled. This is a
trivial parity patch.

Signed-off-by: Robert Collins <robertc@vmware.com>
  • Loading branch information
rbtcollins authored and yurishkuro committed Oct 6, 2017
1 parent 5030513 commit d17fad0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cmd/query/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/gorilla/mux"
"github.com/spf13/cobra"
"github.com/spf13/viper"
jaegerClientConfig "github.com/uber/jaeger-client-go/config"
"github.com/uber/jaeger-lib/metrics/go-kit"
"github.com/uber/jaeger-lib/metrics/go-kit/expvar"
"go.uber.org/zap"
Expand Down Expand Up @@ -65,6 +66,18 @@ func main() {

metricsFactory := xkit.Wrap("jaeger-query", expvar.NewFactory(10))

tracer, closer, err := jaegerClientConfig.Configuration{
Sampler: &jaegerClientConfig.SamplerConfig{
Type: "probabilistic",
Param: 1.0,
},
RPCMetrics: true,
}.New("jaeger-query", jaegerClientConfig.Metrics(metricsFactory))
if err != nil {
logger.Fatal("Failed to initialize tracer", zap.Error(err))
}
defer closer.Close()

storageBuild, err := builder.NewStorageBuilder(
sFlags.SpanStorage.Type,
sFlags.DependencyStorage.DataFrequency,
Expand All @@ -76,11 +89,13 @@ func main() {
if err != nil {
logger.Fatal("Failed to init storage builder", zap.Error(err))
}

rHandler := app.NewAPIHandler(
storageBuild.SpanReader,
storageBuild.DependencyReader,
app.HandlerOptions.Prefix(queryOpts.QueryPrefix),
app.HandlerOptions.Logger(logger))
app.HandlerOptions.Logger(logger),
app.HandlerOptions.Tracer(tracer))
sHandler := app.NewStaticAssetsHandler(queryOpts.QueryStaticAssets)
r := mux.NewRouter()
rHandler.RegisterRoutes(r)
Expand Down

0 comments on commit d17fad0

Please sign in to comment.