diff --git a/cmd/query/app/fixture/index.html b/cmd/query/app/fixture/index.html
index 0bce65817e0..322c925ede2 100644
--- a/cmd/query/app/fixture/index.html
+++ b/cmd/query/app/fixture/index.html
@@ -1,12 +1,14 @@
-
-
-
Test Page
-
+
diff --git a/cmd/query/app/querysvc/query_service.go b/cmd/query/app/querysvc/query_service.go
index 7dde2813cae..d9b4a758de3 100644
--- a/cmd/query/app/querysvc/query_service.go
+++ b/cmd/query/app/querysvc/query_service.go
@@ -41,6 +41,13 @@ type QueryServiceOptions struct {
Adjuster adjuster.Adjuster
}
+// StorageCapabilities is a feature flag for query service
+type StorageCapabilities struct {
+ ArchiveStorage bool `json:"archiveStorage"`
+ // SupportRegex bool
+ // SupportTagFilter bool
+}
+
// QueryService contains span utils required by the query-service.
type QueryService struct {
spanReader spanstore.Reader
@@ -122,6 +129,13 @@ func (qs QueryService) GetDependencies(ctx context.Context, endTs time.Time, loo
return qs.dependencyReader.GetDependencies(ctx, endTs, lookback)
}
+// GetCapabilities returns the features supported by the query service.
+func (qs QueryService) GetCapabilities() StorageCapabilities {
+ return StorageCapabilities{
+ ArchiveStorage: qs.options.hasArchiveStorage(),
+ }
+}
+
// InitArchiveStorage tries to initialize archive storage reader/writer if storage factory supports them.
func (opts *QueryServiceOptions) InitArchiveStorage(storageFactory storage.Factory, logger *zap.Logger) bool {
archiveFactory, ok := storageFactory.(storage.ArchiveFactory)
@@ -151,3 +165,8 @@ func (opts *QueryServiceOptions) InitArchiveStorage(storageFactory storage.Facto
opts.ArchiveSpanWriter = writer
return true
}
+
+// hasArchiveStorage returns true if archive storage reader/writer are initialized.
+func (opts *QueryServiceOptions) hasArchiveStorage() bool {
+ return opts.ArchiveSpanReader != nil && opts.ArchiveSpanWriter != nil
+}
diff --git a/cmd/query/app/querysvc/query_service_test.go b/cmd/query/app/querysvc/query_service_test.go
index ee214c33ea2..0a995b91dcd 100644
--- a/cmd/query/app/querysvc/query_service_test.go
+++ b/cmd/query/app/querysvc/query_service_test.go
@@ -285,6 +285,24 @@ func TestGetDependencies(t *testing.T) {
assert.Equal(t, expectedDependencies, actualDependencies)
}
+// Test QueryService.GetCapacities()
+func TestGetCapacities(t *testing.T) {
+ tqs := initializeTestService()
+ expectedStorageCapabilities := StorageCapabilities{
+ ArchiveStorage: false,
+ }
+ assert.Equal(t, expectedStorageCapabilities, tqs.queryService.GetCapabilities())
+}
+
+func TestGetCapacitiesWithSupportsArchive(t *testing.T) {
+ tqs := initializeTestService(withArchiveSpanReader(), withArchiveSpanWriter())
+
+ expectedStorageCapabilities := StorageCapabilities{
+ ArchiveStorage: true,
+ }
+ assert.Equal(t, expectedStorageCapabilities, tqs.queryService.GetCapabilities())
+}
+
type fakeStorageFactory1 struct{}
type fakeStorageFactory2 struct {
diff --git a/cmd/query/app/server.go b/cmd/query/app/server.go
index 15adf5f62e3..3a7d0f548cf 100644
--- a/cmd/query/app/server.go
+++ b/cmd/query/app/server.go
@@ -172,7 +172,7 @@ func createHTTPServer(querySvc *querysvc.QueryService, metricsQuerySvc querysvc.
}
apiHandler.RegisterRoutes(r)
- RegisterStaticHandler(r, logger, queryOpts)
+ RegisterStaticHandler(r, logger, queryOpts, querySvc.GetCapabilities())
var handler http.Handler = r
handler = additionalHeadersHandler(handler, queryOpts.AdditionalHeaders)
if queryOpts.BearerTokenPropagation {
diff --git a/cmd/query/app/static_handler.go b/cmd/query/app/static_handler.go
index 5e9ab8f9f44..bc7b873b826 100644
--- a/cmd/query/app/static_handler.go
+++ b/cmd/query/app/static_handler.go
@@ -30,6 +30,7 @@ import (
"github.com/gorilla/mux"
"go.uber.org/zap"
+ "github.com/jaegertracing/jaeger/cmd/query/app/querysvc"
"github.com/jaegertracing/jaeger/cmd/query/app/ui"
"github.com/jaegertracing/jaeger/pkg/fswatcher"
"github.com/jaegertracing/jaeger/pkg/version"
@@ -37,19 +38,21 @@ import (
var (
// The following patterns are searched and replaced in the index.html as a way of customizing the UI.
- configPattern = regexp.MustCompile("JAEGER_CONFIG *= *DEFAULT_CONFIG;")
- configJsPattern = regexp.MustCompile(`(?im)^\s*\/\/\s*JAEGER_CONFIG_JS.*\n.*`)
- versionPattern = regexp.MustCompile("JAEGER_VERSION *= *DEFAULT_VERSION;")
- basePathPattern = regexp.MustCompile(`