Skip to content

[dbsql] [ffapi] DB Stats and Metrics #213

Open
onelapahead wants to merge 8 commits intohyperledger:mainfrom
kaleido-io:go-and-db-metrics
Open

[dbsql] [ffapi] DB Stats and Metrics #213
onelapahead wants to merge 8 commits intohyperledger:mainfrom
kaleido-io:go-and-db-metrics

Conversation

@onelapahead
Copy link
Copy Markdown
Contributor

Redo of #205

We nabled build info metrics and have ffapi tests to ensure the metrics endpoint works as expected.

DB metrics are in two forms:

  1. stats collector wraps Stats() from *sql.DB with basic gauges around conn settings and pool usage
    instrumentation of all operations and transactions
  2. Similar to ffresty, there's then a global func for clients to enable DB metrics, ensuring all initialized databases in a process are metered by the collector and instrumentation.

Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
@onelapahead onelapahead requested a review from a team as a code owner April 9, 2026 12:22
@EnriqueL8
Copy link
Copy Markdown
Contributor

Seems like a race condition on this one

time="2026-04-09T12:23:09Z" level=info msg=Disconnected wsc=9d80c11c-4fa6-4678-8c32-dbe517fe0592
fatal error: concurrent map iteration and map write

goroutine 100 [running]:
github.com/hyperledger/firefly-common/pkg/wsserver.(*webSocketServer).Close(...)
	/home/runner/work/firefly-common/firefly-common/pkg/wsserver/wsserver.go:130
github.com/hyperledger/firefly-common/pkg/wsserver.TestBroadcastStartWithoutConnections(0xc0003a64e0?)
	/home/runner/work/firefly-common/firefly-common/pkg/wsserver/wsserver_test.go:389 +0x2d0
testing.tRunner(0xc0003a64e0, 0xaf11e0)
	/opt/hostedtoolcache/go/1.23.12/x64/src/testing/testing.go:1690 +0xf4
created by testing.(*T).Run in goroutine 1
	/opt/hostedtoolcache/go/1.23.12/x64/src/testing/testing.go:1743 +0x390

@EnriqueL8
Copy link
Copy Markdown
Contributor

This should fix it #214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants