Commit 848f7928 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

op-exporter: delete package (#8817)

The `op-exporter` package is no longer used in production or maintained.
Remove the package to delete dead code from the monorepo.
parent 28fe81cf
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
/op-chain-ops @ethereum-optimism/go-reviewers /op-chain-ops @ethereum-optimism/go-reviewers
/op-challenger @ethereum-optimism/go-reviewers /op-challenger @ethereum-optimism/go-reviewers
/op-e2e @ethereum-optimism/go-reviewers /op-e2e @ethereum-optimism/go-reviewers
/op-exporter @ethereum-optimism/go-reviewers
/op-heartbeat @ethereum-optimism/go-reviewers /op-heartbeat @ethereum-optimism/go-reviewers
/op-node @ethereum-optimism/go-reviewers /op-node @ethereum-optimism/go-reviewers
/op-node/rollup @protolambda @trianglesphere @ajsutton /op-node/rollup @protolambda @trianglesphere @ajsutton
......
...@@ -144,14 +144,6 @@ pull_request_rules: ...@@ -144,14 +144,6 @@ pull_request_rules:
label: label:
add: add:
- A-op-e2e - A-op-e2e
- name: Add A-op-exporter label
conditions:
- 'files~=^op-exporter/'
- '#label<5'
actions:
label:
add:
- A-op-exporter
- name: Add A-op-heartbeat label - name: Add A-op-heartbeat label
conditions: conditions:
- 'files~=^op-heartbeat/' - 'files~=^op-heartbeat/'
......
...@@ -22,7 +22,6 @@ jobs: ...@@ -22,7 +22,6 @@ jobs:
replica-mon: ${{ steps.packages.outputs.replica-mon }} replica-mon: ${{ steps.packages.outputs.replica-mon }}
wd-mon: ${{ steps.packages.outputs.wd-mon }} wd-mon: ${{ steps.packages.outputs.wd-mon }}
canary-docker-tag: ${{ steps.docker-image-name.outputs.canary-docker-tag }} canary-docker-tag: ${{ steps.docker-image-name.outputs.canary-docker-tag }}
op-exporter: ${{ steps.packages.outputs.op-exporter }}
endpoint-monitor: ${{ steps.packages.outputs.endpoint-monitor }} endpoint-monitor: ${{ steps.packages.outputs.endpoint-monitor }}
steps: steps:
...@@ -206,43 +205,6 @@ jobs: ...@@ -206,43 +205,6 @@ jobs:
push: true push: true
tags: ethereumoptimism/replica-mon:${{ needs.canary-publish.outputs.canary-docker-tag }} tags: ethereumoptimism/replica-mon:${{ needs.canary-publish.outputs.canary-docker-tag }}
op-exporter:
name: Publish op-exporter Version ${{ needs.canary-publish.outputs.canary-docker-tag }}
needs: canary-publish
if: needs.canary-publish.outputs.op-exporter != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }}
- name: Set build args
id: build_args
run: |
echo ::set-output name=GITDATE::"$(date +%d-%m-%Y)"
echo ::set-output name=GITVERSION::$(jq -r .version ./op-exporter/package.json)
echo ::set-output name=GITCOMMIT::"$GITHUB_SHA"
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./op-exporter/Dockerfile=
push: true
tags: ethereumoptimism/op-exporter:${{ needs.canary-publish.outputs.op-exporter }}
build-args: |
GITDATE=${{ steps.build_args.outputs.GITDATE }}
GITCOMMIT=${{ steps.build_args.outputs.GITCOMMIT }}
GITVERSION=${{ steps.build_args.outputs.GITVERSION }}
endpoint-monitor: endpoint-monitor:
name: Publish endpoint-monitor Version ${{ needs.canary-publish.outputs.canary-docker-tag }} name: Publish endpoint-monitor Version ${{ needs.canary-publish.outputs.canary-docker-tag }}
needs: canary-publish needs: canary-publish
......
...@@ -22,7 +22,6 @@ jobs: ...@@ -22,7 +22,6 @@ jobs:
multisig-mon: ${{ steps.packages.outputs.multisig-mon }} multisig-mon: ${{ steps.packages.outputs.multisig-mon }}
replica-mon: ${{ steps.packages.outputs.replica-mon }} replica-mon: ${{ steps.packages.outputs.replica-mon }}
wd-mon: ${{ steps.packages.outputs.wd-mon }} wd-mon: ${{ steps.packages.outputs.wd-mon }}
op-exporter: ${{ steps.packages.outputs.op-exporter }}
endpoint-monitor: ${{ steps.packages.outputs.endpoint-monitor }} endpoint-monitor: ${{ steps.packages.outputs.endpoint-monitor }}
# Permissions necessary for Changesets to push a new branch and open PRs # Permissions necessary for Changesets to push a new branch and open PRs
# (for automated Version Packages PRs), and request the JWT for provenance. # (for automated Version Packages PRs), and request the JWT for provenance.
...@@ -69,43 +68,6 @@ jobs: ...@@ -69,43 +68,6 @@ jobs:
run: | run: |
node ops/scripts/ci-versions.js ${{ toJSON(steps.changesets.outputs.publishedPackages) }} node ops/scripts/ci-versions.js ${{ toJSON(steps.changesets.outputs.publishedPackages) }}
op-exporter:
name: Publish op-exporter Version ${{ needs.release.outputs.op-exporter}}
needs: release
if: needs.release.outputs.op-exporter != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }}
- name: Set build args
id: build_args
run: |
echo ::set-output name=GITDATE::"$(date +%d-%m-%Y)"
echo ::set-output name=GITVERSION::$(jq -r .version ./op-exporter/package.json)
echo ::set-output name=GITCOMMIT::"$GITHUB_SHA"
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./op-exporter/Dockerfile
push: true
tags: ethereumoptimism/op-exporter:${{ needs.release.outputs.op-exporter }},ethereumoptimism/op-exporter:latest
build-args: |
GITDATE=${{ steps.build_args.outputs.GITDATE }}
GITCOMMIT=${{ steps.build_args.outputs.GITCOMMIT }}
GITVERSION=${{ steps.build_args.outputs.GITVERSION }}
fault-mon: fault-mon:
name: Publish fault-mon Version ${{ needs.release.outputs.fault-mon }} name: Publish fault-mon Version ${{ needs.release.outputs.fault-mon }}
needs: release needs: release
......
...@@ -42,8 +42,6 @@ coverage.out ...@@ -42,8 +42,6 @@ coverage.out
# Ignore bedrock go bindings local output files # Ignore bedrock go bindings local output files
op-bindings/bin op-bindings/bin
op-exporter
__pycache__ __pycache__
......
...@@ -47,7 +47,6 @@ The Optimism Immunefi program offers up to $2,000,042 for in-scope critical vuln ...@@ -47,7 +47,6 @@ The Optimism Immunefi program offers up to $2,000,042 for in-scope critical vuln
├── <a href="./op-chain-ops">op-chain-ops</a>: State surgery utilities ├── <a href="./op-chain-ops">op-chain-ops</a>: State surgery utilities
├── <a href="./op-challenger">op-challenger</a>: Dispute game challenge agent ├── <a href="./op-challenger">op-challenger</a>: Dispute game challenge agent
├── <a href="./op-e2e">op-e2e</a>: End-to-End testing of all bedrock components in Go ├── <a href="./op-e2e">op-e2e</a>: End-to-End testing of all bedrock components in Go
├── <a href="./op-exporter">op-exporter</a>: Prometheus exporter client
├── <a href="./op-heartbeat">op-heartbeat</a>: Heartbeat monitor service ├── <a href="./op-heartbeat">op-heartbeat</a>: Heartbeat monitor service
├── <a href="./op-node">op-node</a>: rollup consensus-layer client ├── <a href="./op-node">op-node</a>: rollup consensus-layer client
├── <a href="./op-preimage">op-preimage</a>: Go bindings for Preimage Oracle ├── <a href="./op-preimage">op-preimage</a>: Go bindings for Preimage Oracle
......
op_exporter
.env
\ No newline at end of file
# @eth-optimism/op-exporter
## 0.5.5
### Patch Changes
- [#7450](https://github.com/ethereum-optimism/optimism/pull/7450) [`ac90e16a7`](https://github.com/ethereum-optimism/optimism/commit/ac90e16a7f85c4f73661ae6023135c3d00421c1e) Thanks [@roninjin10](https://github.com/roninjin10)! - Updated dev dependencies related to testing that is causing audit tooling to report failures
## 0.5.4
### Patch Changes
- 160f4c3d: Update docker image to use golang 1.18.0
## 0.5.3
### Patch Changes
- 673bfcc4: Fixes panic caused by version initialized to nil
- c7e6bed3: Added version metrics
## 0.5.2
### Patch Changes
- 5877f230: force rebuild
## 0.5.1
### Patch Changes
- 3f563420: Cleanup op-exporter CI, renamed package
FROM golang:1.20.7-alpine3.18 as builder
# build from root of repo
COPY ./op-exporter /app
WORKDIR /app/
RUN apk --no-cache add make bash jq git
RUN make build
FROM alpine:3.18
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/op-exporter /usr/local/bin/
ENTRYPOINT ["op-exporter"]
CMD ["--help"]
SHELL := /bin/bash
ifndef VERSION
VERSION := `jq .version package.json `
endif
ifndef GITCOMMIT
GITCOMMIT := `git rev-parse HEAD`
endif
ifndef BUILDDATE
BUILDDATE := `date +%Y-%m-%d`
endif
LDFLAGSSTRING :=-X github.com/ethereum-optimism/op-exporter/version.Version=$(VERSION)
LDFLAGSSTRING +=-X github.com/ethereum-optimism/op-exporter/version.GitCommit=$(GITCOMMIT)
LDFLAGSSTRING +=-X github.com/ethereum-optimism/op-exporter/version.BuildDate=$(BUILDDATE)
LDFLAGS :=-ldflags "$(LDFLAGSSTRING)"
.PHONY: all build
all: build
# Build binary
build:
CGO_ENABLED=0 go build $(LDFLAGS)
lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
# op_exporter
A prometheus exporter to collect information from an Optimism node and serve metrics for collection
## Usage
```
make build && ./op_exporter --rpc.provider="https://kovan-sequencer.optimism.io" --label.network="kovan"
```
## Health endpoint `/health`
Returns json describing the health of the sequencer based on the time since a block height update.
```
$ curl http://localhost:9100/health
{ "healthy": "false" }
```
## Metrics endpoint `/metrics`
```
# HELP op_gasPrice Gas price.
# TYPE op_gasPrice gauge
op_gasPrice{layer="layer1",network="kovan"} 6.9e+09
op_gasPrice{layer="layer2",network="kovan"} 1
```
package main
import (
"github.com/prometheus/client_golang/prometheus"
)
//Define the metrics we wish to expose
var (
gasBaseFeeMetric = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_baseFee",
Help: "Gas base fee."},
[]string{"network", "layer"},
)
gasUsedMetric = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_gasUsed",
Help: "Gas Used."},
[]string{"network", "layer"},
)
gasPrice = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_gasPrice",
Help: "Gas price."},
[]string{"network", "layer"},
)
blockNumber = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_blocknumber",
Help: "Current block number."},
[]string{"network", "layer"},
)
healthySequencer = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_healthy_sequencer",
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() {
//Register metrics with prometheus
prometheus.MustRegister(gasPrice)
prometheus.MustRegister(blockNumber)
prometheus.MustRegister(healthySequencer)
prometheus.MustRegister(opExporterVersion)
prometheus.MustRegister(gasBaseFeeMetric)
prometheus.MustRegister(gasUsedMetric)
}
module github.com/ethereum-optimism/optimism/op-exporter
go 1.20
require (
github.com/ethereum/go-ethereum v1.13.5
github.com/prometheus/client_golang v1.14.0
github.com/sirupsen/logrus v1.7.0
github.com/ybbus/jsonrpc v2.1.2+incompatible
gopkg.in/alecthomas/kingpin.v2 v2.2.6
k8s.io/apimachinery v0.21.2
k8s.io/client-go v0.21.2
)
require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/onsi/gomega v1.16.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/api v0.21.2 // indirect
k8s.io/klog/v2 v2.8.0 // indirect
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.0 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
This diff is collapsed.
package k8sClient
import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
)
func Newk8sClient() (client *kubernetes.Clientset, err error) {
// creates the in-cluster config
config, err := rest.InClusterConfig()
if err != nil {
panic(err.Error())
}
// creates the clientset
client, err = kubernetes.NewForConfig(config)
if err != nil {
panic(err.Error())
}
return client, nil
}
package main
import (
"context"
"fmt"
"net/http"
"os"
"strings"
"sync"
"time"
"github.com/ethereum-optimism/optimism/op-exporter/k8sClient"
"github.com/ethereum-optimism/optimism/op-exporter/version"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
"github.com/ybbus/jsonrpc"
"gopkg.in/alecthomas/kingpin.v2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
var UnknownStatus = "UNKNOWN"
var (
listenAddress = kingpin.Flag(
"web.listen-address",
"Address on which to expose metrics and web interface.",
).Default(":9100").String()
rpcProvider = kingpin.Flag(
"rpc.provider",
"Address for RPC provider.",
).Default("http://127.0.0.1:8545").String()
networkLabel = kingpin.Flag(
"label.network",
"Label to apply to the metrics to identify the network.",
).Default("mainnet").String()
versionFlag = kingpin.Flag(
"version",
"Display binary version.",
).Default("False").Bool()
unhealthyTimePeriod = kingpin.Flag(
"wait.minutes",
"Number of minutes to wait for the next block before marking provider unhealthy.",
).Default("10").Int()
sequencerPollingSeconds = kingpin.Flag(
"sequencer.polling",
"Number of seconds to wait between sequencer polling cycles.",
).Default("30").Int()
enableK8sQuery = kingpin.Flag(
"k8s.enable",
"Enable kubernetes info lookup.",
).Default("false").Bool()
enableRollUpGasPrices = kingpin.Flag(
"rollUpGasPrices.enable",
"Enable rollUpGasPrices info lookup.",
).Default("false").Bool()
enableGasBaseFee = kingpin.Flag(
"gaseBaseFee.enable",
"Enable gaseBaseFee info lookup.",
).Default("false").Bool()
)
type healthCheck struct {
mu *sync.RWMutex
height uint64
healthy bool
updateTime time.Time
allowedMethods []string
version *string
}
type getBlockByNumberResponse struct {
BaseFeePerGas string `json:"baseFeePerGas"`
GasUsed string `json:"gasUsed"`
}
func healthHandler(health *healthCheck) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
health.mu.RLock()
defer health.mu.RUnlock()
w.Write([]byte(fmt.Sprintf(`{ "healthy": "%t", "version": "%s" }`, health.healthy, *health.version)))
}
}
func main() {
kingpin.HelpFlag.Short('h')
kingpin.Parse()
if *versionFlag {
fmt.Printf("(version=%s, gitcommit=%s)\n", version.Version, version.GitCommit)
fmt.Printf("(go=%s, date=%s)\n", version.GoVersion, version.BuildDate)
os.Exit(0)
}
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,
healthy: false,
updateTime: time.Now(),
allowedMethods: nil,
version: &UnknownStatus,
}
http.Handle("/metrics", promhttp.Handler())
http.Handle("/health", healthHandler(&health))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`<html>
<head><title>OP Exporter</title></head>
<body>
<h1>OP Exporter</h1>
<p><a href="/metrics">Metrics</a></p>
<p><a href="/health">Health</a></p>
</body>
</html>`))
})
go getBlockNumber(&health)
if *enableRollUpGasPrices {
go getRollupGasPrices()
}
if *enableGasBaseFee {
go getBaseFee()
}
if *enableK8sQuery {
client, err := k8sClient.Newk8sClient()
if err != nil {
log.Fatal(err)
}
go getSequencerVersion(&health, client)
}
log.Infoln("Listening on", *listenAddress)
if err := http.ListenAndServe(*listenAddress, nil); err != nil {
log.Fatal(err)
}
}
func getSequencerVersion(health *healthCheck, client *kubernetes.Clientset) {
ns, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
if err != nil {
log.Fatalf("Unable to read namespace file: %s", err)
}
ticker := time.NewTicker(30 * time.Second)
for {
<-ticker.C
getOpts := metav1.GetOptions{
TypeMeta: metav1.TypeMeta{},
ResourceVersion: "",
}
sequencerStatefulSet, err := client.AppsV1().StatefulSets(string(ns)).Get(context.TODO(), "sequencer", getOpts)
if err != nil {
health.version = &UnknownStatus
log.Errorf("Unable to retrieve a sequencer StatefulSet: %s", err)
continue
}
for _, c := range sequencerStatefulSet.Spec.Template.Spec.Containers {
log.Infof("Checking container %s", c.Name)
switch {
case c.Name == "sequencer":
log.Infof("The sequencer version is: %s", c.Image)
health.version = &c.Image
default:
log.Infof("Unable to find the sequencer container in the statefulset?!?")
}
}
}
}
func getBlockNumber(health *healthCheck) {
rpcClient := jsonrpc.NewClientWithOpts(*rpcProvider, &jsonrpc.RPCClientOpts{})
var blockNumberResponse *string
for {
if err := rpcClient.CallFor(&blockNumberResponse, "eth_blockNumber"); err != nil {
health.mu.Lock()
health.healthy = false
health.mu.Unlock()
log.Warnln("Error calling eth_blockNumber, setting unhealthy", err)
} else {
log.Infoln("Got block number: ", *blockNumberResponse)
health.mu.Lock()
currentHeight, err := hexutil.DecodeUint64(*blockNumberResponse)
blockNumber.WithLabelValues(
*networkLabel, "layer2").Set(float64(currentHeight))
if err != nil {
log.Warnln("Error decoding block height", err)
continue
}
lastHeight := health.height
// If the currentHeight is the same as the lastHeight, check that
// the unhealthyTimePeriod has passed and update health.healthy
if currentHeight == lastHeight {
currentTime := time.Now()
lastTime := health.updateTime
log.Warnln(fmt.Sprintf("Heights are the same, %v, %v", currentTime, lastTime))
if lastTime.Add(time.Duration(*unhealthyTimePeriod) * time.Minute).Before(currentTime) {
health.healthy = false
log.Warnln("Heights are the same for the unhealthyTimePeriod, setting unhealthy")
}
} else {
log.Warnln("New block height detected, setting healthy")
health.height = currentHeight
health.updateTime = time.Now()
health.healthy = true
}
if health.healthy {
healthySequencer.WithLabelValues(
*networkLabel).Set(1)
} else {
healthySequencer.WithLabelValues(
*networkLabel).Set(0)
}
health.mu.Unlock()
}
time.Sleep(time.Duration(*sequencerPollingSeconds) * time.Second)
}
}
func getBaseFee() {
rpcClient := jsonrpc.NewClientWithOpts(*rpcProvider, &jsonrpc.RPCClientOpts{})
var getBlockByNumbeResponse *getBlockByNumberResponse
for {
if err := rpcClient.CallFor(&getBlockByNumbeResponse, "eth_getBlockByNumber", "latest", false); err != nil {
log.Errorln("Error calling eth_getBlockByNumber", err)
} else {
log.Infoln("Got baseFee response: ", *getBlockByNumbeResponse)
baseFeePerGas, err := hexutil.DecodeUint64(getBlockByNumbeResponse.BaseFeePerGas)
if err != nil {
log.Warnln("Error converting baseFeePerGas " + getBlockByNumbeResponse.BaseFeePerGas)
}
gasBaseFeeMetric.WithLabelValues(
*networkLabel, "layer2").Set(float64(baseFeePerGas))
gasUsed, err := hexutil.DecodeUint64(getBlockByNumbeResponse.GasUsed)
if err != nil {
log.Warnln("Error converting gasUsed " + getBlockByNumbeResponse.GasUsed)
}
gasUsedMetric.WithLabelValues(
*networkLabel, "layer2").Set(float64(gasUsed))
}
time.Sleep(time.Duration(*sequencerPollingSeconds) * time.Second)
}
}
func getRollupGasPrices() {
rpcClient := jsonrpc.NewClientWithOpts(*rpcProvider, &jsonrpc.RPCClientOpts{})
var rollupGasPrices *GetRollupGasPrices
for {
if err := rpcClient.CallFor(&rollupGasPrices, "rollup_gasPrices"); err != nil {
log.Warnln("Error calling rollup_gasPrices", err)
} else {
l1GasPriceString := rollupGasPrices.L1GasPrice
l1GasPrice, err := hexutil.DecodeUint64(l1GasPriceString)
if err != nil {
log.Warnln("Error converting gasPrice " + l1GasPriceString)
}
gasPrice.WithLabelValues(
*networkLabel, "layer1").Set(float64(l1GasPrice))
l2GasPriceString := rollupGasPrices.L2GasPrice
l2GasPrice, err := hexutil.DecodeUint64(l2GasPriceString)
if err != nil {
log.Warnln("Error converting gasPrice " + l2GasPriceString)
}
gasPrice.WithLabelValues(
*networkLabel, "layer2").Set(float64(l2GasPrice))
log.Infoln("Got L1 gas string: ", l1GasPriceString)
log.Infoln("Got L1 gas prices: ", l1GasPrice)
log.Infoln("Got L2 gas string: ", l2GasPriceString)
log.Infoln("Got L2 gas prices: ", l2GasPrice)
}
time.Sleep(time.Duration(30) * time.Second)
}
}
{
"name": "@eth-optimism/op-exporter",
"version": "0.5.5",
"private": true,
"devDependencies": {}
}
package main
// GetRollupGasPrices returns the rpc `rollup_gasPrices` status
type GetRollupGasPrices struct {
L1GasPrice string `json:"l1GasPrice"`
L2GasPrice string `json:"l2GasPrice"`
}
type GetBlockNumber struct {
BlockNumber string `json:"result"`
}
package version
import (
"fmt"
"runtime"
)
var (
Version string
GitCommit string
BuildDate string
GoVersion = runtime.Version()
)
func Info() string {
return fmt.Sprintf("(version=%s, gitcommit=%s)", Version, GitCommit)
}
func BuildContext() string {
return fmt.Sprintf("(go=%s, date=%s)", GoVersion, BuildDate)
}
...@@ -37,7 +37,6 @@ ARG OP_CONDUCTOR_VERSION=v0.0.0 ...@@ -37,7 +37,6 @@ ARG OP_CONDUCTOR_VERSION=v0.0.0
# separate docker-builds: # separate docker-builds:
# - op-exporter
# - op-ufm # - op-ufm
# - proxyd # - proxyd
# - any JS/TS/smart-contract builds # - any JS/TS/smart-contract builds
......
...@@ -129,8 +129,6 @@ importers: ...@@ -129,8 +129,6 @@ importers:
specifier: ^1.0.1 specifier: ^1.0.1
version: 1.0.1(@types/node@20.10.4)(jsdom@23.0.1) version: 1.0.1(@types/node@20.10.4)(jsdom@23.0.1)
op-exporter: {}
packages/chain-mon: packages/chain-mon:
dependencies: dependencies:
'@eth-optimism/common-ts': '@eth-optimism/common-ts':
......
packages: packages:
- 'packages/*' - 'packages/*'
- 'endpoint-monitor' - 'endpoint-monitor'
- 'op-exporter'
- 'indexer/api-ts' - 'indexer/api-ts'
...@@ -27,7 +27,6 @@ Go modules which are not yet versioned: ...@@ -27,7 +27,6 @@ Go modules which are not yet versioned:
```text ```text
./indexer (changesets) ./indexer (changesets)
./op-exporter (changesets)
./proxyd (changesets) ./proxyd (changesets)
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment