diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 607a8b12..5e8d4ea5 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -79,6 +79,7 @@ jobs: with: build-args: | RELEASE_TAG=${{ inputs.tag || github.sha || github.head_ref || github.ref_name }} + COMMIT_SHA=${{ github.sha }} platforms: linux/amd64,linux/arm64 context: . file: dockerfiles/operator.Dockerfile diff --git a/Makefile b/Makefile index 08f14058..5cad059f 100644 --- a/Makefile +++ b/Makefile @@ -109,7 +109,9 @@ dev-live: ## dev-build: build a dev version for local development dev-build: mkdir out || true - go build -o ./out/ap + go build \ + -o ./out/ap \ + -ldflags "-X github.com/AvaProtocol/ap-avs/version.revision=$(shell git rev-parse HEAD)" ## dev-agg: run aggregator locally with dev build dev-agg: diff --git a/aggregator/http_server.go b/aggregator/http_server.go index e3dd6207..0c82b005 100644 --- a/aggregator/http_server.go +++ b/aggregator/http_server.go @@ -8,6 +8,7 @@ import ( "context" "net/http" + "github.com/AvaProtocol/ap-avs/version" "github.com/labstack/echo/v4" ) @@ -45,7 +46,15 @@ func (agg *Aggregator) startHttpServer(ctx context.Context) { return err } - data := agg.operatorPool.GetAll() + data := struct { + Version string + Revision string + Nodes []*OperatorNode + }{ + Version: version.Get(), + Revision: version.Commit(), + Nodes: agg.operatorPool.GetAll(), + } var buf bytes.Buffer if err := tpl.Execute(&buf, data); err != nil { agg.logger.Errorf("error rendering telemetry %v", err) diff --git a/aggregator/pool.go b/aggregator/pool.go index 078503e9..bf7f07d3 100644 --- a/aggregator/pool.go +++ b/aggregator/pool.go @@ -19,6 +19,8 @@ type OperatorNode struct { LastPingEpoch int64 `json:"last_ping"` Version string `json:"version"` MetricsPort int32 `json:"metrics_port"` + BlockNumer int64 `json:"block_number"` + EventCount int64 `json:"event_count"` } func (o *OperatorNode) LastSeen() string { @@ -66,6 +68,8 @@ func (o *OperatorPool) Checkin(payload *avsproto.Checkin) error { MetricsPort: payload.MetricsPort, RemoteIP: payload.RemoteIP, Version: payload.Version, + BlockNumer: payload.BlockNumber, + EventCount: payload.EventCount, } data, err := json.Marshal(status) diff --git a/aggregator/resources/index.gohtml b/aggregator/resources/index.gohtml index 58965436..b9e8a237 100644 --- a/aggregator/resources/index.gohtml +++ b/aggregator/resources/index.gohtml @@ -9,7 +9,7 @@
Active
-Last seen
+Last seen
+Block {{ .BlockNumer }}
+Event {{ .EventCount }}
+ Aggregator v{{.Version}} + +{{.Revision}} +
+