From 51be17a6efd9f1bcd65e4d7228f49c2da9f231f5 Mon Sep 17 00:00:00 2001 From: WangGuan Date: Tue, 30 May 2023 20:04:52 +0800 Subject: [PATCH] fix: format imports in metrics module --- metrics/prometheus/after_invocation.go | 5 +++++ metrics/prometheus/api.go | 3 ++- metrics/prometheus/common.go | 7 ++++++- metrics/prometheus/metric_set.go | 7 ++++++- metrics/prometheus/reporter.go | 4 ++++ metrics/prometheus/reporter_test.go | 5 +++++ metrics/reporter.go | 2 ++ 7 files changed, 30 insertions(+), 3 deletions(-) diff --git a/metrics/prometheus/after_invocation.go b/metrics/prometheus/after_invocation.go index eed549da70..62e05016fe 100644 --- a/metrics/prometheus/after_invocation.go +++ b/metrics/prometheus/after_invocation.go @@ -20,10 +20,15 @@ package prometheus import ( "context" "time" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" +) + +import ( "github.com/dubbogo/gost/log/logger" "github.com/prometheus/client_golang/prometheus" ) diff --git a/metrics/prometheus/api.go b/metrics/prometheus/api.go index eba61e17a4..5fcdd7b872 100644 --- a/metrics/prometheus/api.go +++ b/metrics/prometheus/api.go @@ -19,7 +19,8 @@ package prometheus import ( "sync" - +) +import ( "github.com/prometheus/client_golang/prometheus" ) diff --git a/metrics/prometheus/common.go b/metrics/prometheus/common.go index 8936e67299..2745b54ed2 100644 --- a/metrics/prometheus/common.go +++ b/metrics/prometheus/common.go @@ -21,10 +21,15 @@ import ( "strconv" "strings" "time" +) +import ( + "github.com/prometheus/client_golang/prometheus" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "github.com/prometheus/client_golang/prometheus" ) // isProvider shows whether this url represents the application received the request as server diff --git a/metrics/prometheus/metric_set.go b/metrics/prometheus/metric_set.go index 14e16b77d8..cf0f1477b9 100644 --- a/metrics/prometheus/metric_set.go +++ b/metrics/prometheus/metric_set.go @@ -19,11 +19,16 @@ package prometheus import ( "strings" +) - "dubbo.apache.org/dubbo-go/v3/metrics" +import ( "github.com/prometheus/client_golang/prometheus" ) +import ( + "dubbo.apache.org/dubbo-go/v3/metrics" +) + // metricSet is a set of metrics that are reported to prometheus in dubbo go type metricSet struct { // report the consumer-side's rt gauge data diff --git a/metrics/prometheus/reporter.go b/metrics/prometheus/reporter.go index dc55ac1ff3..96b7996407 100644 --- a/metrics/prometheus/reporter.go +++ b/metrics/prometheus/reporter.go @@ -21,11 +21,15 @@ import ( "context" "net/http" "sync" +) +import ( ocprom "contrib.go.opencensus.io/exporter/prometheus" "github.com/dubbogo/gost/log/logger" "github.com/prometheus/client_golang/prometheus" +) +import ( "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/metrics" ) diff --git a/metrics/prometheus/reporter_test.go b/metrics/prometheus/reporter_test.go index d48d92f137..af3def4028 100644 --- a/metrics/prometheus/reporter_test.go +++ b/metrics/prometheus/reporter_test.go @@ -21,12 +21,17 @@ import ( "context" "testing" "time" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/metrics" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" +) + +import ( "github.com/stretchr/testify/assert" ) diff --git a/metrics/reporter.go b/metrics/reporter.go index 4a016e39c7..9439f02c20 100644 --- a/metrics/reporter.go +++ b/metrics/reporter.go @@ -20,7 +20,9 @@ package metrics import ( "context" "time" +) +import ( "dubbo.apache.org/dubbo-go/v3/protocol" )