Compare commits

...

3 Commits

Author SHA1 Message Date
grandwizard28
ea6694b44d feat(combination): test 2024-12-22 02:56:18 +05:30
grandwizard28
433f7920c0 feat(conf): add conf package 2024-12-22 01:59:42 +05:30
grandwizard28
5107dcf098 feat(conf): add conf package 2024-12-22 01:59:00 +05:30
6 changed files with 49 additions and 6 deletions

View File

@@ -128,7 +128,7 @@ build-ee-query-service-amd64:
make QUERY_SERVICE_DIRECTORY=${EE_QUERY_SERVICE_DIRECTORY} build-query-service-amd64
# Step to build and push EE docker image of query in amd64 and arm64 (used in push pipeline)
build-push-ee-query-service:
build-push-ee-query-service: build-frontend-static
@echo "------------------"
@echo "--> Building and pushing query-service docker image"
@echo "------------------"

11
conf/defaults.yaml Normal file
View File

@@ -0,0 +1,11 @@
##################### SigNoz Configuration Defaults #####################
#
# Do not modify this file
#
##################### Web #####################
web:
# The prefix to serve web on
prefix: /
# The directory containing the static build files.
directory: /etc/signoz/web

View File

@@ -23,6 +23,9 @@ COPY pkg/query-service/templates /root/templates
# Make query-service executable for non-root users
RUN chmod 755 /root /root/query-service
# Copy frontend
COPY frontend/build/ /etc/signoz/web/
# run the binary
ENTRYPOINT ["./query-service"]

View File

@@ -32,6 +32,7 @@ import (
baseauth "go.signoz.io/signoz/pkg/query-service/auth"
"go.signoz.io/signoz/pkg/query-service/migrate"
v3 "go.signoz.io/signoz/pkg/query-service/model/v3"
"go.signoz.io/signoz/pkg/web"
licensepkg "go.signoz.io/signoz/ee/query-service/license"
"go.signoz.io/signoz/ee/query-service/usage"
@@ -107,7 +108,7 @@ func (s Server) HealthCheckStatus() chan healthcheck.Status {
}
// NewServer creates and initializes Server
func NewServer(serverOptions *ServerOptions) (*Server, error) {
func NewServer(serverOptions *ServerOptions, web *web.Web) (*Server, error) {
modelDao, err := dao.InitDao("sqlite", baseconst.RELATIONAL_DATASOURCE_PATH)
if err != nil {
@@ -289,7 +290,7 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
usageManager: usageManager,
}
httpServer, err := s.createPublicServer(apiHandler)
httpServer, err := s.createPublicServer(apiHandler, web)
if err != nil {
return nil, err
@@ -338,7 +339,7 @@ func (s *Server) createPrivateServer(apiHandler *api.APIHandler) (*http.Server,
}, nil
}
func (s *Server) createPublicServer(apiHandler *api.APIHandler) (*http.Server, error) {
func (s *Server) createPublicServer(apiHandler *api.APIHandler, web *web.Web) (*http.Server, error) {
r := baseapp.NewRouter()
@@ -382,6 +383,11 @@ func (s *Server) createPublicServer(apiHandler *api.APIHandler) (*http.Server, e
handler = handlers.CompressHandler(handler)
err := web.AddToRouter(r)
if err != nil {
return nil, err
}
return &http.Server{
Handler: handler,
}, nil

View File

@@ -10,13 +10,17 @@ import (
"syscall"
"time"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
"go.signoz.io/signoz/ee/query-service/app"
signozconfig "go.signoz.io/signoz/pkg/config"
"go.signoz.io/signoz/pkg/confmap/provider/signozenvprovider"
"go.signoz.io/signoz/pkg/query-service/auth"
baseconst "go.signoz.io/signoz/pkg/query-service/constants"
"go.signoz.io/signoz/pkg/query-service/migrate"
"go.signoz.io/signoz/pkg/query-service/version"
signozweb "go.signoz.io/signoz/pkg/web"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@@ -131,6 +135,23 @@ func main() {
version.PrintVersion()
config, err := signozconfig.New(context.Background(), signozconfig.ProviderSettings{
ResolverSettings: confmap.ResolverSettings{
URIs: []string{"signozenv:"},
ProviderFactories: []confmap.ProviderFactory{
signozenvprovider.NewFactory(),
},
},
})
if err != nil {
zap.L().Fatal("Failed to create config", zap.Error(err))
}
web, err := signozweb.New(zap.L(), config.Web)
if err != nil {
zap.L().Fatal("Failed to create web", zap.Error(err))
}
serverOptions := &app.ServerOptions{
HTTPHostPort: baseconst.HTTPHostPort,
PromConfigPath: promConfigPath,
@@ -165,7 +186,7 @@ func main() {
zap.L().Info("Migration successful")
}
server, err := app.NewServer(serverOptions)
server, err := app.NewServer(serverOptions, web)
if err != nil {
zap.L().Fatal("Failed to create server", zap.Error(err))
}

View File

@@ -22,7 +22,9 @@ func unmarshal(conf *confmap.Conf) (*Config, error) {
for k := range raw {
e, ok := byName(k)
if !ok {
return nil, fmt.Errorf("cannot find config with name %q", k)
continue
// Uncomment when the new configuration has been rolled out
//return nil, fmt.Errorf("cannot find config with name %q", k)
}
i, ok := e.(signozconfmap.Config)
if !ok {