From b91045e0a851b7d774728daf4a1d913208e258b6 Mon Sep 17 00:00:00 2001 From: "xiaolong.ran" Date: Tue, 12 May 2020 15:22:54 +0800 Subject: [PATCH 1/3] Fix go functions metrics Signed-off-by: xiaolong.ran --- pulsar-function-go/pf/instance.go | 51 ++----- pulsar-function-go/pf/stats.go | 177 ++++++++++++------------- pulsar-function-go/pf/stats_test.go | 198 ++++++++++++---------------- 3 files changed, 179 insertions(+), 247 deletions(-) diff --git a/pulsar-function-go/pf/instance.go b/pulsar-function-go/pf/instance.go index f1c600c5042a2..617daf0415e25 100644 --- a/pulsar-function-go/pf/instance.go +++ b/pulsar-function-go/pf/instance.go @@ -28,9 +28,10 @@ import ( "github.com/golang/protobuf/ptypes/empty" "github.com/apache/pulsar-client-go/pulsar" + log "github.com/apache/pulsar/pulsar-function-go/logutil" pb "github.com/apache/pulsar/pulsar-function-go/pb" - io_prometheus_client "github.com/prometheus/client_model/go" + prometheus_client "github.com/prometheus/client_model/go" ) type goInstance struct { @@ -162,11 +163,9 @@ CLOSE: return err } + gi.stats.processTimeEnd() gi.processResult(msgInput, output) - - gi.stats.processTimeEnd() // Should this be called here or before processResult(..)? gi.stats.incrTotalProcessedSuccessfully() - case <-idleTimer.C: close(channel) break CLOSE @@ -470,15 +469,6 @@ func (gi *goInstance) getMetrics() *pb.MetricsData { metricsData.ProcessedSuccessfullyTotal_1Min = int64(totalProcessedSuccessfully1min) metricsData.SystemExceptionsTotal_1Min = int64(totalSysExceptions1min) metricsData.UserExceptionsTotal_1Min = int64(totalUserExceptions1min) - //metrics_data.AvgProcessLatency_1Min = avg_process_latency_ms_1min - - // get any user metrics - // Not sure yet where these are stored. - /* - user_metrics := self.contextimpl.get_metrics() - for metric_name, value in user_metrics.items(): - metrics_data.userMetrics[metric_name] = value - */ return &metricsData } @@ -496,30 +486,28 @@ func (gi *goInstance) resetMetrics() *empty.Empty { // This method is used to get the required metrics for Prometheus. // Note that this doesn't distinguish between parallel function instances! -func (gi *goInstance) getMatchingMetricFunc() func(lbl *io_prometheus_client.LabelPair) bool { - matchMetricFunc := func(lbl *io_prometheus_client.LabelPair) bool { +func (gi *goInstance) getMatchingMetricFunc() func(lbl *prometheus_client.LabelPair) bool { + matchMetricFunc := func(lbl *prometheus_client.LabelPair) bool { return *lbl.Name == "fqfn" && *lbl.Value == gi.context.GetTenantAndNamespaceAndName() } return matchMetricFunc } -// e.g. metricName = "pulsar_function_process_latency_ms" -func (gi *goInstance) getMatchingMetricFromRegistry(metricName string) io_prometheus_client.Metric { +func (gi *goInstance) getMatchingMetricFromRegistry(metricName string) prometheus_client.Metric { metricFamilies, err := reg.Gather() if err != nil { - log.Error("Something went wrong when calling reg.Gather() in getMatchingMetricFromRegistry(..) for " + metricName) + log.Errorf("Something went wrong when calling reg.Gather() in getMatchingMetricFromRegistry(..) for metricName: %s", metricName) } - matchFamilyFunc := func(vect *io_prometheus_client.MetricFamily) bool { + matchFamilyFunc := func(vect *prometheus_client.MetricFamily) bool { return *vect.Name == metricName } - fiteredMetricFamilies := filter(metricFamilies, matchFamilyFunc) - if len(fiteredMetricFamilies) > 1 { + filteredMetricFamilies := filter(metricFamilies, matchFamilyFunc) + if len(filteredMetricFamilies) > 1 { // handle this. - log.Error("Too many metric families for metricName = " + metricName) - // Should we panic here instead of report an error since it reflects a code problem, not a user problem? + log.Errorf("Too many metric families for metricName: %s " + metricName) } metricFunc := gi.getMatchingMetricFunc() - matchingMetric := getFirstMatch(fiteredMetricFamilies[0].Metric, metricFunc) + matchingMetric := getFirstMatch(filteredMetricFamilies[0].Metric, metricFunc) return *matchingMetric } @@ -529,12 +517,14 @@ func (gi *goInstance) getTotalReceived() float32 { val := metric.GetGauge().Value return float32(*val) } + func (gi *goInstance) getTotalProcessedSuccessfully() float32 { metric := gi.getMatchingMetricFromRegistry(PulsarFunctionMetricsPrefix + TotalSuccessfullyProcessed) // "pulsar_function_" + "processed_successfully_total", NewGaugeVec. val := metric.GetGauge().Value return float32(*val) } + func (gi *goInstance) getTotalSysExceptions() float32 { metric := gi.getMatchingMetricFromRegistry(PulsarFunctionMetricsPrefix + TotalSystemExceptions) // "pulsar_function_"+ "system_exceptions_total", NewGaugeVec. @@ -588,19 +578,6 @@ func (gi *goInstance) getTotalUserExceptions1min() float32 { return float32(*val) } -/* -func (gi *goInstance) get_avg_process_latency_1min() float32 { - metric := gi.getMatchingMetricFromRegistry(PULSAR_FUNCTION_METRICS_PREFIX + PROCESS_LATENCY_MS_1min) - // "pulsar_function_" + "process_latency_ms_1min", SummaryVec - count := metric.GetSummary().SampleCount - sum := metric.GetSummary().SampleSum - if *count <= 0.0 { - return 0.0 - } else { - return float32(*sum) / float32(*count) - } -}*/ - func (gi *goInstance) getTotalReceived1min() float32 { metric := gi.getMatchingMetricFromRegistry(PulsarFunctionMetricsPrefix + TotalReceived1min) // "pulsar_function_" + "received_total_1min", GaugeVec diff --git a/pulsar-function-go/pf/stats.go b/pulsar-function-go/pf/stats.go index fde52f8c40ac5..2d8f15baa85f5 100644 --- a/pulsar-function-go/pf/stats.go +++ b/pulsar-function-go/pf/stats.go @@ -24,15 +24,15 @@ import ( "time" "github.com/prometheus/client_golang/prometheus" - io_prometheus_client "github.com/prometheus/client_model/go" - //"strings" - //"github.com/prometheus/common/expfmt" - //"time" + + prometheus_client "github.com/prometheus/client_model/go" ) -var metricsLabelNames = []string{"tenant", "namespace", "name", "instance_id", "cluster", "fqfn"} -var exceptionLabelNames = []string{"error", "ts"} -var exceptionMetricsLabelNames = append(metricsLabelNames, exceptionLabelNames...) +var ( + metricsLabelNames = []string{"tenant", "namespace", "name", "instance_id", "cluster", "fqfn"} + exceptionLabelNames = []string{"error", "ts"} + exceptionMetricsLabelNames = append(metricsLabelNames, exceptionLabelNames...) +) const ( PulsarFunctionMetricsPrefix = "pulsar_function_" @@ -52,73 +52,74 @@ const ( ) // Declare Prometheus -var statTotalProcessedSuccessfully = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + TotalSuccessfullyProcessed, - Help: "Total number of messages processed successfully."}, - metricsLabelNames) -var statTotalSysExceptions = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + TotalSystemExceptions, - Help: "Total number of system exceptions."}, - metricsLabelNames) -var statTotalUserExceptions = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + TotalUserExceptions, - Help: "Total number of user exceptions."}, - metricsLabelNames) - -var statProcessLatencyMs = prometheus.NewSummaryVec( - prometheus.SummaryOpts{ - Name: PulsarFunctionMetricsPrefix + ProcessLatencyMs, - Help: "Process latency in milliseconds."}, metricsLabelNames) - -var statLastInvocation = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + LastInvocation, - Help: "The timestamp of the last invocation of the function."}, metricsLabelNames) - -var statTotalReceived = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + TotalReceived, - Help: "Total number of messages received from source."}, metricsLabelNames) - -// 1min windowed metrics -var statTotalProcessedSuccessfully1min = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + TotalSuccessfullyProcessed1min, - Help: "Total number of messages processed successfully in the last 1 minute."}, metricsLabelNames) -var statTotalSysExceptions1min = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + TotalSystemExceptions1min, - Help: "Total number of system exceptions in the last 1 minute."}, - metricsLabelNames) -var statTotalUserExceptions1min = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + TotalUserExceptions1min, - Help: "Total number of user exceptions in the last 1 minute."}, - metricsLabelNames) - -var statProcessLatencyMs1min = prometheus.NewSummaryVec( - prometheus.SummaryOpts{ - Name: PulsarFunctionMetricsPrefix + ProcessLatencyMs1min, - Help: "Process latency in milliseconds in the last 1 minute."}, metricsLabelNames) - -var statTotalReceived1min = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + TotalReceived1min, - Help: "Total number of messages received from source in the last 1 minute."}, metricsLabelNames) - -// exceptions -var userExceptions = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + "user_exception", - Help: "Exception from user code."}, exceptionMetricsLabelNames) - -var systemExceptions = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: PulsarFunctionMetricsPrefix + "system_exception", - Help: "Exception from system code."}, exceptionMetricsLabelNames) +var ( + statTotalProcessedSuccessfully = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + TotalSuccessfullyProcessed, + Help: "Total number of messages processed successfully."}, + metricsLabelNames) + statTotalSysExceptions = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + TotalSystemExceptions, + Help: "Total number of system exceptions."}, + metricsLabelNames) + statTotalUserExceptions = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + TotalUserExceptions, + Help: "Total number of user exceptions."}, + metricsLabelNames) + + statProcessLatencyMs = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Name: PulsarFunctionMetricsPrefix + ProcessLatencyMs, + Help: "Process latency in milliseconds."}, metricsLabelNames) + + statLastInvocation = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + LastInvocation, + Help: "The timestamp of the last invocation of the function."}, metricsLabelNames) + + statTotalReceived = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + TotalReceived, + Help: "Total number of messages received from source."}, metricsLabelNames) + + // 1min windowed metrics + statTotalProcessedSuccessfully1min = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + TotalSuccessfullyProcessed1min, + Help: "Total number of messages processed successfully in the last 1 minute."}, metricsLabelNames) + statTotalSysExceptions1min = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + TotalSystemExceptions1min, + Help: "Total number of system exceptions in the last 1 minute."}, + metricsLabelNames) + statTotalUserExceptions1min = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + TotalUserExceptions1min, + Help: "Total number of user exceptions in the last 1 minute."}, + metricsLabelNames) + + statProcessLatencyMs1min = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Name: PulsarFunctionMetricsPrefix + ProcessLatencyMs1min, + Help: "Process latency in milliseconds in the last 1 minute."}, metricsLabelNames) + + statTotalReceived1min = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + TotalReceived1min, + Help: "Total number of messages received from source in the last 1 minute."}, metricsLabelNames) + + userExceptions = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + "user_exception", + Help: "Exception from user code."}, exceptionMetricsLabelNames) + + systemExceptions = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: PulsarFunctionMetricsPrefix + "system_exception", + Help: "Exception from system code."}, exceptionMetricsLabelNames) +) var reg *prometheus.Registry @@ -156,12 +157,11 @@ type StatWithLabelValues struct { statTotalProcessedSuccessfully1min prometheus.Gauge statTotalSysExceptions1min prometheus.Gauge statTotalUserExceptions1min prometheus.Gauge - //_stat_process_latency_ms_1min prometheus.Observer - statTotalReceived1min prometheus.Gauge - latestUserException []LatestException - latestSysException []LatestException - processStartTime int64 - metricsLabels []string + statTotalReceived1min prometheus.Gauge + latestUserException []LatestException + latestSysException []LatestException + processStartTime int64 + metricsLabels []string } func NewStatWithLabelValues(metricsLabels ...string) StatWithLabelValues { @@ -188,7 +188,6 @@ func NewStatWithLabelValues(metricsLabels ...string) StatWithLabelValues { statTotalProcessedSuccessfully1min, statTotalSysExceptions1min, statTotalUserExceptions1min, - //_stat_process_latency_ms_1min, statTotalReceived1min, []LatestException{}, []LatestException{}, @@ -199,8 +198,8 @@ func NewStatWithLabelValues(metricsLabels ...string) StatWithLabelValues { } func filter( - ss []*io_prometheus_client.MetricFamily, - test func(*io_prometheus_client.MetricFamily) bool) (ret []*io_prometheus_client.MetricFamily) { + ss []*prometheus_client.MetricFamily, + test func(*prometheus_client.MetricFamily) bool) (ret []*prometheus_client.MetricFamily) { for _, s := range ss { if test(s) { ret = append(ret, s) @@ -210,8 +209,8 @@ func filter( } func getFirstMatch( - metrics []*io_prometheus_client.Metric, - test func(*io_prometheus_client.LabelPair) bool) *io_prometheus_client.Metric { + metrics []*prometheus_client.Metric, + test func(*prometheus_client.LabelPair) bool) *prometheus_client.Metric { for _, met := range metrics { for _, lbl := range met.Label { if test(lbl) { @@ -237,7 +236,6 @@ func (stat *StatWithLabelValues) processTimeEnd() { now := time.Now() duration := now.UnixNano() - stat.processStartTime stat.statProcessLatencyMs.Observe(float64(duration)) - //stat._stat_process_latency_ms_1min.Observe(float64(duration)) } } @@ -305,12 +303,5 @@ func (stat *StatWithLabelValues) reset() { stat.statTotalProcessedSuccessfully1min.Set(0.0) stat.statTotalUserExceptions1min.Set(0.0) stat.statTotalSysExceptions1min.Set(0.0) - //stat._stat_process_latency_ms_1min._sum.set(0.0) - //stat._stat_process_latency_ms_1min._count.set(0.0) stat.statTotalReceived1min.Set(0.0) } - -/* -// start time for windowed metrics -util.FixedTimer(60, reset, name="windowed-metrics-timer").start() -*/ diff --git a/pulsar-function-go/pf/stats_test.go b/pulsar-function-go/pf/stats_test.go index c79c4940bd106..8b27aaae7a3c9 100644 --- a/pulsar-function-go/pf/stats_test.go +++ b/pulsar-function-go/pf/stats_test.go @@ -20,48 +20,16 @@ package pf import ( - "fmt" "math" "testing" "github.com/golang/protobuf/proto" "github.com/prometheus/client_golang/prometheus" - io_prometheus_client "github.com/prometheus/client_model/go" "github.com/stretchr/testify/assert" + + prometheus_client "github.com/prometheus/client_model/go" ) -/*func test(){ - var metrics_label_names = []string{"tenant", "namespace", "name", "instance_id", "cluster", "fqfn"} - var exception_label_names = []string{"error", "ts"} - var exception_metrics_label_names = append(metrics_label_names, exception_label_names...) - var stat_process_latency_ms = prometheus.NewSummaryVec( - prometheus.SummaryOpts{ - Name: PULSAR_FUNCTION_METRICS_PREFIX + PROCESS_LATENCY_MS, - Help: "Process latency in milliseconds."}, metrics_label_names) - var reg *prometheus.Registry - reg = prometheus.NewRegistry() - reg.MustRegister(stat_process_latency_ms) - metrics_labels := []string{"test-tenant","test-tenant/test-namespace", "test-name", "1234", "test-cluster", - "test-tenant/test-namespace/test-name"} - // 1234 is instanceId - // ['test-tenant', 'test-tenant/test-namespace', 'test-name',1234, - // 'test-cluster', 'test-tenant/test-namespace/test-name'] - //var _stat_process_latency_ms = stat_process_latency_ms.WithLabelValues(metrics_labels...) - //process_latency_ms_count := stat._stat_process_latency_ms._count.get() - //process_latency_ms_sum := stat._stat_process_latency_ms._sum.get() -} -func (stat *StatWithLabelValues) getTotalReceived() float32 { - gathering, _ := reg.Gather() - out := &bytes.Buffer{} - for _, mf := range gathering { - if _, err := expfmt.MetricFamilyToText(out, mf); err != nil { - panic(err) - } - } - fmt.Print(out.String()) - fmt.Println("----------") -} -*/ func TestExampleSummaryVec(t *testing.T) { temps := prometheus.NewSummaryVec( @@ -89,93 +57,89 @@ func TestExampleSummaryVec(t *testing.T) { metricFamilies, err := reg.Gather() if err != nil || len(metricFamilies) != 1 { - panic("unexpected behavior of custom test registry") + t.Fatal("unexpected behavior of custom test registry") } - match := func(vect *io_prometheus_client.MetricFamily) bool { + match := func(vect *prometheus_client.MetricFamily) bool { return *vect.Name == "pond_temperature_celsius" } - fiteredMetricFamilies := filter(metricFamilies, match) + filteredMetricFamilies := filter(metricFamilies, match) - if len(fiteredMetricFamilies) > 1 { - panic("Too many metric families") + if len(filteredMetricFamilies) > 1 { + t.Fatal("Too many metric families") } // Then, we need to filter the metrics in the family to one that matches our label. - - fmt.Println(proto.MarshalTextString(metricFamilies[0])) - - // Output: - // name: "pond_temperature_celsius" - // help: "The temperature of the frog pond." - // type: SUMMARY - // metric: < - // label: < - // name: "species" - // value: "leiopelma-hochstetteri" - // > - // summary: < - // sample_count: 0 - // sample_sum: 0 - // quantile: < - // quantile: 0.5 - // value: nan - // > - // quantile: < - // quantile: 0.9 - // value: nan - // > - // quantile: < - // quantile: 0.99 - // value: nan - // > - // > - // > - // metric: < - // label: < - // name: "species" - // value: "lithobates-catesbeianus" - // > - // summary: < - // sample_count: 1000 - // sample_sum: 31956.100000000017 - // quantile: < - // quantile: 0.5 - // value: 32.4 - // > - // quantile: < - // quantile: 0.9 - // value: 41.4 - // > - // quantile: < - // quantile: 0.99 - // value: 41.9 - // > - // > - // > - // metric: < - // label: < - // name: "species" - // value: "litoria-caerulea" - // > - // summary: < - // sample_count: 1000 - // sample_sum: 29969.50000000001 - // quantile: < - // quantile: 0.5 - // value: 31.1 - // > - // quantile: < - // quantile: 0.9 - // value: 41.3 - // > - // quantile: < - // quantile: 0.99 - // value: 41.9 - // > - // > - // > + expectedValue:="name: \"pond_temperature_celsius\"\n" + + "help: \"The temperature of the frog pond.\"\n" + + "type: SUMMARY\n" + + "metric: <\n" + + " label: <\n" + + " name: \"species\"\n" + + " value: \"leiopelma-hochstetteri\"\n" + + " >\n" + + " summary: <\n" + + " sample_count: 0\n" + + " sample_sum: 0\n" + + " quantile: <\n" + + " quantile: 0.5\n" + + " value: nan\n" + + " >\n" + + " quantile: <\n" + + " quantile: 0.9\n" + + " value: nan\n" + + " >\n" + + " quantile: <\n" + + " quantile: 0.99\n" + + " value: nan\n" + + " >\n" + + " >\n" + + ">\n" + + "metric: <\n" + + " label: <\n" + + " name: \"species\"\n" + + " value: \"lithobates-catesbeianus\"\n" + + " >\n" + + " summary: <\n" + + " sample_count: 1000\n" + + " sample_sum: 31956.100000000017\n" + + " quantile: <\n" + + " quantile: 0.5\n" + + " value: 32.4\n" + + " >\n" + + " quantile: <\n" + + " quantile: 0.9\n" + + " value: 41.4\n" + + " >\n" + + " quantile: <\n" + + " quantile: 0.99\n" + + " value: 41.9\n" + + " >\n" + + " >\n" + + ">\n" + + "metric: <\n" + + " label: <\n" + + " name: \"species\"\n" + + " value: \"litoria-caerulea\"\n" + + " >\n" + + " summary: <\n" + + " sample_count: 1000\n" + + " sample_sum: 29969.50000000001\n" + + " quantile: <\n" + + " quantile: 0.5\n" + + " value: 31.1\n" + + " >\n" + + " quantile: <\n" + + " quantile: 0.9\n" + + " value: 41.3\n" + + " >\n" + + " quantile: <\n" + + " quantile: 0.99\n" + + " value: 41.9\n" + + " >\n" + + " >\n" + + ">\n" + assert.Equal(t, expectedValue, proto.MarshalTextString(metricFamilies[0])) } func TestExampleSummaryVec_Pulsar(t *testing.T) { - _statProcessLatencyMs1 := prometheus.NewSummaryVec( prometheus.SummaryOpts{ Name: "pulsar_function_process_latency_ms", @@ -200,18 +164,18 @@ func TestExampleSummaryVec_Pulsar(t *testing.T) { metricFamilies, err := reg.Gather() if err != nil || len(metricFamilies) != 1 { - panic("unexpected behavior of custom test registry") + t.Fatal("unexpected behavior of custom test registry") } - matchFamilyFunc := func(vect *io_prometheus_client.MetricFamily) bool { + matchFamilyFunc := func(vect *prometheus_client.MetricFamily) bool { return *vect.Name == "pulsar_function_process_latency_ms" } fiteredMetricFamilies := filter(metricFamilies, matchFamilyFunc) if len(fiteredMetricFamilies) > 1 { - panic("Too many metric families") + t.Fatal("Too many metric families") } // Then, we need to filter the metrics in the family to one that matches our label. // *lbl.Name == "fqfn" && *lbl.Value == fqfn - matchMetricFunc := func(lbl *io_prometheus_client.LabelPair) bool { + matchMetricFunc := func(lbl *prometheus_client.LabelPair) bool { return *lbl.Name == "fqfn" && *lbl.Value == "test-tenant/test-namespace/test-name" } matchingMetric := getFirstMatch(fiteredMetricFamilies[0].Metric, matchMetricFunc) From 56c5955157b9c11c46ea0b45588805a454229be7 Mon Sep 17 00:00:00 2001 From: "xiaolong.ran" Date: Tue, 12 May 2020 15:27:39 +0800 Subject: [PATCH 2/3] fix a little Signed-off-by: xiaolong.ran --- pulsar-function-go/pf/stats_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pulsar-function-go/pf/stats_test.go b/pulsar-function-go/pf/stats_test.go index 8b27aaae7a3c9..f4e3bb2506ce4 100644 --- a/pulsar-function-go/pf/stats_test.go +++ b/pulsar-function-go/pf/stats_test.go @@ -68,7 +68,7 @@ func TestExampleSummaryVec(t *testing.T) { t.Fatal("Too many metric families") } // Then, we need to filter the metrics in the family to one that matches our label. - expectedValue:="name: \"pond_temperature_celsius\"\n" + + expectedValue := "name: \"pond_temperature_celsius\"\n" + "help: \"The temperature of the frog pond.\"\n" + "type: SUMMARY\n" + "metric: <\n" + From 41ccb61f0e5bc63ad6959d660f50cf083d77363b Mon Sep 17 00:00:00 2001 From: "xiaolong.ran" Date: Tue, 12 May 2020 15:40:21 +0800 Subject: [PATCH 3/3] fix ci error Signed-off-by: xiaolong.ran --- pulsar-function-go/pf/instance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pulsar-function-go/pf/instance.go b/pulsar-function-go/pf/instance.go index 617daf0415e25..3453322c54426 100644 --- a/pulsar-function-go/pf/instance.go +++ b/pulsar-function-go/pf/instance.go @@ -496,7 +496,7 @@ func (gi *goInstance) getMatchingMetricFunc() func(lbl *prometheus_client.LabelP func (gi *goInstance) getMatchingMetricFromRegistry(metricName string) prometheus_client.Metric { metricFamilies, err := reg.Gather() if err != nil { - log.Errorf("Something went wrong when calling reg.Gather() in getMatchingMetricFromRegistry(..) for metricName: %s", metricName) + log.Errorf("Something went wrong when calling reg.Gather(), the metricName is: %s", metricName) } matchFamilyFunc := func(vect *prometheus_client.MetricFamily) bool { return *vect.Name == metricName