Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pulsar-function-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.25.0

require (
github.com/apache/pulsar-client-go v0.20.0
github.com/golang/protobuf v1.5.4
github.com/prometheus/client_golang v1.20.5
github.com/prometheus/client_model v0.6.1
github.com/sirupsen/logrus v1.9.3
Expand Down
8 changes: 3 additions & 5 deletions pulsar-function-go/pf/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ import (
"strings"
"time"

"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"
prometheus_client "github.com/prometheus/client_model/go"
"google.golang.org/protobuf/types/known/emptypb"
)

type goInstance struct {
Expand Down Expand Up @@ -648,9 +646,9 @@ func (gi *goInstance) getAndResetMetrics() *pb.MetricsData {
return metricsData
}

func (gi *goInstance) resetMetrics() *empty.Empty {
func (gi *goInstance) resetMetrics() *emptypb.Empty {
gi.stats.reset()
return &empty.Empty{}
return &emptypb.Empty{}
}

// This method is used to get the required metrics for Prometheus.
Expand Down
6 changes: 3 additions & 3 deletions pulsar-function-go/pf/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (
"testing"
"time"

"github.com/golang/protobuf/ptypes/empty"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/types/known/emptypb"

prometheus_client "github.com/prometheus/client_model/go"
)
Expand Down Expand Up @@ -196,7 +196,7 @@ func TestInstanceControlMetrics(t *testing.T) {
instance := newGoInstance()
t.Cleanup(instance.close)
instanceClient := instanceCommunicationClient(t, instance)
_, err := instanceClient.GetMetrics(context.Background(), &empty.Empty{})
_, err := instanceClient.GetMetrics(context.Background(), &emptypb.Empty{})
assert.NoError(t, err, "err communicating with instance control: %v", err)

testLabels := []string{"userMetricControlTest1", "userMetricControlTest2"}
Expand All @@ -209,7 +209,7 @@ func TestInstanceControlMetrics(t *testing.T) {
}
time.Sleep(time.Second)

metrics, err := instanceClient.GetMetrics(context.Background(), &empty.Empty{})
metrics, err := instanceClient.GetMetrics(context.Background(), &emptypb.Empty{})
assert.NoError(t, err, "err communicating with instance control: %v", err)
for value, label := range testLabels {
assert.Containsf(t, metrics.UserMetrics, label, "user metrics should contain metric %s", label)
Expand Down
Loading