summaryrefslogtreecommitdiff
path: root/plugins/metrics
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-13 18:06:24 +0300
committerValery Piashchynski <[email protected]>2020-11-13 18:06:24 +0300
commite83f7d824e5f491fb50b4a9024ef7862aee9b6ca (patch)
treebc594c95c88a7062720841a7ebc0aef95ea3969f /plugins/metrics
parent326b1f1beadc502dd7d78c7ffbceeaf238406ebb (diff)
golangci linters warnings fix
Diffstat (limited to 'plugins/metrics')
-rw-r--r--plugins/metrics/plugin_test.go36
-rw-r--r--plugins/metrics/rpc_test.go150
-rw-r--r--plugins/metrics/tests/plugin1.go2
-rw-r--r--plugins/metrics/tests/plugin2.go26
4 files changed, 107 insertions, 107 deletions
diff --git a/plugins/metrics/plugin_test.go b/plugins/metrics/plugin_test.go
index 0f0cbfcc..34f5869d 100644
--- a/plugins/metrics/plugin_test.go
+++ b/plugins/metrics/plugin_test.go
@@ -1,12 +1,12 @@
package metrics
-//type testCfg struct {
+// type testCfg struct {
// rpcCfg string
// metricsCfg string
// target string
-//}
+// }
//
-//func (cfg *testCfg) Get(name string) service.Config {
+// func (cfg *testCfg) Get(name string) service.Config {
// if name == ID {
// return &testCfg{target: cfg.metricsCfg}
// }
@@ -16,15 +16,15 @@ package metrics
// }
//
// return nil
-//}
+// }
//
-//func (cfg *testCfg) Unmarshal(out interface{}) error {
+// func (cfg *testCfg) Unmarshal(out interface{}) error {
// j := json.ConfigCompatibleWithStandardLibrary
// err := j.Unmarshal([]byte(cfg.target), out)
// return err
-//}
+// }
//
-//func TestService_Serve(t *testing.T) {
+// func TestService_Serve(t *testing.T) {
// logger, _ := test.NewNullLogger()
// logger.SetLevel(logrus.DebugLevel)
//
@@ -51,9 +51,9 @@ package metrics
// assert.NoError(t, err)
//
// assert.Contains(t, out, "go_gc_duration_seconds")
-//}
+// }
//
-//func Test_ServiceCustomMetric(t *testing.T) {
+// func Test_ServiceCustomMetric(t *testing.T) {
// logger, _ := test.NewNullLogger()
// logger.SetLevel(logrus.DebugLevel)
//
@@ -89,9 +89,9 @@ package metrics
// assert.NoError(t, err)
//
// assert.Contains(t, out, "my_gauge 100")
-//}
+// }
//
-//func Test_ServiceCustomMetricMust(t *testing.T) {
+// func Test_ServiceCustomMetricMust(t *testing.T) {
// logger, _ := test.NewNullLogger()
// logger.SetLevel(logrus.DebugLevel)
//
@@ -127,9 +127,9 @@ package metrics
// assert.NoError(t, err)
//
// assert.Contains(t, out, "my_gauge_2 100")
-//}
+// }
//
-//func Test_ConfiguredMetric(t *testing.T) {
+// func Test_ConfiguredMetric(t *testing.T) {
// logger, _ := test.NewNullLogger()
// logger.SetLevel(logrus.DebugLevel)
//
@@ -167,9 +167,9 @@ package metrics
// assert.NoError(t, err)
//
// assert.Contains(t, out, "user_gauge 100")
-//}
+// }
//
-//func Test_ConfiguredDuplicateMetric(t *testing.T) {
+// func Test_ConfiguredDuplicateMetric(t *testing.T) {
// logger, _ := test.NewNullLogger()
// logger.SetLevel(logrus.DebugLevel)
//
@@ -191,9 +191,9 @@ package metrics
// assert.True(t, s.(*Plugin).Enabled())
//
// assert.Error(t, c.Serve())
-//}
+// }
//
-//func Test_ConfiguredInvalidMetric(t *testing.T) {
+// func Test_ConfiguredInvalidMetric(t *testing.T) {
// logger, _ := test.NewNullLogger()
// logger.SetLevel(logrus.DebugLevel)
//
@@ -211,4 +211,4 @@ package metrics
// }`}))
//
// assert.Error(t, c.Serve())
-//}
+// }
diff --git a/plugins/metrics/rpc_test.go b/plugins/metrics/rpc_test.go
index 9b059fe1..b29ccaec 100644
--- a/plugins/metrics/rpc_test.go
+++ b/plugins/metrics/rpc_test.go
@@ -1,6 +1,6 @@
package metrics
-//import (
+// import (
// "github.com/sirupsen/logrus"
// "github.com/sirupsen/logrus/hooks/test"
// "github.com/spiral/roadrunner/service"
@@ -10,11 +10,11 @@ package metrics
// "strconv"
// "testing"
// "time"
-//)
+// )
//
-//var port = 5004
+// var port = 5004
//
-//func setup(t *testing.T, metric string, portNum string) (*rpc2.Client, service.Container) {
+// func setup(t *testing.T, metric string, portNum string) (*rpc2.Client, service.Container) {
// logger, _ := test.NewNullLogger()
// logger.SetLevel(logrus.DebugLevel)
//
@@ -57,9 +57,9 @@ package metrics
// }
//
// return client, c
-//}
+// }
//
-//func Test_Set_RPC(t *testing.T) {
+// func Test_Set_RPC(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -79,9 +79,9 @@ package metrics
// out, _, err := get("http://localhost:2112/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_gauge 100`)
-//}
+// }
//
-//func Test_Set_RPC_Vector(t *testing.T) {
+// func Test_Set_RPC_Vector(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -103,9 +103,9 @@ package metrics
// out, _, err := get("http://localhost:2113/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_gauge{section="first",type="core"} 100`)
-//}
+// }
//
-//func Test_Set_RPC_CollectorError(t *testing.T) {
+// func Test_Set_RPC_CollectorError(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -124,7 +124,7 @@ package metrics
// }, &ok))
//}
//
-//func Test_Set_RPC_MetricError(t *testing.T) {
+// func Test_Set_RPC_MetricError(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -141,9 +141,9 @@ package metrics
// Value: 100.0,
// Labels: []string{"missing"},
// }, &ok))
-//}
+// }
//
-//func Test_Set_RPC_MetricError_2(t *testing.T) {
+// func Test_Set_RPC_MetricError_2(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -159,9 +159,9 @@ package metrics
// Name: "user_gauge",
// Value: 100.0,
// }, &ok))
-//}
+// }
//
-//func Test_Set_RPC_MetricError_3(t *testing.T) {
+// func Test_Set_RPC_MetricError_3(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -177,11 +177,11 @@ package metrics
// Name: "user_gauge",
// Value: 100.0,
// }, &ok))
-//}
+// }
//
-//// sub
+// // sub
//
-//func Test_Sub_RPC(t *testing.T) {
+// func Test_Sub_RPC(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -207,9 +207,9 @@ package metrics
// out, _, err := get("http://localhost:2118/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_gauge 90`)
-//}
+// }
//
-//func Test_Sub_RPC_Vector(t *testing.T) {
+// func Test_Sub_RPC_Vector(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -238,9 +238,9 @@ package metrics
// out, _, err := get("http://localhost:2119/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_gauge{section="first",type="core"} 90`)
-//}
+// }
//
-//func Test_Register_RPC_Histogram(t *testing.T) {
+// func Test_Register_RPC_Histogram(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -281,9 +281,9 @@ package metrics
// assert.Contains(t, out, `test_histogram_test_histogram_custom_histogram_bucket{le="0.1"} 0`)
// assert.Contains(t, out, `test_histogram_test_histogram_custom_histogram_bucket{le="0.2"} 0`)
// assert.Contains(t, out, `test_histogram_test_histogram_custom_histogram_bucket{le="0.5"} 0`)
-//}
+// }
//
-//func Test_Register_RPC_Gauge(t *testing.T) {
+// func Test_Register_RPC_Gauge(t *testing.T) {
// // FOR register method, setup used just to init the rpc
// client, c := setup(
// t,
@@ -331,9 +331,9 @@ package metrics
// out, _, err := get("http://localhost:2324/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `test_gauge_test_gauge_custom_gauge{section="first",type="core"} 90`)
-//}
+// }
//
-//func Test_Register_RPC_Counter(t *testing.T) {
+// func Test_Register_RPC_Counter(t *testing.T) {
// // FOR register method, setup used just to init the rpc
// client, c := setup(
// t,
@@ -372,9 +372,9 @@ package metrics
// out, _, err := get("http://localhost:2328/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `test_counter_test_counter_custom_counter{section="section2",type="type2"} 100`)
-//}
+// }
//
-//func Test_Register_RPC_Summary(t *testing.T) {
+// func Test_Register_RPC_Summary(t *testing.T) {
// // FOR register method, setup used just to init the rpc
// client, c := setup(
// t,
@@ -414,9 +414,9 @@ package metrics
// assert.NoError(t, err)
// assert.Contains(t, out, `test_summary_test_summary_custom_summary_sum 0`)
// assert.Contains(t, out, `test_summary_test_summary_custom_summary_count 0`)
-//}
+// }
//
-//func Test_Sub_RPC_CollectorError(t *testing.T) {
+// func Test_Sub_RPC_CollectorError(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -433,9 +433,9 @@ package metrics
// Value: 100.0,
// Labels: []string{"missing"},
// }, &ok))
-//}
+// }
//
-//func Test_Sub_RPC_MetricError(t *testing.T) {
+// func Test_Sub_RPC_MetricError(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -452,9 +452,9 @@ package metrics
// Value: 100.0,
// Labels: []string{"missing"},
// }, &ok))
-//}
+// }
//
-//func Test_Sub_RPC_MetricError_2(t *testing.T) {
+// func Test_Sub_RPC_MetricError_2(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -470,9 +470,9 @@ package metrics
// Name: "user_gauge",
// Value: 100.0,
// }, &ok))
-//}
+// }
//
-//func Test_Sub_RPC_MetricError_3(t *testing.T) {
+// func Test_Sub_RPC_MetricError_3(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -488,11 +488,11 @@ package metrics
// Name: "user_gauge",
// Value: 100.0,
// }, &ok))
-//}
+// }
//
-//// -- observe
+// // -- observe
//
-//func Test_Observe_RPC(t *testing.T) {
+// func Test_Observe_RPC(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -512,9 +512,9 @@ package metrics
// out, _, err := get("http://localhost:2124/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_histogram`)
-//}
+// }
//
-//func Test_Observe_RPC_Vector(t *testing.T) {
+// func Test_Observe_RPC_Vector(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -536,9 +536,9 @@ package metrics
// out, _, err := get("http://localhost:2125/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_histogram`)
-//}
+// }
//
-//func Test_Observe_RPC_CollectorError(t *testing.T) {
+// func Test_Observe_RPC_CollectorError(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -555,9 +555,9 @@ package metrics
// Value: 100.0,
// Labels: []string{"missing"},
// }, &ok))
-//}
+// }
//
-//func Test_Observe_RPC_MetricError(t *testing.T) {
+// func Test_Observe_RPC_MetricError(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -574,9 +574,9 @@ package metrics
// Value: 100.0,
// Labels: []string{"missing"},
// }, &ok))
-//}
+// }
//
-//func Test_Observe_RPC_MetricError_2(t *testing.T) {
+// func Test_Observe_RPC_MetricError_2(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -592,11 +592,11 @@ package metrics
// Name: "user_histogram",
// Value: 100.0,
// }, &ok))
-//}
+// }
//
-//// -- observe summary
+// // -- observe summary
//
-//func Test_Observe2_RPC(t *testing.T) {
+// func Test_Observe2_RPC(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -616,9 +616,9 @@ package metrics
// out, _, err := get("http://localhost:2129/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_histogram`)
-//}
+// }
//
-//func Test_Observe2_RPC_Invalid(t *testing.T) {
+// func Test_Observe2_RPC_Invalid(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -634,9 +634,9 @@ package metrics
// Value: 100.0,
// Labels: []string{"missing"},
// }, &ok))
-//}
+// }
//
-//func Test_Observe2_RPC_Invalid_2(t *testing.T) {
+// func Test_Observe2_RPC_Invalid_2(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -653,7 +653,7 @@ package metrics
// }, &ok))
//}
//
-//func Test_Observe2_RPC_Vector(t *testing.T) {
+// func Test_Observe2_RPC_Vector(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -675,9 +675,9 @@ package metrics
// out, _, err := get("http://localhost:2132/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_histogram`)
-//}
+// }
//
-//func Test_Observe2_RPC_CollectorError(t *testing.T) {
+// func Test_Observe2_RPC_CollectorError(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -694,9 +694,9 @@ package metrics
// Value: 100.0,
// Labels: []string{"missing"},
// }, &ok))
-//}
+// }
//
-//func Test_Observe2_RPC_MetricError(t *testing.T) {
+// func Test_Observe2_RPC_MetricError(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -713,9 +713,9 @@ package metrics
// Value: 100.0,
// Labels: []string{"missing"},
// }, &ok))
-//}
+// }
//
-//func Test_Observe2_RPC_MetricError_2(t *testing.T) {
+// func Test_Observe2_RPC_MetricError_2(t *testing.T) {
// client, c := setup(
// t,
// `"user_histogram":{
@@ -731,10 +731,10 @@ package metrics
// Name: "user_histogram",
// Value: 100.0,
// }, &ok))
-//}
+// }
//
-//// add
-//func Test_Add_RPC(t *testing.T) {
+// // add
+// func Test_Add_RPC(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -754,9 +754,9 @@ package metrics
// out, _, err := get("http://localhost:2136/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_gauge 100`)
-//}
+// }
//
-//func Test_Add_RPC_Vector(t *testing.T) {
+// func Test_Add_RPC_Vector(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -778,9 +778,9 @@ package metrics
// out, _, err := get("http://localhost:2137/metrics")
// assert.NoError(t, err)
// assert.Contains(t, out, `user_gauge{section="first",type="core"} 100`)
-//}
+// }
//
-//func Test_Add_RPC_CollectorError(t *testing.T) {
+// func Test_Add_RPC_CollectorError(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -799,9 +799,9 @@ package metrics
// }, &ok))
//
// assert.False(t, ok)
-//}
+// }
//
-//func Test_Add_RPC_MetricError(t *testing.T) {
+// func Test_Add_RPC_MetricError(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -820,9 +820,9 @@ package metrics
// }, &ok))
//
// assert.False(t, ok)
-//}
+// }
//
-//func Test_Add_RPC_MetricError_2(t *testing.T) {
+// func Test_Add_RPC_MetricError_2(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -840,9 +840,9 @@ package metrics
// }, &ok))
//
// assert.False(t, ok)
-//}
+// }
//
-//func Test_Add_RPC_MetricError_3(t *testing.T) {
+// func Test_Add_RPC_MetricError_3(t *testing.T) {
// client, c := setup(
// t,
// `"user_gauge":{
@@ -858,4 +858,4 @@ package metrics
// Name: "user_gauge",
// Value: 100.0,
// }, &ok))
-//}
+// }
diff --git a/plugins/metrics/tests/plugin1.go b/plugins/metrics/tests/plugin1.go
index 345a3ec6..8f1ece52 100644
--- a/plugins/metrics/tests/plugin1.go
+++ b/plugins/metrics/tests/plugin1.go
@@ -38,7 +38,7 @@ func (p1 *Plugin1) MetricsCollector() prometheus.Collector {
return collector
}
-////////////////////////////////////////////////////////////////
+// //////////////////////////////////////////////////////////////
type Plugin3 struct {
config config.Configurer
}
diff --git a/plugins/metrics/tests/plugin2.go b/plugins/metrics/tests/plugin2.go
index 4369971b..5d36b729 100644
--- a/plugins/metrics/tests/plugin2.go
+++ b/plugins/metrics/tests/plugin2.go
@@ -14,26 +14,26 @@ func (p2 *Plugin2) Serve() chan error {
errCh := make(chan error, 1)
go func() {
- //time.Sleep(time.Second * 3)
+ // time.Sleep(time.Second * 3)
//
- //conn, err := net.Dial("tcp", "127.0.0.1:6001")
- //if err != nil {
+ // conn, err := net.Dial("tcp", "127.0.0.1:6001")
+ // if err != nil {
// errCh <- errors.E(errors.Serve, err)
// return
- //}
- //client := rpc.NewClientWithCodec(goridge.NewClientCodec(conn))
- //var ret string
- //err = client.Call("metrics_test.plugin1.Hello", "Valery", &ret)
- //if err != nil {
+ // }
+ // client := rpc.NewClientWithCodec(goridge.NewClientCodec(conn))
+ // var ret string
+ // err = client.Call("metrics_test.plugin1.Hello", "Valery", &ret)
+ // if err != nil {
// errCh <- err
// return
- //}
- //if ret != "Hello, username: Valery" {
+ // }
+ // if ret != "Hello, username: Valery" {
// errCh <- errors.E("wrong response")
// return
- //}
- //// to stop exec
- //errCh <- errors.E(errors.Disabled)
+ // }
+ // // to stop exec
+ // errCh <- errors.E(errors.Disabled)
return
}()