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

Add archive traces to all-in-one #1189

Merged
Merged
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
38 changes: 35 additions & 3 deletions cmd/all-in-one/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import (
"github.com/jaegertracing/jaeger/pkg/version"
ss "github.com/jaegertracing/jaeger/plugin/sampling/strategystore"
"github.com/jaegertracing/jaeger/plugin/storage"
istorage "github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage/dependencystore"
"github.com/jaegertracing/jaeger/storage/spanstore"
storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics"
Expand Down Expand Up @@ -140,7 +141,7 @@ func main() {

startAgent(aOpts, repOpts, tchannelRepOpts, grpcRepOpts, cOpts, logger, metricsFactory)
grpcServer := startCollector(cOpts, spanWriter, logger, metricsFactory, strategyStore, hc)
startQuery(qOpts, spanReader, dependencyReader, logger, metricsFactory, mBldr, hc)
startQuery(qOpts, spanReader, dependencyReader, logger, metricsFactory, mBldr, hc, archiveOptions(storageFactory, logger))
hc.Ready()
<-signalsChannel
logger.Info("Shutting down")
Expand Down Expand Up @@ -338,6 +339,7 @@ func startQuery(
baseFactory metrics.Factory,
metricsBuilder *pMetrics.Builder,
hc *healthcheck.HealthCheck,
handlerOpts []queryApp.HandlerOption,
) {
tracer, closer, err := jaegerClientConfig.Configuration{
Sampler: &jaegerClientConfig.SamplerConfig{
Expand All @@ -357,11 +359,11 @@ func startQuery(

spanReader = storageMetrics.NewReadMetricsDecorator(spanReader, baseFactory.Namespace("query", nil))

handlerOpts = append(handlerOpts, queryApp.HandlerOptions.Logger(logger), queryApp.HandlerOptions.Tracer(tracer))
apiHandler := queryApp.NewAPIHandler(
spanReader,
depReader,
queryApp.HandlerOptions.Logger(logger),
queryApp.HandlerOptions.Tracer(tracer))
handlerOpts...)

r := mux.NewRouter()
if qOpts.BasePath != "/" {
Expand Down Expand Up @@ -401,3 +403,33 @@ func initSamplingStrategyStore(
}
return strategyStore
}

func archiveOptions(storageFactory istorage.Factory, logger *zap.Logger) []queryApp.HandlerOption {
archiveFactory, ok := storageFactory.(istorage.ArchiveFactory)
if !ok {
logger.Info("Archive storage not supported by the factory")
return nil
}
reader, err := archiveFactory.CreateArchiveSpanReader()
if err == istorage.ErrArchiveStorageNotConfigured || err == istorage.ErrArchiveStorageNotSupported {
logger.Info("Archive storage not created", zap.String("reason", err.Error()))
return nil
}
if err != nil {
logger.Error("Cannot init archive storage reader", zap.Error(err))
return nil
}
writer, err := archiveFactory.CreateArchiveSpanWriter()
if err == istorage.ErrArchiveStorageNotConfigured || err == istorage.ErrArchiveStorageNotSupported {
logger.Info("Archive storage not created", zap.String("reason", err.Error()))
return nil
}
if err != nil {
logger.Error("Cannot init archive storage writer", zap.Error(err))
return nil
}
return []queryApp.HandlerOption{
queryApp.HandlerOptions.ArchiveSpanReader(reader),
queryApp.HandlerOptions.ArchiveSpanWriter(writer),
}
}