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
b8bd11c1
Unverified
Commit
b8bd11c1
authored
Jan 06, 2022
by
Mark Tyneway
Committed by
GitHub
Jan 06, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1988 from ethereum-optimism/bwilson/feature/op-exporter-version-metric
feature - added op-exporter version metric
parents
a21cec6d
c7e6bed3
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
7 deletions
+25
-7
fluffy-ghosts-heal.md
.changeset/fluffy-ghosts-heal.md
+5
-0
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.
.changeset/fluffy-ghosts-heal.md
0 → 100644
View file @
b8bd11c1
---
'
@eth-optimism/op-exporter'
:
patch
---
Added version metrics
go/op-exporter/Makefile
View file @
b8bd11c1
SHELL
:=
/bin/bash
VERSION
:=
`
git describe
--abbrev
=
0
`
ifndef
VERSION
VERSION
:=
`
jq .version package.json
`
endif
ifndef
GITCOMMIT
GITCOMMIT
:=
`
git rev-parse HEAD
`
endif
ifndef
BUILDDATE
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.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.BuildUser
=
$(BUILDUSER)
LDFLAGS
:=
-ldflags
"
$(LDFLAGSSTRING)
"
...
...
go/op-exporter/collector.go
View file @
b8bd11c1
...
...
@@ -24,6 +24,12 @@ var (
Help
:
"Is the sequencer healthy?"
},
[]
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
()
{
...
...
@@ -31,4 +37,6 @@ func init() {
prometheus
.
MustRegister
(
gasPrice
)
prometheus
.
MustRegister
(
blockNumber
)
prometheus
.
MustRegister
(
healthySequencer
)
prometheus
.
MustRegister
(
opExporterVersion
)
}
go/op-exporter/main.go
View file @
b8bd11c1
...
...
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"net/http"
"os"
"strings"
"sync"
"time"
...
...
@@ -50,7 +51,7 @@ var (
enableK8sQuery
=
kingpin
.
Flag
(
"k8s.enable"
,
"Enable kubernetes info lookup."
,
)
.
Default
(
"
tru
e"
)
.
Bool
()
)
.
Default
(
"
fals
e"
)
.
Bool
()
)
type
healthCheck
struct
{
...
...
@@ -81,7 +82,8 @@ func main() {
log
.
Infoln
(
"exporter config"
,
*
listenAddress
,
*
rpcProvider
,
*
networkLabel
)
log
.
Infoln
(
"Starting op_exporter"
,
version
.
Info
())
log
.
Infoln
(
"Build context"
,
version
.
BuildContext
())
opExporterVersion
.
WithLabelValues
(
strings
.
Trim
(
version
.
Version
,
"
\"
"
),
version
.
GitCommit
,
version
.
GoVersion
,
version
.
BuildDate
)
.
Inc
()
health
:=
healthCheck
{
mu
:
new
(
sync
.
RWMutex
),
height
:
0
,
...
...
go/op-exporter/version/version.go
View file @
b8bd11c1
...
...
@@ -8,7 +8,6 @@ import (
var
(
Version
string
GitCommit
string
BuildUser
string
BuildDate
string
GoVersion
=
runtime
.
Version
()
)
...
...
@@ -18,5 +17,5 @@ func Info() 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