Skip to content

Commit

Permalink
add logs to all Send methods
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
  • Loading branch information
NikitaSkrynnik committed Jun 16, 2022
1 parent 034c54b commit 00ba8b4
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/networkservice/chains/endpoint/combine_monitor_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"sync/atomic"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"

"github.com/networkservicemesh/api/pkg/api/networkservice"
)
Expand Down Expand Up @@ -121,6 +122,9 @@ type combineMonitorConnectionsServer struct {
}

func (m *combineMonitorConnectionsServer) Send(event *networkservice.ConnectionEvent) error {
logrus.Info("MY_INFO combineMonitorConnectionsServer Send Begin")
defer logrus.Info("MY_INFO combineMonitorConnectionsServer Send End")

switch event.Type {
case networkservice.ConnectionEventType_INITIAL_STATE_TRANSFER:
err := errors.New("double sending initial state transfer")
Expand Down
4 changes: 4 additions & 0 deletions pkg/networkservice/common/monitor/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package monitor
import (
"github.com/edwarnicke/serialize"
"github.com/networkservicemesh/api/pkg/api/networkservice"
"github.com/sirupsen/logrus"
)

type monitorFilter struct {
Expand All @@ -39,6 +40,9 @@ func newMonitorFilter(selector *networkservice.MonitorScopeSelector, srv network

// Send - Filter connections based on event passed and selector for this filter
func (m *monitorFilter) Send(event *networkservice.ConnectionEvent) error {
logrus.Info("MY_INFO monitorFilter Send Begin")
defer logrus.Info("MY_INFO monitorFilter Send End")

rv := &networkservice.ConnectionEvent{
Type: event.Type,
Connections: networkservice.FilterMapOnManagerScopeSelector(event.GetConnections(), m.selector),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/edwarnicke/serialize"
"github.com/google/uuid"
"github.com/networkservicemesh/api/pkg/api/networkservice"
"github.com/sirupsen/logrus"
)

type monitorConnectionServer struct {
Expand Down Expand Up @@ -66,6 +67,8 @@ func (m *monitorConnectionServer) MonitorConnections(selector *networkservice.Mo
var _ networkservice.MonitorConnectionServer = &monitorConnectionServer{}

func (m *monitorConnectionServer) Send(event *networkservice.ConnectionEvent) (_ error) {
logrus.Info("MY_INFO monitorConnectionServer Send Begin")
defer logrus.Info("MY_INFO monitorConnectionServer Send End")
m.executor.AsyncExec(func() {
if event.Type == networkservice.ConnectionEventType_UPDATE {
for _, conn := range event.GetConnections() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/networkservicemesh/api/pkg/api/networkservice"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"google.golang.org/grpc/metadata"
)

Expand All @@ -43,6 +44,9 @@ func NewMonitorConnectionMonitorConnectionsServer(ctx context.Context, eventCh c
}

func (m *monitorConnectionMonitorConnectionsServer) Send(event *networkservice.ConnectionEvent) error {
logrus.Info("MY_INFO monitorConnectionMonitorConnectionsServer Send Begin")
defer logrus.Info("MY_INFO monitorConnectionMonitorConnectionsServer Send End")

select {
case <-m.ctx.Done():
return m.ctx.Err()
Expand Down
3 changes: 3 additions & 0 deletions pkg/registry/common/dnsresolve/ns_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"net"

"github.com/networkservicemesh/sdk/pkg/tools/clienturlctx"
"github.com/sirupsen/logrus"

"github.com/networkservicemesh/sdk/pkg/tools/interdomain"

Expand Down Expand Up @@ -80,6 +81,8 @@ type dnsFindNSServer struct {
}

func (s *dnsFindNSServer) Send(nseResp *registry.NetworkServiceResponse) error {
logrus.Info("MY_INFO dnsFindNSServer Send Begin")
defer logrus.Info("MY_INFO dnsFindNSServer Send End")
nseResp.NetworkService.Name = interdomain.Join(nseResp.NetworkService.Name, s.domain)
return s.NetworkServiceRegistry_FindServer.Send(nseResp)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/registry/common/dnsresolve/nse_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/networkservicemesh/sdk/pkg/tools/clienturlctx"
"github.com/networkservicemesh/sdk/pkg/tools/log"
"github.com/sirupsen/logrus"

"github.com/networkservicemesh/sdk/pkg/tools/interdomain"

Expand Down Expand Up @@ -133,6 +134,8 @@ type dnsFindNSEServer struct {
}

func (s *dnsFindNSEServer) Send(nseResp *registry.NetworkServiceEndpointResponse) error {
logrus.Info("MY_INFO dnsFindNSEServer Send Begin")
defer logrus.Info("MY_INFO dnsFindNSEServer Send End")
translateNSE(nseResp.NetworkServiceEndpoint, func(str string) string {
return interdomain.Join(str, s.domain)
})
Expand Down
3 changes: 3 additions & 0 deletions pkg/registry/common/interdomainbypass/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/golang/protobuf/ptypes/empty"
"github.com/networkservicemesh/api/pkg/api/registry"
"github.com/sirupsen/logrus"

"github.com/networkservicemesh/sdk/pkg/registry/core/next"
"github.com/networkservicemesh/sdk/pkg/tools/stringurl"
Expand Down Expand Up @@ -86,6 +87,8 @@ func NewNetworkServiceEndpointRegistryServer(m *stringurl.Map, u *url.URL) regis
}

func (s *interdomainBypassNSEFindServer) Send(nseResp *registry.NetworkServiceEndpointResponse) error {
logrus.Info("MY_INFO interdomainBypassNSEFindServer Send Begin")
defer logrus.Info("MY_INFO interdomainBypassNSEFindServer Send End")
u, err := url.Parse(nseResp.GetNetworkServiceEndpoint().GetUrl())
if err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions pkg/registry/common/localbypass/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

"github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

"github.com/networkservicemesh/api/pkg/api/registry"

Expand All @@ -37,6 +38,8 @@ type localBypassNSEFindServer struct {
}

func (s *localBypassNSEFindServer) Send(nseResp *registry.NetworkServiceEndpointResponse) error {
logrus.Info("MY_INFO localBypassNSEFindServer Send Begin")
defer logrus.Info("MY_INFO localBypassNSEFindServer Send End")
if u, ok := s.nseURLs.Load(nseResp.NetworkServiceEndpoint.Name); ok {
nseResp.NetworkServiceEndpoint.Url = u.String()
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/registry/common/sendfd/server_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/edwarnicke/grpcfd"
"github.com/golang/protobuf/ptypes/empty"
"github.com/networkservicemesh/api/pkg/api/registry"
"github.com/sirupsen/logrus"

"github.com/networkservicemesh/sdk/pkg/registry/core/next"
)
Expand Down Expand Up @@ -66,6 +67,8 @@ type sendfdNSEFindServer struct {
}

func (s *sendfdNSEFindServer) Send(nseResp *registry.NetworkServiceEndpointResponse) error {
logrus.Info("MY_INFO sendfdNSEFindServer Send Begin")
defer logrus.Info("MY_INFO sendfdNSEFindServer Send End")
var inodeURLToFileURLMap = make(map[string]string)
if err := sendFDAndSwapFileToInode(s.transceiver, nseResp.GetNetworkServiceEndpoint(), inodeURLToFileURLMap); err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions pkg/registry/common/swapip/nse_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/golang/protobuf/ptypes/empty"
"github.com/networkservicemesh/api/pkg/api/registry"
"github.com/sirupsen/logrus"

"github.com/networkservicemesh/sdk/pkg/registry/core/next"
"github.com/networkservicemesh/sdk/pkg/tools/log"
Expand All @@ -37,6 +38,8 @@ type swapIPFindNSEServer struct {
}

func (s *swapIPFindNSEServer) Send(nseResp *registry.NetworkServiceEndpointResponse) error {
logrus.Info("MY_INFO swapIPFindNSEServer Send Begin")
defer logrus.Info("MY_INFO swapIPFindNSEServer Send End")
trySwapIP(s.ctx, nseResp.NetworkServiceEndpoint, s.m)
return s.NetworkServiceEndpointRegistry_FindServer.Send(nseResp)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/registry/core/adapters/ns_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/networkservicemesh/sdk/pkg/registry/core/next"
"github.com/networkservicemesh/sdk/pkg/registry/core/streamcontext"
"github.com/networkservicemesh/sdk/pkg/registry/utils/checks/checkcontext"
"github.com/sirupsen/logrus"

"github.com/golang/protobuf/ptypes/empty"
"github.com/networkservicemesh/api/pkg/api/registry"
Expand Down Expand Up @@ -74,6 +75,8 @@ type ignoreNSFindServer struct {
}

func (*ignoreNSFindServer) Send(_ *registry.NetworkServiceResponse) error {
logrus.Info("MY_INFO ignoreNSFindServer Send Begin")
defer logrus.Info("MY_INFO ignoreNSFindServer Send End")
return nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/registry/core/adapters/nse_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/networkservicemesh/sdk/pkg/registry/core/next"
"github.com/networkservicemesh/sdk/pkg/registry/core/streamcontext"
"github.com/networkservicemesh/sdk/pkg/registry/utils/checks/checkcontext"
"github.com/sirupsen/logrus"

"github.com/golang/protobuf/ptypes/empty"
"github.com/networkservicemesh/api/pkg/api/registry"
Expand Down Expand Up @@ -74,6 +75,8 @@ type ignoreNSEFindServer struct {
}

func (*ignoreNSEFindServer) Send(_ *registry.NetworkServiceEndpointResponse) error {
logrus.Info("MY_INFO ignoreNSEFindServer Send Begin")
defer logrus.Info("MY_INFO ignoreNSEFindServer Send End")
return nil
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/registry/core/streamchannel/ns_registry_stream_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ type networkServiceRegistryFindServer struct {
}

func (s *networkServiceRegistryFindServer) Send(nsResp *registry.NetworkServiceResponse) error {
logrus.Info("MY_INFO networkServiceRegistryFindServer Send Begin")
defer logrus.Info("MY_INFO networkServiceRegistryFindServer Send End")
select {
case <-s.ctx.Done():
return s.ctx.Err()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ type networkServiceEndpointRegistryFindServer struct {
}

func (s *networkServiceEndpointRegistryFindServer) Send(nseResp *registry.NetworkServiceEndpointResponse) error {
logrus.Info("MY_INFO networkServiceEndpointRegistryFindServer Send Begin")
defer logrus.Info("MY_INFO networkServiceEndpointRegistryFindServer Send End")
select {
case <-s.ctx.Done():
return s.ctx.Err()
Expand Down

0 comments on commit 00ba8b4

Please sign in to comment.