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(query-service): ✨ integrate pprof

Prashant Shahi31443dabe715
diff --git a/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml b/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml
index 425dbde5a3..9a9ca48204 100644
--- a/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml
+++ b/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml
@@ -31,8 +31,9 @@ services:
query-service:
image: signoz/query-service:0.7.3
command: ["-config=/root/config/prometheus.yml"]
- ports:
- - "8080:8080"
+ # ports:
+ # - "6060:6060" # pprof port
+ # - "8080:8080" # query-service port
volumes:
- ./prometheus.yml:/root/config/prometheus.yml
- ../dashboards:/root/config/dashboards
@@ -68,7 +69,7 @@ services:
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
# - "8889:8889" # Prometheus metrics exposed by the agent
- # - "13133" # health_check
+ # - "13133:13133" # health_check
# - "14268:14268" # Jaeger receiver
# - "55678:55678" # OpenCensus receiver
# - "55679:55679" # zpages extension
diff --git a/deploy/docker/clickhouse-setup/docker-compose.arm.yaml b/deploy/docker/clickhouse-setup/docker-compose.arm.yaml
index 2d5a638fd9..35c7e8d096 100644
--- a/deploy/docker/clickhouse-setup/docker-compose.arm.yaml
+++ b/deploy/docker/clickhouse-setup/docker-compose.arm.yaml
@@ -27,6 +27,9 @@ services:
image: signoz/query-service:0.7.3
container_name: query-service
command: ["-config=/root/config/prometheus.yml"]
+ # ports:
+ # - "6060:6060" # pprof port
+ # - "8080:8080" # query-service port
volumes:
- ./prometheus.yml:/root/config/prometheus.yml
- ../dashboards:/root/config/dashboards
@@ -62,7 +65,7 @@ services:
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
# - "8889:8889" # Prometheus metrics exposed by the agent
- # - "13133" # health_check
+ # - "13133:13133" # health_check
# - "14268:14268" # Jaeger receiver
# - "55678:55678" # OpenCensus receiver
# - "55679:55679" # zpages extension
diff --git a/deploy/docker/clickhouse-setup/docker-compose.yaml b/deploy/docker/clickhouse-setup/docker-compose.yaml
index c161d1c4d4..c12aacafe1 100644
--- a/deploy/docker/clickhouse-setup/docker-compose.yaml
+++ b/deploy/docker/clickhouse-setup/docker-compose.yaml
@@ -33,6 +33,9 @@ services:
image: signoz/query-service:0.7.3
container_name: query-service
command: ["-config=/root/config/prometheus.yml"]
+ # ports:
+ # - "6060:6060" # pprof port
+ # - "8080:8080" # query-service port
volumes:
- ./prometheus.yml:/root/config/prometheus.yml
- ../dashboards:/root/config/dashboards
@@ -68,7 +71,7 @@ services:
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
# - "8889:8889" # Prometheus metrics exposed by the agent
- # - "13133" # health_check
+ # - "13133:13133" # health_check
# - "14268:14268" # Jaeger receiver
# - "55678:55678" # OpenCensus receiver
# - "55679:55679" # zpages extension
diff --git a/pkg/query-service/constants/constants.go b/pkg/query-service/constants/constants.go
index 6937d1709b..7ff13a0163 100644
--- a/pkg/query-service/constants/constants.go
+++ b/pkg/query-service/constants/constants.go
@@ -5,7 +5,8 @@ import (
"strconv"
)
-const HTTPHostPort = "0.0.0.0:8080"
+const HTTPHostPort = "0.0.0.0:8080" // Address to serve http (query service)
+const DebugHttpPort = "0.0.0.0:6060" // Address to serve http (pprof)
var DruidClientUrl = os.Getenv("DruidClientUrl")
var DruidDatasource = os.Getenv("DruidDatasource")
@@ -30,7 +31,7 @@ func GetAlertManagerApiPrefix() string {
return "http://alertmanager:9093/api/"
}
-// Alert manager channel subpath
+// Alert manager channel subpath
var AmChannelApiPath = GetOrDefaultEnv("ALERTMANAGER_API_CHANNEL_PATH", "v1/routes")
var RELATIONAL_DATASOURCE_PATH = GetOrDefaultEnv("SIGNOZ_LOCAL_DB_PATH", "/var/lib/signoz/signoz.db")
@@ -47,11 +48,10 @@ const (
OperationRequest = "operation"
)
-
func GetOrDefaultEnv(key string, fallback string) string {
v := os.Getenv(key)
if len(v) == 0 {
return fallback
}
return v
-}
\ No newline at end of file
+}
diff --git a/pkg/query-service/main.go b/pkg/query-service/main.go
index 3418154d79..d9b68b755c 100644
--- a/pkg/query-service/main.go
+++ b/pkg/query-service/main.go
@@ -1,6 +1,8 @@
package main
import (
+ "net/http"
+ _ "net/http/pprof" // http profiler
"os"
"os/signal"
"syscall"
@@ -34,6 +36,10 @@ func main() {
logger := loggerMgr.Sugar()
version.PrintVersion()
+ go func() {
+ logger.Info(http.ListenAndServe(constants.DebugHttpPort, nil))
+ }()
+
serverOptions := &app.ServerOptions{
// HTTPHostPort: v.GetString(app.HTTPHostPort),
// DruidClientUrl: v.GetString(app.DruidClientUrl),