Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab-runner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Seipel
gitlab-runner
Commits
d057c11d
Commit
d057c11d
authored
8 years ago
by
Jan Christophersen
Browse files
Options
Downloads
Patches
Plain Diff
Use 9252 as default port for metrics server
parent
3d2d0cc2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
commands/config.go
+18
-5
18 additions, 5 deletions
commands/config.go
commands/multi.go
+10
-3
10 additions, 3 deletions
commands/multi.go
common/consts.go
+1
-0
1 addition, 0 deletions
common/consts.go
with
29 additions
and
8 deletions
commands/config.go
+
18
−
5
View file @
d057c11d
...
@@ -2,10 +2,13 @@ package commands
...
@@ -2,10 +2,13 @@ package commands
import
(
import
(
"fmt"
"fmt"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/common"
"net"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/network"
"os"
"os"
"path/filepath"
"path/filepath"
"strings"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/common"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/network"
)
)
func
getDefaultConfigFile
()
string
{
func
getDefaultConfigFile
()
string
{
...
@@ -70,12 +73,22 @@ type configOptionsWithMetricsServer struct {
...
@@ -70,12 +73,22 @@ type configOptionsWithMetricsServer struct {
MetricsServerAddress
string
`long:"metrics-server" env:"METRICS_SERVER" description:"Metrics server listening address"`
MetricsServerAddress
string
`long:"metrics-server" env:"METRICS_SERVER" description:"Metrics server listening address"`
}
}
func
(
c
*
configOptionsWithMetricsServer
)
metricsServerAddress
()
string
{
func
(
c
*
configOptionsWithMetricsServer
)
metricsServerAddress
()
(
string
,
error
)
{
address
:=
c
.
config
.
MetricsServerAddress
if
c
.
MetricsServerAddress
!=
""
{
if
c
.
MetricsServerAddress
!=
""
{
return
c
.
MetricsServerAddress
address
=
c
.
MetricsServerAddress
}
_
,
port
,
err
:=
net
.
SplitHostPort
(
address
)
if
err
!=
nil
&&
!
strings
.
Contains
(
err
.
Error
(),
"missing port in address"
)
{
return
address
,
err
}
}
return
c
.
config
.
MetricsServerAddress
if
len
(
port
)
==
0
{
return
fmt
.
Sprintf
(
"%s:%d"
,
address
,
common
.
DefaultMetricsServerPort
),
nil
}
return
c
.
config
.
MetricsServerAddress
,
nil
}
}
func
init
()
{
func
init
()
{
...
...
This diff is collapsed.
Click to expand it.
commands/multi.go
+
10
−
3
View file @
d057c11d
...
@@ -370,14 +370,21 @@ func (mr *RunCommand) serveDebugData() {
...
@@ -370,14 +370,21 @@ func (mr *RunCommand) serveDebugData() {
}
}
func
(
mr
*
RunCommand
)
setupMetricsAndDebugServer
()
{
func
(
mr
*
RunCommand
)
setupMetricsAndDebugServer
()
{
if
mr
.
metricsServerAddress
()
==
""
{
serverAddress
,
err
:=
mr
.
metricsServerAddress
()
if
err
!=
nil
{
mr
.
log
()
.
Errorf
(
"invalid metrics server address: %s"
,
err
.
Error
())
return
}
if
serverAddress
==
""
{
log
.
Infoln
(
"Metrics server disabled"
)
log
.
Infoln
(
"Metrics server disabled"
)
return
return
}
}
// We separate out the listener creation here so that we can return an error if
// We separate out the listener creation here so that we can return an error if
// the provided address is invalid or there is some other listener error.
// the provided address is invalid or there is some other listener error.
listener
,
err
:=
net
.
Listen
(
"tcp"
,
mr
.
metricsS
erverAddress
()
)
listener
,
err
:=
net
.
Listen
(
"tcp"
,
s
erverAddress
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatalln
(
err
)
log
.
Fatalln
(
err
)
}
}
...
@@ -389,7 +396,7 @@ func (mr *RunCommand) setupMetricsAndDebugServer() {
...
@@ -389,7 +396,7 @@ func (mr *RunCommand) setupMetricsAndDebugServer() {
mr
.
serveMetrics
()
mr
.
serveMetrics
()
mr
.
serveDebugData
()
mr
.
serveDebugData
()
log
.
Infoln
(
"Metrics server listening at"
,
mr
.
metricsS
erverAddress
()
)
log
.
Infoln
(
"Metrics server listening at"
,
s
erverAddress
)
}
}
func
(
mr
*
RunCommand
)
Run
()
{
func
(
mr
*
RunCommand
)
Run
()
{
...
...
This diff is collapsed.
Click to expand it.
common/consts.go
+
1
−
0
View file @
d057c11d
...
@@ -22,5 +22,6 @@ const DefaultRestoreCacheAttempts = 1
...
@@ -22,5 +22,6 @@ const DefaultRestoreCacheAttempts = 1
const
KubernetesPollInterval
=
3
const
KubernetesPollInterval
=
3
const
KubernetesPollTimeout
=
180
const
KubernetesPollTimeout
=
180
const
AfterScriptTimeout
=
5
*
time
.
Minute
const
AfterScriptTimeout
=
5
*
time
.
Minute
const
DefaultMetricsServerPort
=
9252
var
PreparationRetryInterval
=
3
*
time
.
Second
var
PreparationRetryInterval
=
3
*
time
.
Second
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment