Skip to content

Commit 3efd0e0

Browse files
authored
Merge branch 'etcd-io:main' into etcdutl-migrate
2 parents 9cc9379 + 52fb28c commit 3efd0e0

File tree

23 files changed

+174
-49
lines changed

23 files changed

+174
-49
lines changed

CHANGELOG/CHANGELOG-3.4.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Previous change logs can be found at [CHANGELOG-3.3](https://github.com/etcd-io/
1010
- Fix [Memberlist results not updated when proxy node down](https://github.com/etcd-io/etcd/pull/17896).
1111

1212
### Dependencies
13+
- Compile binaries using go [1.21.10](https://github.com/etcd-io/etcd/pull/17981).
1314
- Upgrade [bbolt to 1.3.10](https://github.com/etcd-io/etcd/pull/17945).
1415

1516
<hr>

CHANGELOG/CHANGELOG-3.5.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Previous change logs can be found at [CHANGELOG-3.4](https://github.com/etcd-io/
2222
- Fix [initialization for mu in client context](https://github.com/etcd-io/etcd/pull/17699).
2323

2424
### Dependencies
25-
- Compile binaries using [go 1.21.9](https://github.com/etcd-io/etcd/pull/17708).
25+
- Compile binaries using [go 1.21.10](https://github.com/etcd-io/etcd/pull/17980).
2626
- Upgrade [bbolt to v1.3.10](https://github.com/etcd-io/etcd/pull/17943).
2727

2828
<hr>

CHANGELOG/CHANGELOG-3.6.md

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ See [List of metrics](https://etcd.io/docs/latest/metrics/) for all metrics per
9191

9292
- Add [`etcd_disk_defrag_inflight`](https://github.com/etcd-io/etcd/pull/13371).
9393
- Add [`etcd_debugging_server_alarms`](https://github.com/etcd-io/etcd/pull/14276).
94+
- Add [`etcd_server_range_duration_seconds`](https://github.com/etcd-io/etcd/pull/17983).
9495

9596
### Go
9697
- Require [Go 1.22+](https://github.com/etcd-io/etcd/pull/16594).

client/v3/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/coreos/go-semver v0.3.1
99
github.com/dustin/go-humanize v1.0.1
1010
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
11-
github.com/prometheus/client_golang v1.19.0
11+
github.com/prometheus/client_golang v1.19.1
1212
github.com/stretchr/testify v1.9.0
1313
go.etcd.io/etcd/api/v3 v3.6.0-alpha.0
1414
go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0

client/v3/go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
3030
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
3131
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
3232
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
33-
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
34-
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
33+
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
34+
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
3535
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
3636
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
3737
github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE=

etcdctl/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ require (
2424
github.com/VividCortex/ewma v1.2.0 // indirect
2525
github.com/coreos/go-semver v0.3.1 // indirect
2626
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
27-
github.com/fatih/color v1.15.0 // indirect
27+
github.com/fatih/color v1.17.0 // indirect
2828
github.com/gogo/protobuf v1.3.2 // indirect
2929
github.com/golang/protobuf v1.5.4 // indirect
3030
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
3131
github.com/inconshreveable/mousetrap v1.1.0 // indirect
3232
github.com/mattn/go-colorable v0.1.13 // indirect
33-
github.com/mattn/go-isatty v0.0.19 // indirect
33+
github.com/mattn/go-isatty v0.0.20 // indirect
3434
github.com/mattn/go-runewidth v0.0.15 // indirect
3535
github.com/rivo/uniseg v0.4.7 // indirect
3636
go.uber.org/multierr v1.11.0 // indirect

etcdctl/go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
1717
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1818
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
1919
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
20-
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
21-
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
20+
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
21+
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
2222
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
2323
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
2424
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
@@ -37,17 +37,17 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
3737
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
3838
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
3939
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
40-
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
41-
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
40+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
41+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
4242
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
4343
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
4444
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
4545
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
4646
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
4747
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4848
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
49-
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
50-
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
49+
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
50+
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
5151
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
5252
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
5353
github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE=

etcdutl/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ require (
5151
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5252
github.com/jonboulle/clockwork v0.4.0 // indirect
5353
github.com/mattn/go-runewidth v0.0.15 // indirect
54-
github.com/prometheus/client_golang v1.19.0 // indirect
54+
github.com/prometheus/client_golang v1.19.1 // indirect
5555
github.com/prometheus/client_model v0.6.1 // indirect
5656
github.com/prometheus/common v0.53.0 // indirect
5757
github.com/prometheus/procfs v0.12.0 // indirect

etcdutl/go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N
4646
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
4747
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4848
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
49-
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
50-
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
49+
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
50+
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
5151
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
5252
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
5353
github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE=

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ require (
4747
github.com/cespare/xxhash/v2 v2.2.0 // indirect
4848
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
4949
github.com/davecgh/go-spew v1.1.1 // indirect
50-
github.com/fatih/color v1.15.0 // indirect
50+
github.com/fatih/color v1.17.0 // indirect
5151
github.com/go-logr/logr v1.4.1 // indirect
5252
github.com/go-logr/stdr v1.2.2 // indirect
5353
github.com/gogo/protobuf v1.3.2 // indirect
@@ -63,11 +63,11 @@ require (
6363
github.com/inconshreveable/mousetrap v1.1.0 // indirect
6464
github.com/jonboulle/clockwork v0.4.0 // indirect
6565
github.com/mattn/go-colorable v0.1.13 // indirect
66-
github.com/mattn/go-isatty v0.0.19 // indirect
66+
github.com/mattn/go-isatty v0.0.20 // indirect
6767
github.com/mattn/go-runewidth v0.0.15 // indirect
6868
github.com/olekukonko/tablewriter v0.0.5 // indirect
6969
github.com/pmezard/go-difflib v1.0.0 // indirect
70-
github.com/prometheus/client_golang v1.19.0 // indirect
70+
github.com/prometheus/client_golang v1.19.1 // indirect
7171
github.com/prometheus/client_model v0.6.1 // indirect
7272
github.com/prometheus/common v0.53.0 // indirect
7373
github.com/prometheus/procfs v0.12.0 // indirect

go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
3131
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
3232
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
3333
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
34-
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
35-
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
34+
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
35+
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
3636
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
3737
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
3838
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@@ -84,8 +84,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
8484
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
8585
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
8686
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
87-
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
88-
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
87+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
88+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
8989
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
9090
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
9191
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
@@ -95,8 +95,8 @@ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFSt
9595
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
9696
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
9797
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
98-
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
99-
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
98+
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
99+
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
100100
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
101101
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
102102
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=

server/etcdserver/txn/metrics.go

+16
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,29 @@ var (
3939
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 20),
4040
},
4141
[]string{"version", "op", "success"})
42+
rangeSec = prometheus.NewHistogramVec(prometheus.HistogramOpts{
43+
Namespace: "etcd",
44+
Subsystem: "server",
45+
Name: "range_duration_seconds",
46+
Help: "The latency distributions of txn.Range",
47+
48+
// lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2
49+
// highest bucket start of 0.0001 sec * 2^19 == 52.4288 sec
50+
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 20),
51+
},
52+
[]string{"success"})
4253
)
4354

4455
func ApplySecObserve(version, op string, success bool, latency time.Duration) {
4556
applySec.WithLabelValues(version, op, strconv.FormatBool(success)).Observe(float64(latency.Microseconds()) / 1000000.0)
4657
}
4758

59+
func RangeSecObserve(success bool, latency time.Duration) {
60+
rangeSec.WithLabelValues(strconv.FormatBool(success)).Observe(float64(latency.Microseconds()) / 1000000.0)
61+
}
62+
4863
func init() {
4964
prometheus.MustRegister(applySec)
65+
prometheus.MustRegister(rangeSec)
5066
prometheus.MustRegister(slowApplies)
5167
}

server/etcdserver/txn/metrics_test.go

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2022 The etcd Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package txn
16+
17+
import (
18+
"strings"
19+
"testing"
20+
"time"
21+
22+
"github.com/prometheus/client_golang/prometheus/testutil"
23+
"github.com/stretchr/testify/require"
24+
)
25+
26+
func TestRangeSecObserve(t *testing.T) {
27+
// Simulate a range operation taking 500 milliseconds.
28+
latency := 500 * time.Millisecond
29+
RangeSecObserve(true, latency)
30+
31+
// Use testutil to collect the results and check against expected value
32+
expected := `
33+
# HELP etcd_server_range_duration_seconds The latency distributions of txn.Range
34+
# TYPE etcd_server_range_duration_seconds histogram
35+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0001"} 0
36+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0002"} 0
37+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0004"} 0
38+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0008"} 0
39+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0016"} 0
40+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0032"} 0
41+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0064"} 0
42+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0128"} 0
43+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0256"} 0
44+
etcd_server_range_duration_seconds_bucket{success="true",le="0.0512"} 0
45+
etcd_server_range_duration_seconds_bucket{success="true",le="0.1024"} 0
46+
etcd_server_range_duration_seconds_bucket{success="true",le="0.2048"} 0
47+
etcd_server_range_duration_seconds_bucket{success="true",le="0.4096"} 0
48+
etcd_server_range_duration_seconds_bucket{success="true",le="0.8192"} 1
49+
etcd_server_range_duration_seconds_bucket{success="true",le="1.6384"} 1
50+
etcd_server_range_duration_seconds_bucket{success="true",le="3.2768"} 1
51+
etcd_server_range_duration_seconds_bucket{success="true",le="6.5536"} 1
52+
etcd_server_range_duration_seconds_bucket{success="true",le="13.1072"} 1
53+
etcd_server_range_duration_seconds_bucket{success="true",le="26.2144"} 1
54+
etcd_server_range_duration_seconds_bucket{success="true",le="52.4288"} 1
55+
etcd_server_range_duration_seconds_bucket{success="true",le="+Inf"} 1
56+
etcd_server_range_duration_seconds_sum{success="true"} 0.5
57+
etcd_server_range_duration_seconds_count{success="true"} 1
58+
`
59+
60+
err := testutil.CollectAndCompare(rangeSec, strings.NewReader(expected))
61+
require.NoError(t, err, "Collected metrics did not match expected metrics: %v", err)
62+
}

server/etcdserver/txn/txn.go

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"context"
2020
"fmt"
2121
"sort"
22+
"time"
2223

2324
"go.uber.org/zap"
2425

@@ -138,6 +139,10 @@ func Range(ctx context.Context, lg *zap.Logger, kv mvcc.KV, r *pb.RangeRequest)
138139
trace = traceutil.New("range", lg)
139140
ctx = context.WithValue(ctx, traceutil.TraceKey{}, trace)
140141
}
142+
defer func(start time.Time) {
143+
success := err == nil
144+
RangeSecObserve(success, time.Since(start))
145+
}(time.Now())
141146
txnRead := kv.Read(mvcc.ConcurrentReadTxMode, trace)
142147
defer txnRead.End()
143148
resp, err = executeRange(ctx, lg, txnRead, r)

server/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
1919
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
2020
github.com/jonboulle/clockwork v0.4.0
21-
github.com/prometheus/client_golang v1.19.0
21+
github.com/prometheus/client_golang v1.19.1
2222
github.com/prometheus/client_model v0.6.1
2323
github.com/soheilhy/cmux v0.1.5
2424
github.com/spf13/cobra v1.8.0

server/go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFSt
7777
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
7878
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
7979
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
80-
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
81-
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
80+
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
81+
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
8282
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
8383
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
8484
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=

tests/go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
2424
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
2525
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
26-
github.com/prometheus/client_golang v1.19.0
26+
github.com/prometheus/client_golang v1.19.1
2727
github.com/prometheus/common v0.53.0
2828
github.com/soheilhy/cmux v0.1.5
2929
github.com/stretchr/testify v1.9.0
@@ -61,7 +61,7 @@ require (
6161
github.com/creack/pty v1.1.18 // indirect
6262
github.com/davecgh/go-spew v1.1.1 // indirect
6363
github.com/dustin/go-humanize v1.0.1 // indirect
64-
github.com/fatih/color v1.15.0 // indirect
64+
github.com/fatih/color v1.17.0 // indirect
6565
github.com/go-logr/logr v1.4.1 // indirect
6666
github.com/go-logr/stdr v1.2.2 // indirect
6767
github.com/gogo/protobuf v1.3.2 // indirect
@@ -72,7 +72,7 @@ require (
7272
github.com/inconshreveable/mousetrap v1.1.0 // indirect
7373
github.com/jonboulle/clockwork v0.4.0 // indirect
7474
github.com/mattn/go-colorable v0.1.13 // indirect
75-
github.com/mattn/go-isatty v0.0.19 // indirect
75+
github.com/mattn/go-isatty v0.0.20 // indirect
7676
github.com/mattn/go-runewidth v0.0.15 // indirect
7777
github.com/olekukonko/tablewriter v0.0.5 // indirect
7878
github.com/pmezard/go-difflib v1.0.0 // indirect

0 commit comments

Comments
 (0)