update to meter interface
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package victoriametrics
|
||||
|
||||
import (
|
||||
"os"
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
"github.com/unistack-org/micro/v3/codec"
|
||||
"github.com/unistack-org/micro/v3/meter"
|
||||
"github.com/unistack-org/micro/v3/meter/wrapper"
|
||||
)
|
||||
|
||||
func TestBuildName(t *testing.T) {
|
||||
@@ -18,5 +21,28 @@ func TestBuildName(t *testing.T) {
|
||||
|
||||
cnt := m.Counter("counter", meter.Label("key", "val"))
|
||||
cnt.Inc()
|
||||
m.Write(os.Stdout, true)
|
||||
//m.Write(os.Stdout, meter.WriteProcessMetrics(true), meter.WriteFDMetrics(true))
|
||||
}
|
||||
|
||||
func TestWrapper(t *testing.T) {
|
||||
m := NewMeter()
|
||||
|
||||
w := wrapper.NewClientWrapper(
|
||||
wrapper.ServiceName("svc1"),
|
||||
wrapper.ServiceVersion("0.0.1"),
|
||||
wrapper.ServiceID("12345"),
|
||||
wrapper.Meter(m),
|
||||
)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
c := client.NewClient(client.Wrap(w))
|
||||
if err := c.Init(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rsp := &codec.Frame{}
|
||||
req := &codec.Frame{}
|
||||
err := c.Call(ctx, c.NewRequest("svc2", "Service.Method", req), rsp)
|
||||
_, _ = rsp, err
|
||||
//m.Write(os.Stdout, meter.WriteProcessMetrics(true), meter.WriteFDMetrics(true))
|
||||
}
|
||||
|
Reference in New Issue
Block a user