Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat(cmd): add cmd package (#8535)

Vibhu Pandeyebb2f1fd637f
diff --git a/.github/workflows/build-community.yaml b/.github/workflows/build-community.yaml
index b0d0ec70b3..1a80393c7b 100644
--- a/.github/workflows/build-community.yaml
+++ b/.github/workflows/build-community.yaml
@@ -66,7 +66,7 @@ jobs:
GO_NAME: signoz-community
GO_INPUT_ARTIFACT_CACHE_KEY: community-jsbuild-${{ github.sha }}
GO_INPUT_ARTIFACT_PATH: frontend/build
- GO_BUILD_CONTEXT: ./pkg/query-service
+ GO_BUILD_CONTEXT: ./cmd/community
GO_BUILD_FLAGS: >-
-tags timetzdata
-ldflags='-linkmode external -extldflags \"-static\" -s -w
@@ -78,6 +78,6 @@ jobs:
-X github.com/SigNoz/signoz/pkg/analytics.key=9kRrJ7oPCGPEJLF6QjMPLt5bljFhRQBr'
GO_CGO_ENABLED: 1
DOCKER_BASE_IMAGES: '{"alpine": "alpine:3.20.3"}'
- DOCKER_DOCKERFILE_PATH: ./pkg/query-service/Dockerfile.multi-arch
+ DOCKER_DOCKERFILE_PATH: ./cmd/community/Dockerfile.multi-arch
DOCKER_MANIFEST: true
DOCKER_PROVIDERS: dockerhub
diff --git a/.github/workflows/build-enterprise.yaml b/.github/workflows/build-enterprise.yaml
index 36aba8533f..abc8ddaf0c 100644
--- a/.github/workflows/build-enterprise.yaml
+++ b/.github/workflows/build-enterprise.yaml
@@ -96,7 +96,7 @@ jobs:
GO_VERSION: 1.23
GO_INPUT_ARTIFACT_CACHE_KEY: enterprise-jsbuild-${{ github.sha }}
GO_INPUT_ARTIFACT_PATH: frontend/build
- GO_BUILD_CONTEXT: ./ee/query-service
+ GO_BUILD_CONTEXT: ./cmd/enterprise
GO_BUILD_FLAGS: >-
-tags timetzdata
-ldflags='-linkmode external -extldflags \"-static\" -s -w
@@ -112,6 +112,6 @@ jobs:
-X github.com/SigNoz/signoz/pkg/analytics.key=9kRrJ7oPCGPEJLF6QjMPLt5bljFhRQBr'
GO_CGO_ENABLED: 1
DOCKER_BASE_IMAGES: '{"alpine": "alpine:3.20.3"}'
- DOCKER_DOCKERFILE_PATH: ./ee/query-service/Dockerfile.multi-arch
+ DOCKER_DOCKERFILE_PATH: ./cmd/enterprise/Dockerfile.multi-arch
DOCKER_MANIFEST: true
DOCKER_PROVIDERS: ${{ needs.prepare.outputs.docker_providers }}
diff --git a/.github/workflows/build-staging.yaml b/.github/workflows/build-staging.yaml
index dec3ba1217..89d829c670 100644
--- a/.github/workflows/build-staging.yaml
+++ b/.github/workflows/build-staging.yaml
@@ -95,7 +95,7 @@ jobs:
GO_VERSION: 1.23
GO_INPUT_ARTIFACT_CACHE_KEY: staging-jsbuild-${{ github.sha }}
GO_INPUT_ARTIFACT_PATH: frontend/build
- GO_BUILD_CONTEXT: ./ee/query-service
+ GO_BUILD_CONTEXT: ./cmd/enterprise
GO_BUILD_FLAGS: >-
-tags timetzdata
-ldflags='-linkmode external -extldflags \"-static\" -s -w
@@ -111,7 +111,7 @@ jobs:
-X github.com/SigNoz/signoz/pkg/analytics.key=9kRrJ7oPCGPEJLF6QjMPLt5bljFhRQBr'
GO_CGO_ENABLED: 1
DOCKER_BASE_IMAGES: '{"alpine": "alpine:3.20.3"}'
- DOCKER_DOCKERFILE_PATH: ./ee/query-service/Dockerfile.multi-arch
+ DOCKER_DOCKERFILE_PATH: ./cmd/enterprise/Dockerfile.multi-arch
DOCKER_MANIFEST: true
DOCKER_PROVIDERS: gcp
staging:
diff --git a/.github/workflows/gor-signoz-community.yaml b/.github/workflows/gor-signoz-community.yaml
index 5fb3ff1cb5..5e3b51c922 100644
--- a/.github/workflows/gor-signoz-community.yaml
+++ b/.github/workflows/gor-signoz-community.yaml
@@ -36,7 +36,7 @@ jobs:
- ubuntu-latest
- macos-latest
env:
- CONFIG_PATH: pkg/query-service/.goreleaser.yaml
+ CONFIG_PATH: cmd/community/.goreleaser.yaml
runs-on: ${{ matrix.os }}
steps:
- name: checkout
@@ -100,7 +100,7 @@ jobs:
needs: build
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
- WORKDIR: pkg/query-service
+ WORKDIR: cmd/community
steps:
- name: checkout
uses: actions/checkout@v4
diff --git a/.github/workflows/gor-signoz.yaml b/.github/workflows/gor-signoz.yaml
index 4f8f923fe8..dc70413aff 100644
--- a/.github/workflows/gor-signoz.yaml
+++ b/.github/workflows/gor-signoz.yaml
@@ -50,7 +50,7 @@ jobs:
- ubuntu-latest
- macos-latest
env:
- CONFIG_PATH: ee/query-service/.goreleaser.yaml
+ CONFIG_PATH: cmd/enterprise/.goreleaser.yaml
runs-on: ${{ matrix.os }}
steps:
- name: checkout
diff --git a/.github/workflows/integrationci.yaml b/.github/workflows/integrationci.yaml
index 0b7d1670a3..d1d39e2eb0 100644
--- a/.github/workflows/integrationci.yaml
+++ b/.github/workflows/integrationci.yaml
@@ -20,7 +20,7 @@ jobs:
- sqlite
clickhouse-version:
- 24.1.2-alpine
- - 24.12-alpine
+ - 25.5.6
schema-migrator-version:
- v0.128.1
postgres-version:
diff --git a/LICENSE b/LICENSE
index 2fef891b37..7e1ae4f6ba 100644
--- a/LICENSE
+++ b/LICENSE
@@ -2,7 +2,7 @@ Copyright (c) 2020-present SigNoz Inc.
Portions of this software are licensed as follows:
-* All content that resides under the "ee/" directory of this repository, if that directory exists, is licensed under the license defined in "ee/LICENSE".
+* All content that resides under the "ee/" and the "cmd/enterprise/" directory of this repository, if that directory exists, is licensed under the license defined in "ee/LICENSE".
* All third party components incorporated into the SigNoz Software are licensed under the original license provided by the owner of the applicable component.
* Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below.
diff --git a/Makefile b/Makefile
index 31b1764b20..061bffc64e 100644
--- a/Makefile
+++ b/Makefile
@@ -20,18 +20,18 @@ GO_BUILD_LDFLAG_LICENSE_SIGNOZ_IO = -X github.com/SigNoz/signoz/ee/zeus.depreca
GO_BUILD_VERSION_LDFLAGS = -X github.com/SigNoz/signoz/pkg/version.version=$(VERSION) -X github.com/SigNoz/signoz/pkg/version.hash=$(COMMIT_SHORT_SHA) -X github.com/SigNoz/signoz/pkg/version.time=$(TIMESTAMP) -X github.com/SigNoz/signoz/pkg/version.branch=$(BRANCH_NAME)
GO_BUILD_ARCHS_COMMUNITY = $(addprefix go-build-community-,$(ARCHS))
-GO_BUILD_CONTEXT_COMMUNITY = $(SRC)/pkg/query-service
+GO_BUILD_CONTEXT_COMMUNITY = $(SRC)/cmd/community
GO_BUILD_LDFLAGS_COMMUNITY = $(GO_BUILD_VERSION_LDFLAGS) -X github.com/SigNoz/signoz/pkg/version.variant=community
GO_BUILD_ARCHS_ENTERPRISE = $(addprefix go-build-enterprise-,$(ARCHS))
GO_BUILD_ARCHS_ENTERPRISE_RACE = $(addprefix go-build-enterprise-race-,$(ARCHS))
-GO_BUILD_CONTEXT_ENTERPRISE = $(SRC)/ee/query-service
+GO_BUILD_CONTEXT_ENTERPRISE = $(SRC)/cmd/enterprise
GO_BUILD_LDFLAGS_ENTERPRISE = $(GO_BUILD_VERSION_LDFLAGS) -X github.com/SigNoz/signoz/pkg/version.variant=enterprise $(GO_BUILD_LDFLAG_ZEUS_URL) $(GO_BUILD_LDFLAG_LICENSE_SIGNOZ_IO)
DOCKER_BUILD_ARCHS_COMMUNITY = $(addprefix docker-build-community-,$(ARCHS))
-DOCKERFILE_COMMUNITY = $(SRC)/pkg/query-service/Dockerfile
+DOCKERFILE_COMMUNITY = $(SRC)/cmd/community/Dockerfile
DOCKER_REGISTRY_COMMUNITY ?= docker.io/signoz/signoz-community
DOCKER_BUILD_ARCHS_ENTERPRISE = $(addprefix docker-build-enterprise-,$(ARCHS))
-DOCKERFILE_ENTERPRISE = $(SRC)/ee/query-service/Dockerfile
+DOCKERFILE_ENTERPRISE = $(SRC)/cmd/enterprise/Dockerfile
DOCKER_REGISTRY_ENTERPRISE ?= docker.io/signoz/signoz
JS_BUILD_CONTEXT = $(SRC)/frontend
@@ -74,7 +74,7 @@ go-run-enterprise: ## Runs the enterprise go backend server
SIGNOZ_TELEMETRYSTORE_PROVIDER=clickhouse \
SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://127.0.0.1:9000 \
go run -race \
- $(GO_BUILD_CONTEXT_ENTERPRISE)/main.go \
+ $(GO_BUILD_CONTEXT_ENTERPRISE)/*.go \
--config ./conf/prometheus.yml \
--cluster cluster
@@ -92,7 +92,7 @@ go-run-community: ## Runs the community go backend server
SIGNOZ_TELEMETRYSTORE_PROVIDER=clickhouse \
SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_DSN=tcp://127.0.0.1:9000 \
go run -race \
- $(GO_BUILD_CONTEXT_COMMUNITY)/main.go \
+ $(GO_BUILD_CONTEXT_COMMUNITY)/*.go \
--config ./conf/prometheus.yml \
--cluster cluster
diff --git a/pkg/query-service/.goreleaser.yaml b/cmd/community/.goreleaser.yaml
similarity index 97%
rename from pkg/query-service/.goreleaser.yaml
rename to cmd/community/.goreleaser.yaml
index 3ffd74d07f..16a7fe7d95 100644
--- a/pkg/query-service/.goreleaser.yaml
+++ b/cmd/community/.goreleaser.yaml
@@ -11,7 +11,7 @@ before:
builds:
- id: signoz
binary: bin/signoz
- main: pkg/query-service/main.go
+ main: cmd/community
env:
- CGO_ENABLED=1
- >-
diff --git a/pkg/query-service/Dockerfile b/cmd/community/Dockerfile
similarity index 91%
rename from pkg/query-service/Dockerfile
rename to cmd/community/Dockerfile
index 38609cc182..22433506f6 100644
--- a/pkg/query-service/Dockerfile
+++ b/cmd/community/Dockerfile
@@ -16,4 +16,4 @@ COPY frontend/build/ /etc/signoz/web/
RUN chmod 755 /root /root/signoz
-ENTRYPOINT ["./signoz"]
+ENTRYPOINT ["./signoz", "server"]
\ No newline at end of file
diff --git a/pkg/query-service/Dockerfile.multi-arch b/cmd/community/Dockerfile.multi-arch
similarity index 90%
rename from pkg/query-service/Dockerfile.multi-arch
rename to cmd/community/Dockerfile.multi-arch
index 229b50d843..3a6c479a60 100644
--- a/pkg/query-service/Dockerfile.multi-arch
+++ b/cmd/community/Dockerfile.multi-arch
@@ -17,4 +17,4 @@ COPY frontend/build/ /etc/signoz/web/
RUN chmod 755 /root /root/signoz-community
-ENTRYPOINT ["./signoz-community"]
+ENTRYPOINT ["./signoz-community", "server"]
diff --git a/cmd/community/main.go b/cmd/community/main.go
new file mode 100644
index 0000000000..e188635734
--- /dev/null
+++ b/cmd/community/main.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+ "log/slog"
+
+ "github.com/SigNoz/signoz/cmd"
+ "github.com/SigNoz/signoz/pkg/instrumentation"
+)
+
+func main() {
+ // initialize logger for logging in the cmd/ package. This logger is different from the logger used in the application.
+ logger := instrumentation.NewLogger(instrumentation.Config{Logs: instrumentation.LogsConfig{Level: slog.LevelInfo}})
+
+ // register a list of commands to the root command
+ registerServer(cmd.RootCmd, logger)
+
+ cmd.Execute(logger)
+}
diff --git a/cmd/community/server.go b/cmd/community/server.go
new file mode 100644
index 0000000000..9def8a147a
--- /dev/null
+++ b/cmd/community/server.go
@@ -0,0 +1,116 @@
+package main
+
+import (
+ "context"
+ "log/slog"
+ "time"
+
+ "github.com/SigNoz/signoz/cmd"
+ "github.com/SigNoz/signoz/ee/sqlstore/postgressqlstore"
+ "github.com/SigNoz/signoz/pkg/analytics"
+ "github.com/SigNoz/signoz/pkg/factory"
+ "github.com/SigNoz/signoz/pkg/licensing"
+ "github.com/SigNoz/signoz/pkg/licensing/nooplicensing"
+ "github.com/SigNoz/signoz/pkg/modules/organization"
+ "github.com/SigNoz/signoz/pkg/query-service/app"
+ "github.com/SigNoz/signoz/pkg/signoz"
+ "github.com/SigNoz/signoz/pkg/sqlschema"
+ "github.com/SigNoz/signoz/pkg/sqlstore"
+ "github.com/SigNoz/signoz/pkg/sqlstore/sqlstorehook"
+ "github.com/SigNoz/signoz/pkg/types/authtypes"
+ "github.com/SigNoz/signoz/pkg/version"
+ "github.com/SigNoz/signoz/pkg/zeus"
+ "github.com/SigNoz/signoz/pkg/zeus/noopzeus"
+ "github.com/spf13/cobra"
+)
+
+func registerServer(parentCmd *cobra.Command, logger *slog.Logger) {
+ var flags signoz.DeprecatedFlags
+
+ serverCmd := &cobra.Command{
+ Use: "server",
+ Short: "Run the SigNoz server",
+ FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
+ RunE: func(currCmd *cobra.Command, args []string) error {
+ config, err := cmd.NewSigNozConfig(currCmd.Context(), flags)
+ if err != nil {
+ return err
+ }
+
+ return runServer(currCmd.Context(), config, logger)
+ },
+ }
+
+ flags.RegisterFlags(serverCmd)
+ parentCmd.AddCommand(serverCmd)
+}
+
+func runServer(ctx context.Context, config signoz.Config, logger *slog.Logger) error {
+ // print the version
+ version.Info.PrettyPrint(config.Version)
+
+ // add enterprise sqlstore factories to the community sqlstore factories
+ sqlstoreFactories := signoz.NewSQLStoreProviderFactories()
+ if err := sqlstoreFactories.Add(postgressqlstore.NewFactory(sqlstorehook.NewLoggingFactory())); err != nil {
+ logger.ErrorContext(ctx, "failed to add postgressqlstore factory", "error", err)
+ return err
+ }
+
+ jwt := authtypes.NewJWT(cmd.NewJWTSecret(ctx, logger), 30*time.Minute, 30*24*time.Hour)
+
+ signoz, err := signoz.New(
+ ctx,
+ config,
+ jwt,
+ zeus.Config{},
+ noopzeus.NewProviderFactory(),
+ licensing.Config{},
+ func(_ sqlstore.SQLStore, _ zeus.Zeus, _ organization.Getter, _ analytics.Analytics) factory.ProviderFactory[licensing.Licensing, licensing.Config] {
+ return nooplicensing.NewFactory()
+ },
+ signoz.NewEmailingProviderFactories(),
+ signoz.NewCacheProviderFactories(),
+ signoz.NewWebProviderFactories(),
+ func(sqlstore sqlstore.SQLStore) factory.NamedMap[factory.ProviderFactory[sqlschema.SQLSchema, sqlschema.Config]] {
+ return signoz.NewSQLSchemaProviderFactories(sqlstore)
+ },
+ signoz.NewSQLStoreProviderFactories(),
+ signoz.NewTelemetryStoreProviderFactories(),
+ )
+ if err != nil {
+ logger.ErrorContext(ctx, "failed to create signoz", "error", err)
+ return err
+ }
+
+ server, err := app.NewServer(config, signoz, jwt)
+ if err != nil {
+ logger.ErrorContext(ctx, "failed to create server", "error", err)
+ return err
+ }
+
+ if err := server.Start(ctx); err != nil {
+ logger.ErrorContext(ctx, "failed to start server", "error", err)
+ return err
+ }
+
+ signoz.Start(ctx)
+
+ if err := signoz.Wait(ctx); err != nil {
+ logger.ErrorContext(ctx, "failed to start signoz", "error", err)
+ return err
+ }
+
+ err = server.Stop(ctx)
+ if err != nil {
+ logger.ErrorContext(ctx, "failed to stop server", "error", err)
+ return err
+ }
+
+ err = signoz.Stop(ctx)
+ if err != nil {
+ logger.ErrorContext(ctx, "failed to stop signoz", "error", err)
+ return err
+ }
+
+ return nil
+}
diff --git a/cmd/config.go b/cmd/config.go
new file mode 100644
index 0000000000..4e627c4f91
--- /dev/null
+++ b/cmd/config.go
@@ -0,0 +1,45 @@
+package cmd
+
+import (
+ "context"
+ "fmt"
+ "log/slog"
+ "os"
+
+ "github.com/SigNoz/signoz/pkg/config"
+ "github.com/SigNoz/signoz/pkg/config/envprovider"
+ "github.com/SigNoz/signoz/pkg/config/fileprovider"
+ "github.com/SigNoz/signoz/pkg/signoz"
+)
+
+func NewSigNozConfig(ctx context.Context, flags signoz.DeprecatedFlags) (signoz.Config, error) {
+ config, err := signoz.NewConfig(
+ ctx,
+ config.ResolverConfig{
+ Uris: []string{"env:"},
+ ProviderFactories: []config.ProviderFactory{
+ envprovider.NewFactory(),
+ fileprovider.NewFactory(),
+ },
+ },
+ flags,
+ )
+ if err != nil {
+ return signoz.Config{}, err
+ }
+
+ return config, nil
+}
+
+func NewJWTSecret(_ context.Context, _ *slog.Logger) string {
+ jwtSecret := os.Getenv("SIGNOZ_JWT_SECRET")
+ if len(jwtSecret) == 0 {
+ fmt.Println("🚨 CRITICAL SECURITY ISSUE: No JWT secret key specified!")
+ fmt.Println("SIGNOZ_JWT_SECRET environment variable is not set. This has dire consequences for the security of the application.")
+ fmt.Println("Without a JWT secret, user sessions are vulnerable to tampering and unauthorized access.")
+ fmt.Println("Please set the SIGNOZ_JWT_SECRET environment variable immediately.")
+ fmt.Println("For more information, please refer to https://github.com/SigNoz/signoz/issues/8400.")
+ }
+
+ return jwtSecret
+}
diff --git a/ee/query-service/.goreleaser.yaml b/cmd/enterprise/.goreleaser.yaml
similarity index 98%
rename from ee/query-service/.goreleaser.yaml
rename to cmd/enterprise/.goreleaser.yaml
index e3982597d1..43d3e9d340 100644
--- a/ee/query-service/.goreleaser.yaml
+++ b/cmd/enterprise/.goreleaser.yaml
@@ -11,7 +11,7 @@ before:
builds:
- id: signoz
binary: bin/signoz
- main: ee/query-service/main.go
+ main: cmd/enterprise
env:
- CGO_ENABLED=1
- >-
diff --git a/ee/query-service/Dockerfile b/cmd/enterprise/Dockerfile
similarity index 90%
rename from ee/query-service/Dockerfile
rename to cmd/enterprise/Dockerfile
index 2c8a7cd809..798055afb1 100644
--- a/ee/query-service/Dockerfile
+++ b/cmd/enterprise/Dockerfile
@@ -16,4 +16,4 @@ COPY frontend/build/ /etc/signoz/web/
RUN chmod 755 /root /root/signoz
-ENTRYPOINT ["./signoz"]
\ No newline at end of file
+ENTRYPOINT ["./signoz", "server"]
diff --git a/ee/query-service/Dockerfile.integration b/cmd/enterprise/Dockerfile.integration
similarity index 92%
rename from ee/query-service/Dockerfile.integration
rename to cmd/enterprise/Dockerfile.integration
index 40a76a5bbc..fe3eb583f7 100644
--- a/ee/query-service/Dockerfile.integration
+++ b/cmd/enterprise/Dockerfile.integration
@@ -23,6 +23,7 @@ COPY go.mod go.sum ./
RUN go mod download
+COPY ./cmd/ ./cmd/
COPY ./ee/ ./ee/
COPY ./pkg/ ./pkg/
COPY ./templates/email /root/templates
@@ -33,4 +34,4 @@ RUN mv /root/linux-${TARGETARCH}/signoz /root/signoz
RUN chmod 755 /root /root/signoz
-ENTRYPOINT ["/root/signoz"]
+ENTRYPOINT ["/root/signoz", "server"]
diff --git a/ee/query-service/Dockerfile.multi-arch b/cmd/enterprise/Dockerfile.multi-arch
similarity index 92%
rename from ee/query-service/Dockerfile.multi-arch
rename to cmd/enterprise/Dockerfile.multi-arch
index 1bf8b8b43d..776548fcb9 100644
--- a/ee/query-service/Dockerfile.multi-arch
+++ b/cmd/enterprise/Dockerfile.multi-arch
@@ -17,4 +17,4 @@ COPY frontend/build/ /etc/signoz/web/
RUN chmod 755 /root /root/signoz
-ENTRYPOINT ["./signoz"]
+ENTRYPOINT ["./signoz", "server"]
diff --git a/cmd/enterprise/main.go b/cmd/enterprise/main.go
new file mode 100644
index 0000000000..e188635734
--- /dev/null
+++ b/cmd/enterprise/main.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+ "log/slog"
+
+ "github.com/SigNoz/signoz/cmd"
+ "github.com/SigNoz/signoz/pkg/instrumentation"
+)
+
+func main() {
+ // initialize logger for logging in the cmd/ package. This logger is different from the logger used in the application.
+ logger := instrumentation.NewLogger(instrumentation.Config{Logs: instrumentation.LogsConfig{Level: slog.LevelInfo}})
+
+ // register a list of commands to the root command
+ registerServer(cmd.RootCmd, logger)
+
+ cmd.Execute(logger)
+}
diff --git a/cmd/enterprise/server.go b/cmd/enterprise/server.go
new file mode 100644
index 0000000000..56344ea8b2
--- /dev/null
+++ b/cmd/enterprise/server.go
@@ -0,0 +1,124 @@
+package main
+
+import (
+ "context"
+ "log/slog"
+ "time"
+
+ "github.com/SigNoz/signoz/cmd"
+ enterpriselicensing "github.com/SigNoz/signoz/ee/licensing"
+ "github.com/SigNoz/signoz/ee/licensing/httplicensing"
+ enterpriseapp "github.com/SigNoz/signoz/ee/query-service/app"
+ "github.com/SigNoz/signoz/ee/sqlschema/postgressqlschema"
+ "github.com/SigNoz/signoz/ee/sqlstore/postgressqlstore"
+ enterprisezeus "github.com/SigNoz/signoz/ee/zeus"
+ "github.com/SigNoz/signoz/ee/zeus/httpzeus"
+ "github.com/SigNoz/signoz/pkg/analytics"
+ "github.com/SigNoz/signoz/pkg/factory"
+ "github.com/SigNoz/signoz/pkg/licensing"
+ "github.com/SigNoz/signoz/pkg/modules/organization"
+ "github.com/SigNoz/signoz/pkg/signoz"
+ "github.com/SigNoz/signoz/pkg/sqlschema"
+ "github.com/SigNoz/signoz/pkg/sqlstore"
+ "github.com/SigNoz/signoz/pkg/sqlstore/sqlstorehook"
+ "github.com/SigNoz/signoz/pkg/types/authtypes"
+ "github.com/SigNoz/signoz/pkg/version"
+ "github.com/SigNoz/signoz/pkg/zeus"
+ "github.com/spf13/cobra"
+)
+
+func registerServer(parentCmd *cobra.Command, logger *slog.Logger) {
+ var flags signoz.DeprecatedFlags
+
+ serverCmd := &cobra.Command{
+ Use: "server",
+ Short: "Run the SigNoz server",
+ FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
+ RunE: func(currCmd *cobra.Command, args []string) error {
+ config, err := cmd.NewSigNozConfig(currCmd.Context(), flags)
+ if err != nil {
+ return err
+ }
+
+ return runServer(currCmd.Context(), config, logger)
+ },
+ }
+
+ flags.RegisterFlags(serverCmd)
+ parentCmd.AddCommand(serverCmd)
+}
+
+func runServer(ctx context.Context, config signoz.Config, logger *slog.Logger) error {
+ // print the version
+ version.Info.PrettyPrint(config.Version)
+
+ // add enterprise sqlstore factories to the community sqlstore factories
+ sqlstoreFactories := signoz.NewSQLStoreProviderFactories()
+ if err := sqlstoreFactories.Add(postgressqlstore.NewFactory(sqlstorehook.NewLoggingFactory())); err != nil {
+ logger.ErrorContext(ctx, "failed to add postgressqlstore factory", "error", err)
+ return err
+ }
+
+ jwt := authtypes.NewJWT(cmd.NewJWTSecret(ctx, logger), 30*time.Minute, 30*24*time.Hour)
+
+ signoz, err := signoz.New(
+ ctx,
+ config,
+ jwt,
+ enterprisezeus.Config(),
+ httpzeus.NewProviderFactory(),
+ enterpriselicensing.Config(24*time.Hour, 3),
+ func(sqlstore sqlstore.SQLStore, zeus zeus.Zeus, orgGetter organization.Getter, analytics analytics.Analytics) factory.ProviderFactory[licensing.Licensing, licensing.Config] {
+ return httplicensing.NewProviderFactory(sqlstore, zeus, orgGetter, analytics)
+ },
+ signoz.NewEmailingProviderFactories(),
+ signoz.NewCacheProviderFactories(),
+ signoz.NewWebProviderFactories(),
+ func(sqlstore sqlstore.SQLStore) factory.NamedMap[factory.ProviderFactory[sqlschema.SQLSchema, sqlschema.Config]] {
+ existingFactories := signoz.NewSQLSchemaProviderFactories(sqlstore)
+ if err := existingFactories.Add(postgressqlschema.NewFactory(sqlstore)); err != nil {
+ panic(err)
+ }
+
+ return existingFactories
+ },
+ sqlstoreFactories,
+ signoz.NewTelemetryStoreProviderFactories(),
+ )
+ if err != nil {
+ logger.ErrorContext(ctx, "failed to create signoz", "error", err)
+ return err
+ }
+
+ server, err := enterpriseapp.NewServer(config, signoz, jwt)
+ if err != nil {
+ logger.ErrorContext(ctx, "failed to create server", "error", err)
+ return err
+ }
+
+ if err := server.Start(ctx); err != nil {
+ logger.ErrorContext(ctx, "failed to start server", "error", err)
+ return err
+ }
+
+ signoz.Start(ctx)
+
+ if err := signoz.Wait(ctx); err != nil {
+ logger.ErrorContext(ctx, "failed to start signoz", "error", err)
+ return err
+ }
+
+ err = server.Stop(ctx)
+ if err != nil {
+ logger.ErrorContext(ctx, "failed to stop server", "error", err)
+ return err
+ }
+
+ err = signoz.Stop(ctx)
+ if err != nil {
+ logger.ErrorContext(ctx, "failed to stop signoz", "error", err)
+ return err
+ }
+
+ return nil
+}
diff --git a/cmd/root.go b/cmd/root.go
new file mode 100644
index 0000000000..a080b37645
--- /dev/null
+++ b/cmd/root.go
@@ -0,0 +1,33 @@
+package cmd
+
+import (
+ "log/slog"
+ "os"
+
+ "github.com/SigNoz/signoz/pkg/version"
+ "github.com/spf13/cobra"
+ "go.uber.org/zap" //nolint:depguard
+)
+
+var RootCmd = &cobra.Command{
+ Use: "signoz",
+ Short: "OpenTelemetry-Native Logs, Metrics and Traces in a single pane",
+ Version: version.Info.Version(),
+ SilenceUsage: true,
+ SilenceErrors: true,
+ CompletionOptions: cobra.CompletionOptions{DisableDefaultCmd: true},
+}
+
+func Execute(logger *slog.Logger) {
+ zapLogger := newZapLogger()
+ zap.ReplaceGlobals(zapLogger)
+ defer func() {
+ _ = zapLogger.Sync()
+ }()
+
+ err := RootCmd.Execute()
+ if err != nil {
+ logger.ErrorContext(RootCmd.Context(), "error running command", "error", err)
+ os.Exit(1)
+ }
+}
diff --git a/cmd/zap.go b/cmd/zap.go
new file mode 100644
index 0000000000..4f043eaf6b
--- /dev/null
+++ b/cmd/zap.go
@@ -0,0 +1,15 @@
+package cmd
+
+import (
+ "go.uber.org/zap" //nolint:depguard
+ "go.uber.org/zap/zapcore" //nolint:depguard
+)
+
+// Deprecated: Use `NewLogger` from `pkg/instrumentation` instead.
+func newZapLogger() *zap.Logger {
+ config := zap.NewProductionConfig()
+ config.EncoderConfig.TimeKey = "timestamp"
+ config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+ logger, _ := config.Build()
+ return logger
+}
diff --git a/ee/query-service/.dockerignore b/ee/query-service/.dockerignore
deleted file mode 100644
index 9521c5060b..0000000000
--- a/ee/query-service/.dockerignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.vscode
-README.md
-signoz.db
-bin
\ No newline at end of file
diff --git a/ee/query-service/main.go b/ee/query-service/main.go
deleted file mode 100644
index c7b6b2d23e..0000000000
--- a/ee/query-service/main.go
+++ /dev/null
@@ -1,189 +0,0 @@
-package main
-
-import (
- "context"
- "flag"
- "os"
- "time"
-
- "github.com/SigNoz/signoz/ee/licensing"
- "github.com/SigNoz/signoz/ee/licensing/httplicensing"
- "github.com/SigNoz/signoz/ee/query-service/app"
- "github.com/SigNoz/signoz/ee/sqlschema/postgressqlschema"
- "github.com/SigNoz/signoz/ee/sqlstore/postgressqlstore"
- "github.com/SigNoz/signoz/ee/zeus"
- "github.com/SigNoz/signoz/ee/zeus/httpzeus"
- "github.com/SigNoz/signoz/pkg/analytics"
- "github.com/SigNoz/signoz/pkg/config"
- "github.com/SigNoz/signoz/pkg/config/envprovider"
- "github.com/SigNoz/signoz/pkg/config/fileprovider"
- "github.com/SigNoz/signoz/pkg/factory"
- pkglicensing "github.com/SigNoz/signoz/pkg/licensing"
- "github.com/SigNoz/signoz/pkg/modules/organization"
- baseconst "github.com/SigNoz/signoz/pkg/query-service/constants"
- "github.com/SigNoz/signoz/pkg/signoz"
- "github.com/SigNoz/signoz/pkg/sqlschema"
- "github.com/SigNoz/signoz/pkg/sqlstore"
- "github.com/SigNoz/signoz/pkg/sqlstore/sqlstorehook"
- "github.com/SigNoz/signoz/pkg/types/authtypes"
- "github.com/SigNoz/signoz/pkg/version"
- pkgzeus "github.com/SigNoz/signoz/pkg/zeus"
-
- "go.uber.org/zap"
- "go.uber.org/zap/zapcore"
-)
-
-// Deprecated: Please use the logger from pkg/instrumentation.
-func initZapLog() *zap.Logger {
- config := zap.NewProductionConfig()
- config.EncoderConfig.TimeKey = "timestamp"
- config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
- logger, _ := config.Build()
- return logger
-}
-
-func main() {
- var promConfigPath, skipTopLvlOpsPath string
-
- // disables rule execution but allows change to the rule definition
- var disableRules bool
-
- // the url used to build link in the alert messages in slack and other systems
- var ruleRepoURL string
- var cluster string
-
- var useLogsNewSchema bool
- var useTraceNewSchema bool
- var cacheConfigPath, fluxInterval, fluxIntervalForTraceDetail string
- var preferSpanMetrics bool
-
- var maxIdleConns int
- var maxOpenConns int
- var dialTimeout time.Duration
- var gatewayUrl string
- var useLicensesV3 bool
-
- // Deprecated
- flag.BoolVar(&useLogsNewSchema, "use-logs-new-schema", false, "use logs_v2 schema for logs")
- // Deprecated
- flag.BoolVar(&useTraceNewSchema, "use-trace-new-schema", false, "use new schema for traces")
- // Deprecated
- flag.StringVar(&promConfigPath, "config", "./config/prometheus.yml", "(prometheus config to read metrics)")
- // Deprecated
- flag.StringVar(&skipTopLvlOpsPath, "skip-top-level-ops", "", "(config file to skip top level operations)")
- // Deprecated
- flag.BoolVar(&disableRules, "rules.disable", false, "(disable rule evaluation)")
- flag.BoolVar(&preferSpanMetrics, "prefer-span-metrics", false, "(prefer span metrics for service level metrics)")
- // Deprecated
- flag.IntVar(&maxIdleConns, "max-idle-conns", 50, "(number of connections to maintain in the pool.)")
- // Deprecated
- flag.IntVar(&maxOpenConns, "max-open-conns", 100, "(max connections for use at any time.)")
- // Deprecated
- flag.DurationVar(&dialTimeout, "dial-timeout", 5*time.Second, "(the maximum time to establish a connection.)")
- // Deprecated
- flag.StringVar(&ruleRepoURL, "rules.repo-url", baseconst.AlertHelpPage, "(host address used to build rule link in alert messages)")
- // Deprecated
- flag.StringVar(&cacheConfigPath, "experimental.cache-config", "", "(cache config to use)")
- flag.StringVar(&fluxInterval, "flux-interval", "5m", "(the interval to exclude data from being cached to avoid incorrect cache for data in motion)")
- flag.StringVar(&fluxIntervalForTraceDetail, "flux-interval-trace-detail", "2m", "(the interval to exclude data from being cached to avoid incorrect cache for trace data in motion)")
- flag.StringVar(&cluster, "cluster", "cluster", "(cluster name - defaults to 'cluster')")
- flag.StringVar(&gatewayUrl, "gateway-url", "", "(url to the gateway)")
- // Deprecated
- flag.BoolVar(&useLicensesV3, "use-licenses-v3", false, "use licenses_v3 schema for licenses")
- flag.Parse()
-
- loggerMgr := initZapLog()
- zap.ReplaceGlobals(loggerMgr)
- defer loggerMgr.Sync() // flushes buffer, if any
- ctx := context.Background()
-
- config, err := signoz.NewConfig(ctx, config.ResolverConfig{
- Uris: []string{"env:"},
- ProviderFactories: []config.ProviderFactory{
- envprovider.NewFactory(),
- fileprovider.NewFactory(),
- },
- }, signoz.DeprecatedFlags{
- MaxIdleConns: maxIdleConns,
- MaxOpenConns: maxOpenConns,
- DialTimeout: dialTimeout,
- Config: promConfigPath,
- FluxInterval: fluxInterval,
- FluxIntervalForTraceDetail: fluxIntervalForTraceDetail,
- Cluster: cluster,
- GatewayUrl: gatewayUrl,
- })
- if err != nil {
- zap.L().Fatal("Failed to create config", zap.Error(err))
- }
-
- version.Info.PrettyPrint(config.Version)
-
- sqlStoreFactories := signoz.NewSQLStoreProviderFactories()
- if err := sqlStoreFactories.Add(postgressqlstore.NewFactory(sqlstorehook.NewLoggingFactory())); err != nil {
- zap.L().Fatal("Failed to add postgressqlstore factory", zap.Error(err))
- }
-
- jwtSecret := os.Getenv("SIGNOZ_JWT_SECRET")
-
- if len(jwtSecret) == 0 {
- zap.L().Warn("No JWT secret key is specified.")
- } else {
- zap.L().Info("JWT secret key set successfully.")
- }
-
- jwt := authtypes.NewJWT(jwtSecret, 30*time.Minute, 30*24*time.Hour)
-
- signoz, err := signoz.New(
- context.Background(),
- config,
- jwt,
- zeus.Config(),
- httpzeus.NewProviderFactory(),
- licensing.Config(24*time.Hour, 3),
- func(sqlstore sqlstore.SQLStore, zeus pkgzeus.Zeus, orgGetter organization.Getter, analytics analytics.Analytics) factory.ProviderFactory[pkglicensing.Licensing, pkglicensing.Config] {
- return httplicensing.NewProviderFactory(sqlstore, zeus, orgGetter, analytics)
- },
- signoz.NewEmailingProviderFactories(),
- signoz.NewCacheProviderFactories(),
- signoz.NewWebProviderFactories(),
- func(sqlstore sqlstore.SQLStore) factory.NamedMap[factory.ProviderFactory[sqlschema.SQLSchema, sqlschema.Config]] {
- existingFactories := signoz.NewSQLSchemaProviderFactories(sqlstore)
- if err := existingFactories.Add(postgressqlschema.NewFactory(sqlstore)); err != nil {
- zap.L().Fatal("Failed to add postgressqlschema factory", zap.Error(err))
- }
-
- return existingFactories
- },
- sqlStoreFactories,
- signoz.NewTelemetryStoreProviderFactories(),
- )
- if err != nil {
- zap.L().Fatal("Failed to create signoz", zap.Error(err))
- }
-
- server, err := app.NewServer(config, signoz, jwt)
- if err != nil {
- zap.L().Fatal("Failed to create server", zap.Error(err))
- }
-
- if err := server.Start(ctx); err != nil {
- zap.L().Fatal("Could not start server", zap.Error(err))
- }
-
- signoz.Start(ctx)
-
- if err := signoz.Wait(ctx); err != nil {
- zap.L().Fatal("Failed to start signoz", zap.Error(err))
- }
-
- err = server.Stop(ctx)
- if err != nil {
- zap.L().Fatal("Failed to stop server", zap.Error(err))
- }
-
- err = signoz.Stop(ctx)
- if err != nil {
- zap.L().Fatal("Failed to stop signoz", zap.Error(err))
- }
-}
diff --git a/go.mod b/go.mod
index d3a75ad615..672d210c90 100644
--- a/go.mod
+++ b/go.mod
@@ -50,6 +50,7 @@ require (
github.com/sethvargo/go-password v0.2.0
github.com/smartystreets/goconvey v1.8.1
github.com/soheilhy/cmux v0.1.5
+ github.com/spf13/cobra v1.9.1
github.com/srikanthccv/ClickHouse-go-mock v0.12.0
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.18.0
@@ -206,7 +207,6 @@ require (
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92 // indirect
github.com/smarty/assertions v1.15.0 // indirect
- github.com/spf13/cobra v1.9.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/tidwall/match v1.1.1 // indirect
diff --git a/pkg/query-service/.dockerignore b/pkg/query-service/.dockerignore
deleted file mode 100644
index 01d98e1bd8..0000000000
--- a/pkg/query-service/.dockerignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.vscode
-README.md
-signoz.db
\ No newline at end of file
diff --git a/pkg/query-service/main.go b/pkg/query-service/main.go
deleted file mode 100644
index 90cad098a8..0000000000
--- a/pkg/query-service/main.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package main
-
-import (
- "context"
- "flag"
- "os"
- "time"
-
- "github.com/SigNoz/signoz/pkg/analytics"
- "github.com/SigNoz/signoz/pkg/config"
- "github.com/SigNoz/signoz/pkg/config/envprovider"
- "github.com/SigNoz/signoz/pkg/config/fileprovider"
- "github.com/SigNoz/signoz/pkg/factory"
- "github.com/SigNoz/signoz/pkg/licensing"
- "github.com/SigNoz/signoz/pkg/licensing/nooplicensing"
- "github.com/SigNoz/signoz/pkg/modules/organization"
- "github.com/SigNoz/signoz/pkg/query-service/app"
- "github.com/SigNoz/signoz/pkg/query-service/constants"
- "github.com/SigNoz/signoz/pkg/signoz"
- "github.com/SigNoz/signoz/pkg/sqlschema"
- "github.com/SigNoz/signoz/pkg/sqlstore"
- "github.com/SigNoz/signoz/pkg/types/authtypes"
- "github.com/SigNoz/signoz/pkg/version"
- "github.com/SigNoz/signoz/pkg/zeus"
- "github.com/SigNoz/signoz/pkg/zeus/noopzeus"
-
- "go.uber.org/zap"
- "go.uber.org/zap/zapcore"
-)
-
-func initZapLog() *zap.Logger {
- config := zap.NewProductionConfig()
- config.EncoderConfig.TimeKey = "timestamp"
- config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
- logger, _ := config.Build()
- return logger
-}
-
-func main() {
- var promConfigPath, skipTopLvlOpsPath string
-
- // disables rule execution but allows change to the rule definition
- var disableRules bool
-
- var useLogsNewSchema bool
- var useTraceNewSchema bool
- // the url used to build link in the alert messages in slack and other systems
- var ruleRepoURL, cacheConfigPath, fluxInterval, fluxIntervalForTraceDetail string
- var cluster string
-
- var preferSpanMetrics bool
-
- var maxIdleConns int
- var maxOpenConns int
- var dialTimeout time.Duration
-
- // Deprecated
- flag.BoolVar(&useLogsNewSchema, "use-logs-new-schema", false, "use logs_v2 schema for logs")
- // Deprecated
- flag.BoolVar(&useTraceNewSchema, "use-trace-new-schema", false, "use new schema for traces")
- // Deprecated
- flag.StringVar(&promConfigPath, "config", "./config/prometheus.yml", "(prometheus config to read metrics)")
- // Deprecated
- flag.StringVar(&skipTopLvlOpsPath, "skip-top-level-ops", "", "(config file to skip top level operations)")
- // Deprecated
- flag.BoolVar(&disableRules, "rules.disable", false, "(disable rule evaluation)")
- // Deprecated
- flag.BoolVar(&preferSpanMetrics, "prefer-span-metrics", false, "(prefer span metrics for service level metrics)")
- // Deprecated
- flag.StringVar(&ruleRepoURL, "rules.repo-url", constants.AlertHelpPage, "(host address used to build rule link in alert messages)")
- // Deprecated
- flag.StringVar(&cacheConfigPath, "experimental.cache-config", "", "(cache config to use)")
- // Deprecated
- flag.StringVar(&fluxInterval, "flux-interval", "5m", "(the interval to exclude data from being cached to avoid incorrect cache for data in motion)")
- // Deprecated
- flag.StringVar(&fluxIntervalForTraceDetail, "flux-interval-trace-detail", "2m", "(the interval to exclude data from being cached to avoid incorrect cache for trace data in motion)")
- // Deprecated
- flag.StringVar(&cluster, "cluster", "cluster", "(cluster name - defaults to 'cluster')")
- // Deprecated
- flag.StringVar(&cluster, "cluster-name", "cluster", "(cluster name - defaults to 'cluster')")
- // Deprecated
- flag.IntVar(&maxIdleConns, "max-idle-conns", 50, "(number of connections to maintain in the pool, only used with clickhouse if not set in ClickHouseUrl env var DSN.)")
- // Deprecated
- flag.IntVar(&maxOpenConns, "max-open-conns", 100, "(max connections for use at any time, only used with clickhouse if not set in ClickHouseUrl env var DSN.)")
- // Deprecated
- flag.DurationVar(&dialTimeout, "dial-timeout", 5*time.Second, "(the maximum time to establish a connection, only used with clickhouse if not set in ClickHouseUrl env var DSN.)")
- flag.Parse()
-
- loggerMgr := initZapLog()
- zap.ReplaceGlobals(loggerMgr)
- defer loggerMgr.Sync() // flushes buffer, if any
-
- logger := loggerMgr.Sugar()
-
- config, err := signoz.NewConfig(context.Background(), config.ResolverConfig{
- Uris: []string{"env:"},
- ProviderFactories: []config.ProviderFactory{
- envprovider.NewFactory(),
- fileprovider.NewFactory(),
- },
- }, signoz.DeprecatedFlags{
- MaxIdleConns: maxIdleConns,
- MaxOpenConns: maxOpenConns,
- DialTimeout: dialTimeout,
- Config: promConfigPath,
- FluxInterval: fluxInterval,
- FluxIntervalForTraceDetail: fluxIntervalForTraceDetail,
- PreferSpanMetrics: preferSpanMetrics,
- Cluster: cluster,
- })
- if err != nil {
- zap.L().Fatal("Failed to create config", zap.Error(err))
- }
-
- version.Info.PrettyPrint(config.Version)
-
- // Read the jwt secret key
- jwtSecret := os.Getenv("SIGNOZ_JWT_SECRET")
-
- if len(jwtSecret) == 0 {
- zap.L().Warn("No JWT secret key is specified.")
- } else {
- zap.L().Info("JWT secret key set successfully.")
- }
-
- jwt := authtypes.NewJWT(jwtSecret, 30*time.Minute, 30*24*time.Hour)
-
- signoz, err := signoz.New(
- context.Background(),
- config,
- jwt,
- zeus.Config{},
- noopzeus.NewProviderFactory(),
- licensing.Config{},
- func(_ sqlstore.SQLStore, _ zeus.Zeus, _ organization.Getter, _ analytics.Analytics) factory.ProviderFactory[licensing.Licensing, licensing.Config] {
- return nooplicensing.NewFactory()
- },
- signoz.NewEmailingProviderFactories(),
- signoz.NewCacheProviderFactories(),
- signoz.NewWebProviderFactories(),
- func(sqlstore sqlstore.SQLStore) factory.NamedMap[factory.ProviderFactory[sqlschema.SQLSchema, sqlschema.Config]] {
- return signoz.NewSQLSchemaProviderFactories(sqlstore)
- },
- signoz.NewSQLStoreProviderFactories(),
- signoz.NewTelemetryStoreProviderFactories(),
- )
- if err != nil {
- zap.L().Fatal("Failed to create signoz", zap.Error(err))
- }
-
- server, err := app.NewServer(config, signoz, jwt)
- if err != nil {
- logger.Fatal("Failed to create server", zap.Error(err))
- }
-
- if err := server.Start(context.Background()); err != nil {
- logger.Fatal("Could not start servers", zap.Error(err))
- }
-
- signoz.Start(context.Background())
-
- if err := signoz.Wait(context.Background()); err != nil {
- zap.L().Fatal("Failed to start signoz", zap.Error(err))
- }
-
- err = server.Stop(context.Background())
- if err != nil {
- zap.L().Fatal("Failed to stop server", zap.Error(err))
- }
-
- err = signoz.Stop(context.Background())
- if err != nil {
- zap.L().Fatal("Failed to stop signoz", zap.Error(err))
- }
-
-}
diff --git a/pkg/signoz/config.go b/pkg/signoz/config.go
index 63222c5ef4..5eda9f98b0 100644
--- a/pkg/signoz/config.go
+++ b/pkg/signoz/config.go
@@ -30,6 +30,7 @@ import (
"github.com/SigNoz/signoz/pkg/telemetrystore"
"github.com/SigNoz/signoz/pkg/version"
"github.com/SigNoz/signoz/pkg/web"
+ "github.com/spf13/cobra"
)
// Config defines the entire input configuration of signoz.
@@ -106,6 +107,28 @@ type DeprecatedFlags struct {
GatewayUrl string
}
+func (df *DeprecatedFlags) RegisterFlags(cmd *cobra.Command) {
+ cmd.Flags().IntVar(&df.MaxIdleConns, "max-idle-conns", 50, "max idle connections to the database")
+ cmd.Flags().IntVar(&df.MaxOpenConns, "max-open-conns", 100, "max open connections to the database")
+ cmd.Flags().DurationVar(&df.DialTimeout, "dial-timeout", 5*time.Second, "dial timeout for the database")
+ cmd.Flags().StringVar(&df.Config, "config", "./config/prometheus.yml", "(prometheus config to read metrics)")
+ cmd.Flags().StringVar(&df.FluxInterval, "flux-interval", "5m", "flux interval")
+ cmd.Flags().StringVar(&df.FluxIntervalForTraceDetail, "flux-interval-for-trace-detail", "2m", "flux interval for trace detail")
+ cmd.Flags().BoolVar(&df.PreferSpanMetrics, "prefer-span-metrics", false, "(prefer span metrics for service level metrics)")
+ cmd.Flags().StringVar(&df.Cluster, "cluster", "cluster", "(cluster name - defaults to 'cluster')")
+ cmd.Flags().StringVar(&df.GatewayUrl, "gateway-url", "", "(url to the gateway)")
+
+ _ = cmd.Flags().MarkDeprecated("max-idle-conns", "use SIGNOZ_TELEMETRYSTORE_MAX__IDLE__CONNS instead")
+ _ = cmd.Flags().MarkDeprecated("max-open-conns", "use SIGNOZ_TELEMETRYSTORE_MAX__OPEN__CONNS instead")
+ _ = cmd.Flags().MarkDeprecated("dial-timeout", "use SIGNOZ_TELEMETRYSTORE_DIAL__TIMEOUT instead")
+ _ = cmd.Flags().MarkDeprecated("config", "use SIGNOZ_PROMETHEUS_CONFIG instead")
+ _ = cmd.Flags().MarkDeprecated("flux-interval", "use SIGNOZ_QUERIER_FLUX__INTERVAL instead")
+ _ = cmd.Flags().MarkDeprecated("flux-interval-for-trace-detail", "use SIGNOZ_QUERIER_FLUX__INTERVAL instead")
+ _ = cmd.Flags().MarkDeprecated("cluster", "use SIGNOZ_TELEMETRYSTORE_CLICKHOUSE_CLUSTER instead")
+ _ = cmd.Flags().MarkDeprecated("prefer-span-metrics", "use USE_SPAN_METRICS instead")
+ _ = cmd.Flags().MarkDeprecated("gateway-url", "use SIGNOZ_GATEWAY_URL instead")
+}
+
func NewConfig(ctx context.Context, resolverConfig config.ResolverConfig, deprecatedFlags DeprecatedFlags) (Config, error) {
configFactories := []factory.ConfigFactory{
version.NewConfigFactory(),
diff --git a/tests/integration/fixtures/signoz.py b/tests/integration/fixtures/signoz.py
index e5b02e8581..393122c866 100644
--- a/tests/integration/fixtures/signoz.py
+++ b/tests/integration/fixtures/signoz.py
@@ -53,7 +53,7 @@ def signoz(
# Build the image
self = DockerImage(
path="../../",
- dockerfile_path="ee/query-service/Dockerfile.integration",
+ dockerfile_path="cmd/enterprise/Dockerfile.integration",
tag="signoz:integration",
)