Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
0f68bba9
Unverified
Commit
0f68bba9
authored
Jan 06, 2022
by
Ben Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-exporter version metric
parent
a21cec6d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
7 deletions
+20
-7
Makefile
go/op-exporter/Makefile
+7
-3
collector.go
go/op-exporter/collector.go
+8
-0
main.go
go/op-exporter/main.go
+4
-2
version.go
go/op-exporter/version/version.go
+1
-2
No files found.
go/op-exporter/Makefile
View file @
0f68bba9
SHELL
:=
/bin/bash
SHELL
:=
/bin/bash
VERSION
:=
`
git describe
--abbrev
=
0
`
ifndef
VERSION
VERSION
:=
`
jq .version package.json
`
endif
ifndef
GITCOMMIT
GITCOMMIT
:=
`
git rev-parse HEAD
`
GITCOMMIT
:=
`
git rev-parse HEAD
`
endif
ifndef
BUILDDATE
BUILDDATE
:=
`
date
+%Y-%m-%d
`
BUILDDATE
:=
`
date
+%Y-%m-%d
`
BUILDUSER
:=
`
whoami
`
endif
LDFLAGSSTRING
:=
-X
github.com/ethereum-optimism/optimism/go/op_exporter/version.Version
=
$(VERSION)
LDFLAGSSTRING
:=
-X
github.com/ethereum-optimism/optimism/go/op_exporter/version.Version
=
$(VERSION)
LDFLAGSSTRING
+=
-X
github.com/ethereum-optimism/optimism/go/op_exporter/version.GitCommit
=
$(GITCOMMIT)
LDFLAGSSTRING
+=
-X
github.com/ethereum-optimism/optimism/go/op_exporter/version.GitCommit
=
$(GITCOMMIT)
LDFLAGSSTRING
+=
-X
github.com/ethereum-optimism/optimism/go/op_exporter/version.BuildDate
=
$(BUILDDATE)
LDFLAGSSTRING
+=
-X
github.com/ethereum-optimism/optimism/go/op_exporter/version.BuildDate
=
$(BUILDDATE)
LDFLAGSSTRING
+=
-X
github.com/ethereum-optimism/optimism/go/op_exporter/version.BuildUser
=
$(BUILDUSER)
LDFLAGS
:=
-ldflags
"
$(LDFLAGSSTRING)
"
LDFLAGS
:=
-ldflags
"
$(LDFLAGSSTRING)
"
...
...
go/op-exporter/collector.go
View file @
0f68bba9
...
@@ -24,6 +24,12 @@ var (
...
@@ -24,6 +24,12 @@ var (
Help
:
"Is the sequencer healthy?"
},
Help
:
"Is the sequencer healthy?"
},
[]
string
{
"network"
},
[]
string
{
"network"
},
)
)
opExporterVersion
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Name
:
"op_exporter_version"
,
Help
:
"Verion of the op-exporter software"
},
[]
string
{
"version"
,
"commit"
,
"goVersion"
,
"buildDate"
},
)
)
)
func
init
()
{
func
init
()
{
...
@@ -31,4 +37,6 @@ func init() {
...
@@ -31,4 +37,6 @@ func init() {
prometheus
.
MustRegister
(
gasPrice
)
prometheus
.
MustRegister
(
gasPrice
)
prometheus
.
MustRegister
(
blockNumber
)
prometheus
.
MustRegister
(
blockNumber
)
prometheus
.
MustRegister
(
healthySequencer
)
prometheus
.
MustRegister
(
healthySequencer
)
prometheus
.
MustRegister
(
opExporterVersion
)
}
}
go/op-exporter/main.go
View file @
0f68bba9
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"io/ioutil"
"net/http"
"net/http"
"os"
"os"
"strings"
"sync"
"sync"
"time"
"time"
...
@@ -50,7 +51,7 @@ var (
...
@@ -50,7 +51,7 @@ var (
enableK8sQuery
=
kingpin
.
Flag
(
enableK8sQuery
=
kingpin
.
Flag
(
"k8s.enable"
,
"k8s.enable"
,
"Enable kubernetes info lookup."
,
"Enable kubernetes info lookup."
,
)
.
Default
(
"
tru
e"
)
.
Bool
()
)
.
Default
(
"
fals
e"
)
.
Bool
()
)
)
type
healthCheck
struct
{
type
healthCheck
struct
{
...
@@ -81,7 +82,8 @@ func main() {
...
@@ -81,7 +82,8 @@ func main() {
log
.
Infoln
(
"exporter config"
,
*
listenAddress
,
*
rpcProvider
,
*
networkLabel
)
log
.
Infoln
(
"exporter config"
,
*
listenAddress
,
*
rpcProvider
,
*
networkLabel
)
log
.
Infoln
(
"Starting op_exporter"
,
version
.
Info
())
log
.
Infoln
(
"Starting op_exporter"
,
version
.
Info
())
log
.
Infoln
(
"Build context"
,
version
.
BuildContext
())
log
.
Infoln
(
"Build context"
,
version
.
BuildContext
())
opExporterVersion
.
WithLabelValues
(
strings
.
Trim
(
version
.
Version
,
"
\"
"
),
version
.
GitCommit
,
version
.
GoVersion
,
version
.
BuildDate
)
.
Inc
()
health
:=
healthCheck
{
health
:=
healthCheck
{
mu
:
new
(
sync
.
RWMutex
),
mu
:
new
(
sync
.
RWMutex
),
height
:
0
,
height
:
0
,
...
...
go/op-exporter/version/version.go
View file @
0f68bba9
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
var
(
var
(
Version
string
Version
string
GitCommit
string
GitCommit
string
BuildUser
string
BuildDate
string
BuildDate
string
GoVersion
=
runtime
.
Version
()
GoVersion
=
runtime
.
Version
()
)
)
...
@@ -18,5 +17,5 @@ func Info() string {
...
@@ -18,5 +17,5 @@ func Info() string {
}
}
func
BuildContext
()
string
{
func
BuildContext
()
string
{
return
fmt
.
Sprintf
(
"(go=%s,
user=%s, date=%s)"
,
GoVersion
,
BuildUser
,
BuildDate
)
return
fmt
.
Sprintf
(
"(go=%s,
date=%s)"
,
GoVersion
,
BuildDate
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment