Skip to content

Commit

Permalink
comments r2
Browse files Browse the repository at this point in the history
  • Loading branch information
sgmonroy committed Sep 23, 2019
1 parent 1f15142 commit 8144967
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 150 deletions.
14 changes: 4 additions & 10 deletions go/border/internal/metrics/ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,16 @@ type ControlLabels struct {
Result string
// Type is the type of packet/message.
Type string
// Src is the source address of the processed packet.
Src string
// Dst is the destination address of the processed packet.
Dst string
}

// Labels returns the list of labels.
func (l ControlLabels) Labels() []string {
return []string{"result", "type", "src", "dst"}
return []string{"result", "type"}
}

// Values returns the label values in the order defined by Labels.
func (l ControlLabels) Values() []string {
return []string{l.Result, l.Type, l.Src, l.Dst}
return []string{l.Result, l.Type}
}

type control struct {
Expand All @@ -56,13 +52,11 @@ type control struct {

func newControl() control {
sub := "control"
il := IntfLabels{}
cl := ControlLabels{}
return control{
pkts: prom.NewCounterVec(Namespace, sub,
"pkts_total", "Total number of processed packets.", cl.Labels()),
"pkts_total", "Total number of processed packets.", ControlLabels{}.Labels()),
ifstate: prom.NewGaugeVec(Namespace, sub,
"interface_active", "Interface is active.", il.Labels()),
"interface_active", "Interface is active.", IntfLabels{}.Labels()),
}
}

Expand Down
2 changes: 0 additions & 2 deletions go/border/internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ const (
ErrParsePayload = "err_parse_payload"
)

const Self = "self"

// Metrics initialization.
var (
Input = newInput()
Expand Down
4 changes: 2 additions & 2 deletions go/border/internal/metrics/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ func newOutput() output {
l := IntfLabels{}.Labels()
return output{
pkts: prom.NewCounterVec(Namespace, sub,
"pkts_total", "Total number of output packets received.", l),
"pkts_total", "Total number of output packets sent.", l),
bytes: prom.NewCounterVec(Namespace, sub,
"bytes_total", "Total number of output bytes received.", l),
"bytes_total", "Total number of output bytes sent.", l),
pktSize: prom.NewHistogramVec(Namespace, sub,
"pkt_size_bytes", "Size of output packets in bytes", l,
[]float64{64, 256, 512, 1024, 1280, 1500, 3000, 6000, 9000}),
Expand Down
12 changes: 0 additions & 12 deletions go/border/metrics/BUILD.bazel

This file was deleted.

116 changes: 0 additions & 116 deletions go/border/metrics/metrics.go

This file was deleted.

3 changes: 1 addition & 2 deletions go/border/rctrl/ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ func Control(sRevInfoQ chan rpkt.RawSRevCallbackArgs, dispatcherReconnect bool)

func processCtrl() {
b := make(common.RawBytes, maxBufSize)
cl := metrics.ControlLabels{Dst: metrics.Self, Type: metrics.IFStateInfo}
cl := metrics.ControlLabels{Type: metrics.IFStateInfo}
for {
pktLen, src, err := snetConn.ReadFromSCION(b)
cl.Src = src.String()
if err != nil {
cl.Result = metrics.ErrRead
metrics.Control.Pkts(cl).Inc()
Expand Down
3 changes: 0 additions & 3 deletions go/border/rctrl/ifstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ func ifStateUpdate() {
// genIFStateReq generates an Interface State request packet to the local beacon service.
func genIFStateReq() error {
cl := metrics.ControlLabels{
Src: metrics.Self,
Dst: "svc_bs",
Type: metrics.IFStateReq,
Result: metrics.ErrProcess,
}
Expand Down Expand Up @@ -87,7 +85,6 @@ func genIFStateReq() error {
var errors common.MultiError
for _, addr := range bsAddrs {
dst.NextHop = addr
cl.Dst = dst.String()
if _, err := snetConn.WriteToSCION(pld, dst); err != nil {
cl.Result = metrics.ErrWrite
metrics.Control.Pkts(cl).Inc()
Expand Down
3 changes: 0 additions & 3 deletions go/border/rctrl/revinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ func revInfoFwd(revInfoQ chan rpkt.RawSRevCallbackArgs) {
// fwdRevInfo forwards RevInfo payloads to a designated local host.
func fwdRevInfo(sRevInfo *path_mgmt.SignedRevInfo, dstHost addr.HostSVC) {
cl := metrics.ControlLabels{
Src: metrics.Self,
Dst: dstHost.String(),
Type: metrics.Revocation,
Result: metrics.ErrProcess,
}
Expand Down Expand Up @@ -79,7 +77,6 @@ func fwdRevInfo(sRevInfo *path_mgmt.SignedRevInfo, dstHost addr.HostSVC) {
logger.Error("Resolving SVC anycast", "err", err, "addr", dst)
return
}
cl.Dst = dst.String()
if _, err := snetConn.WriteToSCION(pld, dst); err != nil {
cl.Result = metrics.ErrWrite
metrics.Control.Pkts(cl).Inc()
Expand Down

0 comments on commit 8144967

Please sign in to comment.