Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
key-storage-agent
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Code
key-storage-agent
Commits
ace8dace
Commit
ace8dace
authored
5 years ago
by
Gospodin Bodurov
Browse files
Options
Downloads
Patches
Plain Diff
Start prometheus
parent
f4cefc5b
No related branches found
No related tags found
1 merge request
!62
Prometheus integration
Pipeline
#27272
failed with stages
in 3 minutes and 22 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.go
+7
-0
7 additions, 0 deletions
main.go
server/server.go
+17
-0
17 additions, 0 deletions
server/server.go
with
24 additions
and
0 deletions
main.go
+
7
−
0
View file @
ace8dace
...
@@ -70,6 +70,13 @@ func main() {
...
@@ -70,6 +70,13 @@ func main() {
}
}
}()
}()
go
func
()
{
err
:=
server
.
StartPrometheusServer
()
if
err
!=
nil
{
log
.
Printf
(
"failed to start prometheus server: %v"
,
err
)
}
}()
// infinite loop
// infinite loop
log
.
Printf
(
"Entering infinite loop"
)
log
.
Printf
(
"Entering infinite loop"
)
select
{}
select
{}
...
...
This diff is collapsed.
Click to expand it.
server/server.go
+
17
−
0
View file @
ace8dace
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"sync"
"sync"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"code.vereign.com/code/viam-apis/errors"
"code.vereign.com/code/viam-apis/errors"
...
@@ -258,3 +259,19 @@ func StartRESTServer(address, grpcAddress string, certPEM []byte) error {
...
@@ -258,3 +259,19 @@ func StartRESTServer(address, grpcAddress string, certPEM []byte) error {
return
nil
return
nil
}
}
func
StartPrometheusServer
()
error
{
if
config
.
PrometeusListenAddress
!=
""
{
// start prometheus
promHandler
:=
http
.
NewServeMux
()
promHandler
.
Handle
(
"/metrics"
,
promhttp
.
Handler
())
log
.
Println
(
"Starting prometheus..."
)
err
:=
http
.
ListenAndServe
(
config
.
PrometeusListenAddress
,
promHandler
)
if
err
!=
nil
{
return
err
}
}
return
nil
}
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