new exporter version
This commit is contained in:
parent
59d2508e7f
commit
05bd6f3c03
|
|
@ -21,7 +21,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: export
|
- name: export
|
||||||
image: serviceplant/goexp:0.0.30
|
image: serviceplant/goexp:0.0.31
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 9040
|
- containerPort: 9040
|
||||||
name: metrics
|
name: metrics
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ func getMetrics(cephConn CephConnection) {
|
||||||
result = append(result, x)
|
result = append(result, x)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
metrics.total_rbd_requested_size_per_pool.Reset()
|
||||||
for _,v := range result {
|
for _,v := range result {
|
||||||
if !v.hasRBD {continue}
|
if !v.hasRBD {continue}
|
||||||
FillMetrics(v,metrics)
|
FillMetrics(v,metrics)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ func InitMetrics() *Metrics {
|
||||||
|
|
||||||
func FillMetrics(pool Pool,metrics *Metrics) {
|
func FillMetrics(pool Pool,metrics *Metrics) {
|
||||||
var totalSizePerPool uint64 = 0
|
var totalSizePerPool uint64 = 0
|
||||||
metrics.total_rbd_requested_size_per_pool.Reset()
|
|
||||||
|
|
||||||
logger.Debugf("Processing pool %s",pool.Name)
|
logger.Debugf("Processing pool %s",pool.Name)
|
||||||
for _,v := range pool.RBDlist {
|
for _,v := range pool.RBDlist {
|
||||||
|
|
|
||||||
Binary file not shown.
3
testing/go.mod
Normal file
3
testing/go.mod
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
module main.go
|
||||||
|
|
||||||
|
go 1.25.5
|
||||||
33
testing/hello_test.go
Normal file
33
testing/hello_test.go
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestHello(t *testing.T) {
|
||||||
|
t.Run("Say hi to Utii",func(t *testing.T) {
|
||||||
|
got := Hello("Utii","")
|
||||||
|
want := "Hello Utii"
|
||||||
|
|
||||||
|
assertCorrestMsg(t,got,want)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("say 'Hello world' when arg is empty",func(t *testing.T){
|
||||||
|
got := Hello("","")
|
||||||
|
want := "Hello world"
|
||||||
|
|
||||||
|
assertCorrestMsg(t,got,want)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("say 'Hello world' in Russian",func(t *testing.T){
|
||||||
|
got := Hello("Utii","Russian")
|
||||||
|
want := "Привет Utii"
|
||||||
|
|
||||||
|
assertCorrestMsg(t,got,want)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func assertCorrestMsg(t testing.TB,got, want string) {
|
||||||
|
t.Helper()
|
||||||
|
if got != want {
|
||||||
|
t.Errorf("got %q want %q",got,want)
|
||||||
|
}
|
||||||
|
}
|
||||||
18
testing/main.go
Normal file
18
testing/main.go
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
const Prefix = "Hello "
|
||||||
|
|
||||||
|
func Hello(name,language string) string {
|
||||||
|
if name == "" {
|
||||||
|
name = "world"
|
||||||
|
}
|
||||||
|
if language == "Russian" {
|
||||||
|
return "Привет " + name
|
||||||
|
}
|
||||||
|
return Prefix + name
|
||||||
|
}
|
||||||
|
func main() {
|
||||||
|
fmt.Println(Hello("Utii",""))
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user