From 4c9782aa684cf6e22d7ca499cb517515a9e5baa9 Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik <93182827+NikitaSkrynnik@users.noreply.github.com> Date: Tue, 16 Jan 2024 20:27:01 +1100 Subject: [PATCH] Add interface names into NSM metrics (#789) * Add interface names into NSM metrics Signed-off-by: Alexander Peretyatko * Task:768 Add interface names into NSM metrics Signed-off-by: Alexander Peretyatko * Add interface names into NSM metrics Signed-off-by: Nikita Skrynnik * cleanup Signed-off-by: Nikita Skrynnik * change folder names Signed-off-by: Nikita Skrynnik --------- Signed-off-by: Alexander Peretyatko Signed-off-by: Nikita Skrynnik Co-authored-by: Alexander Peretyatko --- .../chains/forwarder/options.go | 10 +- pkg/networkservice/chains/forwarder/server.go | 8 +- pkg/networkservice/metrics/client.go | 46 +++++++ .../metrics/ifacename/client.go | 91 +++++++++++++ .../metrics/ifacename/common.go | 127 ++++++++++++++++++ pkg/networkservice/metrics/ifacename/doc.go | 18 +++ .../metrics/ifacename/option.go | 31 +++++ .../metrics/ifacename/server.go | 89 ++++++++++++ pkg/networkservice/metrics/option.go | 31 +++++ pkg/networkservice/metrics/server.go | 45 +++++++ .../{ => metrics}/stats/client.go | 2 +- .../{ => metrics}/stats/common.go | 2 +- pkg/networkservice/{ => metrics}/stats/doc.go | 4 +- .../{ => metrics}/stats/option.go | 2 +- .../{ => metrics}/stats/server.go | 4 +- 15 files changed, 496 insertions(+), 14 deletions(-) create mode 100644 pkg/networkservice/metrics/client.go create mode 100644 pkg/networkservice/metrics/ifacename/client.go create mode 100644 pkg/networkservice/metrics/ifacename/common.go create mode 100644 pkg/networkservice/metrics/ifacename/doc.go create mode 100644 pkg/networkservice/metrics/ifacename/option.go create mode 100644 pkg/networkservice/metrics/ifacename/server.go create mode 100644 pkg/networkservice/metrics/option.go create mode 100644 pkg/networkservice/metrics/server.go rename pkg/networkservice/{ => metrics}/stats/client.go (97%) rename pkg/networkservice/{ => metrics}/stats/common.go (97%) rename pkg/networkservice/{ => metrics}/stats/doc.go (90%) rename pkg/networkservice/{ => metrics}/stats/option.go (94%) rename pkg/networkservice/{ => metrics}/stats/server.go (96%) diff --git a/pkg/networkservice/chains/forwarder/options.go b/pkg/networkservice/chains/forwarder/options.go index 797cfef8..f907e4b7 100644 --- a/pkg/networkservice/chains/forwarder/options.go +++ b/pkg/networkservice/chains/forwarder/options.go @@ -1,4 +1,4 @@ -// Copyright (c) 2022 Cisco and/or its affiliates. +// Copyright (c) 2022-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -29,7 +29,7 @@ import ( "github.com/networkservicemesh/sdk/pkg/networkservice/common/cleanup" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/mechanisms/vxlan" - "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/stats" + "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/metrics" ) type forwarderOptions struct { @@ -40,7 +40,7 @@ type forwarderOptions struct { dialTimeout time.Duration domain2Device map[string]string mechanismPrioriyList []string - statsOpts []stats.Option + statsOpts []metrics.Option cleanupOpts []cleanup.Option vxlanOpts []vxlan.Option dialOpts []grpc.DialOption @@ -105,8 +105,8 @@ func WithMechanismPriority(priorityList []string) Option { } } -// WithStatsOptions sets stats options -func WithStatsOptions(opts ...stats.Option) Option { +// WithStatsOptions sets metrics options +func WithStatsOptions(opts ...metrics.Option) Option { return func(o *forwarderOptions) { o.statsOpts = opts } diff --git a/pkg/networkservice/chains/forwarder/server.go b/pkg/networkservice/chains/forwarder/server.go index 0f7e1a86..c2ffc832 100644 --- a/pkg/networkservice/chains/forwarder/server.go +++ b/pkg/networkservice/chains/forwarder/server.go @@ -2,6 +2,8 @@ // // Copyright (c) 2021-2023 Nordix Foundation. // +// Copyright (c) 2024 Cisco and/or its affiliates. +// // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -66,9 +68,9 @@ import ( "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/mechanisms/vlan" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/mechanisms/vxlan" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/mechanisms/wireguard" + "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/metrics" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/nsmonitor" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/pinhole" - "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/stats" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/tag" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/up" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/xconnect" @@ -121,7 +123,7 @@ func NewServer(ctx context.Context, tokenGenerator token.GeneratorFunc, vppConn sendfd.NewServer(), discover.NewServer(nsClient, nseClient), roundrobin.NewServer(), - stats.NewServer(ctx, opts.statsOpts...), + metrics.NewServer(ctx, vppConn, opts.statsOpts...), up.NewServer(ctx, vppConn), xconnect.NewServer(vppConn), l2bridgedomain.NewServer(vppConn), @@ -151,7 +153,7 @@ func NewServer(ctx context.Context, tokenGenerator token.GeneratorFunc, vppConn cleanup.NewClient(ctx, opts.cleanupOpts...), mechanismtranslation.NewClient(), connectioncontextkernel.NewClient(), - stats.NewClient(ctx, opts.statsOpts...), + metrics.NewClient(ctx, vppConn, opts.statsOpts...), up.NewClient(ctx, vppConn), mtu.NewClient(vppConn), tag.NewClient(ctx, vppConn), diff --git a/pkg/networkservice/metrics/client.go b/pkg/networkservice/metrics/client.go new file mode 100644 index 00000000..cd86af37 --- /dev/null +++ b/pkg/networkservice/metrics/client.go @@ -0,0 +1,46 @@ +// Copyright (c) 2024 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +// Package metrics provides chain elements for retrieving metrics from vpp +package metrics + +import ( + "context" + + "go.fd.io/govpp/api" + + "github.com/networkservicemesh/api/pkg/api/networkservice" + "github.com/networkservicemesh/sdk/pkg/networkservice/core/chain" + + "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/metrics/ifacename" + "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/metrics/stats" +) + +// NewClient provides a NetworkServiceClient chain elements that retrieves vpp interface metrics and names. +func NewClient(ctx context.Context, vppConn api.Connection, options ...Option) networkservice.NetworkServiceClient { + opts := &metricsOptions{} + for _, opt := range options { + opt(opts) + } + + return chain.NewNetworkServiceClient( + stats.NewClient(ctx, stats.WithSocket(opts.socket)), + ifacename.NewClient(ctx, vppConn, ifacename.WithSocket(opts.socket)), + ) +} diff --git a/pkg/networkservice/metrics/ifacename/client.go b/pkg/networkservice/metrics/ifacename/client.go new file mode 100644 index 00000000..aebba1a2 --- /dev/null +++ b/pkg/networkservice/metrics/ifacename/client.go @@ -0,0 +1,91 @@ +// Copyright (c) 2024 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package ifacename + +import ( + "context" + "sync" + + "github.com/golang/protobuf/ptypes/empty" + "go.fd.io/govpp/api" + "go.fd.io/govpp/core" + "google.golang.org/grpc" + + "github.com/networkservicemesh/api/pkg/api/networkservice" + "github.com/networkservicemesh/sdk/pkg/networkservice/core/next" + "github.com/networkservicemesh/sdk/pkg/tools/log" +) + +type ifaceNamesClient struct { + chainCtx context.Context + statsConn *core.StatsConnection + vppConn api.Connection + statsSock string + once sync.Once + initErr error +} + +// NewClient provides a NetworkServiceClient chain elements that retrieves vpp interface metrics. +func NewClient(ctx context.Context, vppConn api.Connection, options ...Option) networkservice.NetworkServiceClient { + opts := &ifacenameOptions{} + for _, opt := range options { + opt(opts) + } + + return &ifaceNamesClient{ + chainCtx: ctx, + vppConn: vppConn, + statsSock: opts.Socket, + } +} + +func (s *ifaceNamesClient) Request(ctx context.Context, request *networkservice.NetworkServiceRequest, opts ...grpc.CallOption) (*networkservice.Connection, error) { + initErr := s.init() + if initErr != nil { + log.FromContext(ctx).Errorf("%v", initErr) + } + + conn, err := next.Client(ctx).Request(ctx, request, opts...) + if err != nil || initErr != nil { + return conn, err + } + + retrieveIfaceNames(ctx, s.statsConn, s.vppConn, conn, true) + + return conn, nil +} + +func (s *ifaceNamesClient) Close(ctx context.Context, conn *networkservice.Connection, opts ...grpc.CallOption) (*empty.Empty, error) { + rv, err := next.Client(ctx).Close(ctx, conn, opts...) + if err != nil || s.initErr != nil { + return rv, err + } + + retrieveIfaceNames(ctx, s.statsConn, s.vppConn, conn, true) + + return &empty.Empty{}, nil +} + +func (s *ifaceNamesClient) init() error { + s.once.Do(func() { + s.statsConn, s.initErr = initFunc(s.chainCtx, s.statsSock) + }) + return s.initErr +} diff --git a/pkg/networkservice/metrics/ifacename/common.go b/pkg/networkservice/metrics/ifacename/common.go new file mode 100644 index 00000000..451a2697 --- /dev/null +++ b/pkg/networkservice/metrics/ifacename/common.go @@ -0,0 +1,127 @@ +// Copyright (c) 2024 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package ifacename + +import ( + "context" + "fmt" + "io" + "strings" + + "go.fd.io/govpp/adapter" + "go.fd.io/govpp/adapter/statsclient" + "go.fd.io/govpp/api" + "go.fd.io/govpp/core" + + "github.com/networkservicemesh/api/pkg/api/networkservice" + interfaces "github.com/networkservicemesh/govpp/binapi/interface" + "github.com/networkservicemesh/govpp/binapi/interface_types" + "github.com/pkg/errors" + + "github.com/networkservicemesh/sdk-vpp/pkg/tools/ifindex" +) + +type interfacesInfo struct { + interfaceName string + interfaceType string +} + +func (i *interfacesInfo) getInterfaceDetails() string { + return fmt.Sprintf("%s/%s", i.interfaceType, i.interfaceName) +} + +// Save retrieved vpp interface names in pathSegment +func retrieveIfaceNames(ctx context.Context, statsConn *core.StatsConnection, vppConn api.Connection, conn *networkservice.Connection, isClient bool) { + segment := conn.Path.PathSegments[conn.Path.Index] + + swIfIndex, ok := ifindex.Load(ctx, isClient) + if !ok { + return + } + stats := new(api.InterfaceStats) + if err := statsConn.GetInterfaceStats(stats); err != nil { + return + } + + info, err := getInterfacesInfo(ctx, vppConn, swIfIndex) + if err != nil { + return + } + + addName := "server_" + if isClient { + addName = "client_" + } + for idx := range stats.Interfaces { + iface := &stats.Interfaces[idx] + if iface.InterfaceIndex != uint32(swIfIndex) { + continue + } + + if segment.Metrics == nil { + segment.Metrics = make(map[string]string) + } + + segment.Metrics[addName+"interface"] = info.getInterfaceDetails() + break + } +} + +func initFunc(chainCtx context.Context, statsSocket string) (*core.StatsConnection, error) { + if statsSocket == "" { + statsSocket = adapter.DefaultStatsSocket + } + statsConn, err := core.ConnectStats(statsclient.NewStatsClient(statsSocket)) + if err != nil { + return nil, errors.Wrap(err, "failed to connect to Stats API") + } + go func() { + <-chainCtx.Done() + statsConn.Disconnect() + }() + return statsConn, nil +} + +func getInterfacesInfo(ctx context.Context, vppConn api.Connection, swIfIndex interface_types.InterfaceIndex) (*interfacesInfo, error) { + client, err := interfaces.NewServiceClient(vppConn).SwInterfaceDump(ctx, &interfaces.SwInterfaceDump{ + SwIfIndex: swIfIndex, + }) + + if err != nil { + return nil, err + } + + info := &interfacesInfo{} + for { + details, err := client.Recv() + if err == io.EOF { + break + } + + if err != nil { + return nil, err + } + + info.interfaceName = details.InterfaceName + info.interfaceType = strings.ToUpper(details.InterfaceDevType) + } + + return info, nil +} diff --git a/pkg/networkservice/metrics/ifacename/doc.go b/pkg/networkservice/metrics/ifacename/doc.go new file mode 100644 index 00000000..5981db7a --- /dev/null +++ b/pkg/networkservice/metrics/ifacename/doc.go @@ -0,0 +1,18 @@ +// Copyright (c) 2024 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package ifacename provides chain elements for retrieving names from vpp interfaces +package ifacename diff --git a/pkg/networkservice/metrics/ifacename/option.go b/pkg/networkservice/metrics/ifacename/option.go new file mode 100644 index 00000000..b350c392 --- /dev/null +++ b/pkg/networkservice/metrics/ifacename/option.go @@ -0,0 +1,31 @@ +// Copyright (c) 2024 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ifacename + +type ifacenameOptions struct { + Socket string +} + +// Option is an option pattern for ifacename server/client +type Option func(o *ifacenameOptions) + +// WithSocket sets stats socket name +func WithSocket(socket string) Option { + return func(o *ifacenameOptions) { + o.Socket = socket + } +} diff --git a/pkg/networkservice/metrics/ifacename/server.go b/pkg/networkservice/metrics/ifacename/server.go new file mode 100644 index 00000000..cff3e029 --- /dev/null +++ b/pkg/networkservice/metrics/ifacename/server.go @@ -0,0 +1,89 @@ +// Copyright (c) 2024 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package ifacename + +import ( + "context" + "sync" + + "github.com/golang/protobuf/ptypes/empty" + "github.com/networkservicemesh/api/pkg/api/networkservice" + "github.com/networkservicemesh/sdk/pkg/networkservice/core/next" + "github.com/networkservicemesh/sdk/pkg/tools/log" + "go.fd.io/govpp/api" + "go.fd.io/govpp/core" +) + +type ifaceNamesServer struct { + chainCtx context.Context + statsConn *core.StatsConnection + vppConn api.Connection + statsSock string + once sync.Once + initErr error +} + +// NewServer provides a NetworkServiceServer chain elements that retrieves vpp interface metrics. +func NewServer(ctx context.Context, vppConn api.Connection, options ...Option) networkservice.NetworkServiceServer { + opts := &ifacenameOptions{} + for _, opt := range options { + opt(opts) + } + + return &ifaceNamesServer{ + chainCtx: ctx, + vppConn: vppConn, + statsSock: opts.Socket, + } +} + +func (s *ifaceNamesServer) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*networkservice.Connection, error) { + initErr := s.init() + if initErr != nil { + log.FromContext(ctx).Errorf("%v", initErr) + } + + conn, err := next.Server(ctx).Request(ctx, request) + if err != nil || initErr != nil { + return conn, err + } + + retrieveIfaceNames(ctx, s.statsConn, s.vppConn, conn, false) + + return conn, nil +} + +func (s *ifaceNamesServer) Close(ctx context.Context, conn *networkservice.Connection) (*empty.Empty, error) { + rv, err := next.Server(ctx).Close(ctx, conn) + if err != nil || s.initErr != nil { + return rv, err + } + + retrieveIfaceNames(ctx, s.statsConn, s.vppConn, conn, false) + + return &empty.Empty{}, nil +} + +func (s *ifaceNamesServer) init() error { + s.once.Do(func() { + s.statsConn, s.initErr = initFunc(s.chainCtx, s.statsSock) + }) + return s.initErr +} diff --git a/pkg/networkservice/metrics/option.go b/pkg/networkservice/metrics/option.go new file mode 100644 index 00000000..78e1260b --- /dev/null +++ b/pkg/networkservice/metrics/option.go @@ -0,0 +1,31 @@ +// Copyright (c) 2022-2024 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metrics + +type metricsOptions struct { + socket string +} + +// Option is an option pattern for metrics server/client +type Option func(o *metricsOptions) + +// WithSocket sets stats socket name +func WithSocket(socket string) Option { + return func(o *metricsOptions) { + o.socket = socket + } +} diff --git a/pkg/networkservice/metrics/server.go b/pkg/networkservice/metrics/server.go new file mode 100644 index 00000000..40ba0272 --- /dev/null +++ b/pkg/networkservice/metrics/server.go @@ -0,0 +1,45 @@ +// Copyright (c) 2024 Cisco and/or its affiliates. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package metrics + +import ( + "context" + + "go.fd.io/govpp/api" + + "github.com/networkservicemesh/api/pkg/api/networkservice" + "github.com/networkservicemesh/sdk/pkg/networkservice/core/chain" + + "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/metrics/ifacename" + "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/metrics/stats" +) + +// NewServer provides NetworkServiceServer chain elements that retrieve vpp interface statistics and names. +func NewServer(ctx context.Context, vppConn api.Connection, options ...Option) networkservice.NetworkServiceServer { + opts := &metricsOptions{} + for _, opt := range options { + opt(opts) + } + + return chain.NewNetworkServiceServer( + stats.NewServer(ctx, stats.WithSocket(opts.socket)), + ifacename.NewServer(ctx, vppConn, ifacename.WithSocket(opts.socket)), + ) +} diff --git a/pkg/networkservice/stats/client.go b/pkg/networkservice/metrics/stats/client.go similarity index 97% rename from pkg/networkservice/stats/client.go rename to pkg/networkservice/metrics/stats/client.go index b4df126c..6c82f7e4 100644 --- a/pkg/networkservice/stats/client.go +++ b/pkg/networkservice/metrics/stats/client.go @@ -1,6 +1,6 @@ // Copyright (c) 2021-2023 Doc.ai and/or its affiliates. // -// Copyright (c) 2022-2023 Cisco and/or its affiliates. +// Copyright (c) 2022-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // diff --git a/pkg/networkservice/stats/common.go b/pkg/networkservice/metrics/stats/common.go similarity index 97% rename from pkg/networkservice/stats/common.go rename to pkg/networkservice/metrics/stats/common.go index 52ba69fd..60d613d1 100644 --- a/pkg/networkservice/stats/common.go +++ b/pkg/networkservice/metrics/stats/common.go @@ -1,6 +1,6 @@ // Copyright (c) 2021-2022 Doc.ai and/or its affiliates. // -// Copyright (c) 2022-2023 Cisco and/or its affiliates. +// Copyright (c) 2022-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // diff --git a/pkg/networkservice/stats/doc.go b/pkg/networkservice/metrics/stats/doc.go similarity index 90% rename from pkg/networkservice/stats/doc.go rename to pkg/networkservice/metrics/stats/doc.go index cbde214d..87162ab5 100644 --- a/pkg/networkservice/stats/doc.go +++ b/pkg/networkservice/metrics/stats/doc.go @@ -1,5 +1,7 @@ // Copyright (c) 2021 Doc.ai and/or its affiliates. // +// Copyright (c) 2024 Cisco and/or its affiliates. +// // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,5 +16,5 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package stats provides chain elements for retrieving statistics from vpp +// Package stats provides chain elements for retrieving statistics from vpp interfaces package stats diff --git a/pkg/networkservice/stats/option.go b/pkg/networkservice/metrics/stats/option.go similarity index 94% rename from pkg/networkservice/stats/option.go rename to pkg/networkservice/metrics/stats/option.go index 3a667a5c..b00b766f 100644 --- a/pkg/networkservice/stats/option.go +++ b/pkg/networkservice/metrics/stats/option.go @@ -1,4 +1,4 @@ -// Copyright (c) 2022 Cisco and/or its affiliates. +// Copyright (c) 2022-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // diff --git a/pkg/networkservice/stats/server.go b/pkg/networkservice/metrics/stats/server.go similarity index 96% rename from pkg/networkservice/stats/server.go rename to pkg/networkservice/metrics/stats/server.go index a003ea92..24209b5e 100644 --- a/pkg/networkservice/stats/server.go +++ b/pkg/networkservice/metrics/stats/server.go @@ -1,6 +1,6 @@ // Copyright (c) 2021-2023 Doc.ai and/or its affiliates. // -// Copyright (c) 2022-2023 Cisco and/or its affiliates. +// Copyright (c) 2022-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -40,7 +40,7 @@ type statsServer struct { initErr error } -// NewServer provides a NetworkServiceServer chain elements that retrieves vpp interface metrics. +// NewServer provides a NetworkServiceServer chain elements that retrieves vpp interface statistics. func NewServer(ctx context.Context, options ...Option) networkservice.NetworkServiceServer { opts := &statsOptions{} for _, opt := range options {