Skip to content

Commit

Permalink
ARCO-207: add prometheus metrics to api
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadiuszos4chain committed Sep 23, 2024
1 parent 6e07a5c commit 784eeaa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/arc/services/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/bitcoin-sv/arc/pkg/blocktx"
"github.com/bitcoin-sv/arc/pkg/metamorph"

"github.com/labstack/echo-contrib/echoprometheus"
"github.com/labstack/echo/v4"
echomiddleware "github.com/labstack/echo/v4/middleware"
"github.com/ordishs/go-bitcoin"
Expand Down Expand Up @@ -62,6 +63,9 @@ func StartAPIServer(logger *slog.Logger, arcConfig *config.ArcConfig) (func(), e
},
}))

// add prometheus metrics
e.Use(echoprometheus.NewMiddleware("api"))

// load the ARC handler from config
// If you want to customize this for your own server, see examples dir
// check the swagger definition against our requests
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/labstack/echo-contrib v0.17.1 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/libsv/go-bk v0.1.6 // indirect
github.com/libsv/go-bt/v2 v2.2.5 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/labstack/echo-contrib v0.17.1 h1:7I/he7ylVKsDUieaGRZ9XxxTYOjfQwVzHzUYrNykfCU=
github.com/labstack/echo-contrib v0.17.1/go.mod h1:SnsCZtwHBAZm5uBSAtQtXQHI3wqEA73hvTn0bYMKnZA=
github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0=
github.com/labstack/echo/v4 v4.12.0/go.mod h1:UP9Cr2DJXbOK3Kr9ONYzNowSh7HP0aG0ShAyycHSJvM=
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
Expand Down
2 changes: 2 additions & 0 deletions test/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ services:
- "8011:8011"
- "9090:9090"
- "9999:9999"
- "2112:2112"
expose:
- "9090"
- "2112"
command: [ "./arc", "-api=true", "-config=." ]
volumes:
- ./config/config.yaml:/service/config.yaml
Expand Down

0 comments on commit 784eeaa

Please sign in to comment.