Skip to content

Commit

Permalink
collector: fix invalid memory address or nil pointer panic
Browse files Browse the repository at this point in the history
github.com/gogo/protobuf/proto.makeOneOfMarshaler.func1
github.com/gogo/protobuf@v1.3.2/proto/table_marshal.go:2598
  • Loading branch information
fanyang89 committed Nov 10, 2023
1 parent ce27300 commit c049108
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tcpmon/collector/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/cockroachdb/errors"
"github.com/gogo/protobuf/proto"
"google.golang.org/protobuf/proto"

"github.com/zperf/tcpmon/tcpmon/gproto"
"github.com/zperf/tcpmon/tcpmon/parsing"
Expand Down Expand Up @@ -35,6 +35,7 @@ func (m *NetstatCollector) Collect(now time.Time) ([]byte, error) {
func (m *NetstatCollector) doCollect(now time.Time) (*gproto.NetstatMetric, error) {
var metric gproto.NetstatMetric
metric.Timestamp = now.Unix()
metric.Type = gproto.MetricType_NET

err := CollectProc("snmp", &metric)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tcpmon/collector/nic.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/cockroachdb/errors"
"github.com/go-cmd/cmd"
"github.com/gogo/protobuf/proto"
"google.golang.org/protobuf/proto"

"github.com/zperf/tcpmon/tcpmon/gproto"
"github.com/zperf/tcpmon/tcpmon/parsing"
Expand Down
2 changes: 1 addition & 1 deletion tcpmon/collector/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/cockroachdb/errors"
"github.com/go-cmd/cmd"
"github.com/gogo/protobuf/proto"
"google.golang.org/protobuf/proto"

"github.com/zperf/tcpmon/tcpmon/gproto"
"github.com/zperf/tcpmon/tcpmon/parsing"
Expand Down

0 comments on commit c049108

Please sign in to comment.