Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add host ports as config flags #6726

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pkg/query-service/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ type ServerOptions struct {
SkipTopLvlOpsPath string
HTTPHostPort string
PrivateHostPort string
DebugHostPort string
OpAmpWsEndpoint string
// alert specific params
DisableRules bool
RuleRepoURL string
Expand Down Expand Up @@ -656,9 +658,9 @@ func (s *Server) Start() error {
}()

go func() {
zap.L().Info("Starting pprof server", zap.String("addr", constants.DebugHttpPort))
zap.L().Info("Starting pprof server", zap.String("addr", s.serverOptions.DebugHostPort))

err = http.ListenAndServe(constants.DebugHttpPort, nil)
err = http.ListenAndServe(s.serverOptions.DebugHostPort, nil)
if err != nil {
zap.L().Error("Could not start pprof server", zap.Error(err))
}
Expand All @@ -685,8 +687,8 @@ func (s *Server) Start() error {
}()

go func() {
zap.L().Info("Starting OpAmp Websocket server", zap.String("addr", constants.OpAmpWsEndpoint))
err := s.opampServer.Start(constants.OpAmpWsEndpoint)
zap.L().Info("Starting OpAmp Websocket server", zap.String("addr", s.serverOptions.OpAmpWsEndpoint))
err := s.opampServer.Start(s.serverOptions.OpAmpWsEndpoint)
if err != nil {
zap.L().Info("opamp ws server failed to start", zap.Error(err))
s.unavailableChannel <- healthcheck.Unavailable
Expand Down
16 changes: 14 additions & 2 deletions pkg/query-service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ func main() {
var maxOpenConns int
var dialTimeout time.Duration

var httpHostPort string
var privateHostPort string
var debugHostPort string
var opAmpWsEndpoint string

flag.BoolVar(&useLogsNewSchema, "use-logs-new-schema", false, "use logs_v2 schema for logs")
flag.BoolVar(&useTraceNewSchema, "use-trace-new-schema", false, "use new schema for traces")
flag.StringVar(&promConfigPath, "config", "./config/prometheus.yml", "(prometheus config to read metrics)")
Expand All @@ -65,6 +70,11 @@ func main() {
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.)")
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.)")
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.)")
// Host ports
flag.StringVar(&httpHostPort, "http-host-port", constants.HTTPHostPort, "Address to listen on for HTTP requests")
flag.StringVar(&privateHostPort, "private-host-port", constants.PrivateHostPort, "Address to listen on for private HTTP requests")
flag.StringVar(&debugHostPort, "debug-host-port", constants.DebugHttpPort, "Address to listen on for debug HTTP requests")
flag.StringVar(&opAmpWsEndpoint, "opamp-ws-endpoint", constants.OpAmpWsEndpoint, "Address to listen on for OpAmp WS requests")
flag.Parse()

loggerMgr := initZapLog()
Expand All @@ -75,11 +85,13 @@ func main() {
version.PrintVersion()

serverOptions := &app.ServerOptions{
HTTPHostPort: constants.HTTPHostPort,
HTTPHostPort: httpHostPort,
PrivateHostPort: privateHostPort,
DebugHostPort: debugHostPort,
OpAmpWsEndpoint: opAmpWsEndpoint,
PromConfigPath: promConfigPath,
SkipTopLvlOpsPath: skipTopLvlOpsPath,
PreferSpanMetrics: preferSpanMetrics,
PrivateHostPort: constants.PrivateHostPort,
DisableRules: disableRules,
RuleRepoURL: ruleRepoURL,
MaxIdleConns: maxIdleConns,
Expand Down