feat(query-service): integrate pprof

Signed-off-by: Prashant Shahi <prashant@signoz.io>
This commit is contained in:
Prashant Shahi 2022-03-28 21:44:40 +05:30
parent 0efb901863
commit 31443dabe7
No known key found for this signature in database
GPG Key ID: 6E62ED14180EB2C0
5 changed files with 22 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}
}

View File

@ -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),