Skip to content

Commit

Permalink
Merge branch 'main' into mtls-exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsxGitHub authored Oct 7, 2024
2 parents 4ae6df6 + 1823db6 commit e5395e8
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 48 deletions.
4 changes: 4 additions & 0 deletions go.yml → .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ on:
jobs:
go:
uses: openconfig/common-ci/.github/workflows/basic_go.yml@125b6b58286d116b216e45c33cb859f547965d61
with:
tests-excludes-regex: integration
race-tests-excludes-regex: integration
coverage-excludes-regex: integration
4 changes: 2 additions & 2 deletions gnmi/gnmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
ompb "go.opentelemetry.io/proto/otlp/metrics/v1"
anypb "google.golang.org/protobuf/types/known/anypb"

"github.com/golang/protobuf/proto"
"github.com/openconfig/magna/lwotgtelem"
"github.com/openconfig/magna/lwotgtelem/gnmit"
"go.opentelemetry.io/collector/component"
Expand All @@ -33,6 +32,7 @@ import (
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/proto"
"k8s.io/klog/v2"
)

Expand All @@ -53,7 +53,7 @@ func NewGNMIExporter(logger *zap.Logger, cfg *Config) (*GNMI, error) {
return nil, err
}

gnmiLis, err := net.Listen("tcp", fmt.Sprintf("%s", cfg.Addr))
gnmiLis, err := net.Listen("tcp", cfg.Addr)
if err != nil {
klog.Exitf("cannot listen on %s, err: %v", cfg.Addr, err)
}
Expand Down
6 changes: 6 additions & 0 deletions gnmi/gnmi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package gnmi

import (
"context"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -73,7 +74,10 @@ func TestHandleMetrics(t *testing.T) {
}

n := &gpb.Notification{}
var nMu sync.Mutex
updateFn := func(notif *gpb.Notification) error {
nMu.Lock()
defer nMu.Unlock()
n.Update = append(n.Update, notif.Update...)
return nil
}
Expand All @@ -86,6 +90,8 @@ func TestHandleMetrics(t *testing.T) {
close(g.metricCh)

time.Sleep(time.Second)
nMu.Lock()
defer nMu.Unlock()
if len(n.Update) != tc.wantCnt {
t.Errorf("missing updates: want %d got %d", tc.wantCnt, len(n.Update))
}
Expand Down
16 changes: 1 addition & 15 deletions gnmipath/pather_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,5 @@ func metricName(t *testing.T, ms pmetric.Metrics) string {
t.Helper()

rms := ms.ResourceMetrics()
for i := 0; i < rms.Len(); i++ {
rm := rms.At(i)
ilms := rm.ScopeMetrics()
for j := 0; j < ilms.Len(); j++ {
ilm := ilms.At(j)
ms := ilm.Metrics()
for k := 0; k < ms.Len(); k++ {
m := ms.At(k)
return m.Name()
}
}
}

t.Error("metric has no name")
return ""
return rms.At(0).ScopeMetrics().At(0).Metrics().At(0).Name()
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/openconfig/clio
go 1.22

require (
github.com/golang/protobuf v1.5.4
github.com/google/go-cmp v0.6.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver v0.102.0
github.com/openconfig/gnmi v0.11.0
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,6 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
Expand Down
6 changes: 2 additions & 4 deletions integration/docker_stats_e2e/docker_stats_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func startCollectorPipeline(t *testing.T, ctx context.Context) (*sync.WaitGroup,
go func() {
defer wg.Done()
if err := col.Run(ctx); err != nil {
t.Fatalf("%v", err)
t.Errorf("%v", err)
}
}()
return wg, col
Expand Down Expand Up @@ -134,9 +134,7 @@ func validateNotifications(t *testing.T, gotNoti []*gpb.Notification) {
for _, n := range gotNoti {
for _, u := range n.GetUpdate() {
path := elems2path(u.GetPath().GetElem())
if _, ok := wantPathSet[path]; ok {
delete(wantPathSet, path)
}
delete(wantPathSet, path)
}
}

Expand Down
2 changes: 1 addition & 1 deletion integration/oltp_e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func startCollectorPipeline(t *testing.T, ctx context.Context) (*sync.WaitGroup,
go func() {
defer wg.Done()
if err := col.Run(ctx); err != nil {
t.Fatalf("%v", err)
t.Errorf("%v", err)
}
}()
return wg, col
Expand Down
24 changes: 0 additions & 24 deletions linter.yml

This file was deleted.

0 comments on commit e5395e8

Please sign in to comment.