Skip to content

Conversation

karampok
Copy link
Contributor

@karampok karampok commented Sep 19, 2019

This PR adds the following prometheus metrics

    # HELP bs_ifstate_state Interface state, 0==inactive/expired/revoked, 1==active
    # TYPE bs_ifstate_state gauge
    bs_ifstate_state{if_id="41",neigh_as="1-ff00:0:110"} 1

    # HELP bs_ifstate_issued_revocations_total Total number of issued revocations.
    # TYPE bs_ifstate_issued_revocations_total counter
    bs_ifstate_issued_revocations_total{if_id="41",neigh_as="1-ff00:0:110",state="new"} 2
    bs_ifstate_issued_revocations_total{if_id="41",neigh_as="1-ff00:0:110",state="renew"} 9

    # HELP bs_ifstate_sent_revocations_total Total number of sent revocations.
    # TYPE bs_ifstate_sent_revocations_total counter
    bs_ifstate_sent_revocations_total{dst="br"} 13
    bs_ifstate_sent_revocations_total{dst="ps"} 11

    # HELP bs_revocation_received_revocation_total Total number of received revocation msgs.
    # TYPE bs_revocation_received_revocation_total counter
    bs_revocation_received_revocation_total{method="ctrl",result="success"} 2

Note: the BS does not currently support revocations received over SCMP.

Also:

  • improve the promtest check function

Contributes #3104


This change is Reviewable

@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 0d4ab3f to 28119b6 Compare September 19, 2019 12:04
@karampok
Copy link
Contributor Author


go/beacon_srv/internal/revocation/handler.go, line 88 at r1 (raw file):

		return metrics.ErrBeaconStore(err)
	}
	sendAck(proto.Ack_ErrCode_ok, "")

the fact that this does not return error, makes hard to decide whether we have success or not.
One approach would be to have the function return the error.
Or when create the function pass the labels and the counter.

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 11 files at r1.
Reviewable status: 2 of 11 files reviewed, 2 unresolved discussions (waiting on @karampok and @lukedirtwalker)


go/beacon_srv/internal/metrics/metrics.go, line 18 at r1 (raw file):

import (
	"github.com/scionproto/scion/go/lib/infra"

This is begging for an import cycle - go/lib/infra imports a lot of libraries.

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 11 files reviewed, 3 unresolved discussions (waiting on @karampok and @lukedirtwalker)


go/beacon_srv/internal/metrics/revocation.go, line 24 at r1 (raw file):

// RevocationLabels define the labels attached to revocation metrics.
type RevocationLabels struct {

I'm struggling to understand these labels. For locally issued revocations, IfID makes sense, but Dst does not. For received revocations, neither make sense (you'd want a SrcIA label instead).

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 11 files reviewed, 3 unresolved discussions (waiting on @karampok and @lukedirtwalker)


go/beacon_srv/internal/metrics/revocation.go, line 24 at r1 (raw file):

Previously, kormat (Stephen Shirley) wrote…

I'm struggling to understand these labels. For locally issued revocations, IfID makes sense, but Dst does not. For received revocations, neither make sense (you'd want a SrcIA label instead).

For receiving revocations, the label should also mention the transmission type (e.g. ctrl_pld, or scmp).

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 14 files reviewed, 5 unresolved discussions (waiting on @karampok and @lukedirtwalker)


go/beacon_srv/internal/metrics/revocation.go, line 47 at r1 (raw file):

	sub := "revocation"
	labels := RevocationLabels{}.Labels()

Need a metric for issuing a revocation. It should have a label to say whether it's a fresh revocation, or an update of an existing one.


go/beacon_srv/internal/metrics/revocation.go, line 49 at r1 (raw file):

	return exporterR{
		out: *prom.NewCounterVec(Namespace, sub, "transmit_rev_total",

This is very vague. The BS has 3 different ways of sending revocations:

  • to local PS
  • to all local BRs
  • to the local ISD core (when/if #3168 is implemented)

There should be a label to distinguish between these cases.

@karampok
Copy link
Contributor Author


go/beacon_srv/internal/metrics/revocation.go, line 24 at r1 (raw file):

Previously, kormat (Stephen Shirley) wrote…

For receiving revocations, the label should also mention the transmission type (e.g. ctrl_pld, or scmp).

Can you please update the issue #3104
with the exact metrics as you would like to see them in prometheus?
That will help greatly

@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 467102c to 95a238f Compare September 19, 2019 15:18
@oncilla oncilla changed the title bs: add revocation metrics BS: add revocation metrics Sep 19, 2019
@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 95a238f to ef1e3b1 Compare September 20, 2019 14:23
@karampok
Copy link
Contributor Author

@kormat, question:

# Gauge
bs_ifstate_state{ifid="1", neigh_as="63-4534", state="1"}
# Counter
bs_ifstate_issued_revocations_total{ifid="1", neigh_as="63-4534", state="new|renew"}
# Counter
bs_ifstate_revocations_duration_seconds{ifid="1", neigh_as="63-4534"}
# Counter
bs_ifstate_send_revocations{ifid="4", neigh_as="63-4534", dst="core|ps|br"}

If I understand correctly the code, when we send revocation to BR we create an array of all revocations and then we sent this array to BR according to topology. So the values labels ifid, neigh_as are blended (to BR X, I send ifid=1, ifid2 ...). What values should I use then?

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 19 files reviewed, 6 unresolved discussions (waiting on @karampok, @kormat, and @lukedirtwalker)

a discussion (no related file):
@karampok : my mental model of how the BS sends revocations was wrong, so i would instead change the metric to be:

bs_ifstate_sent_revocations{dst="core|ps|br"}

@karampok
Copy link
Contributor Author

a discussion (no related file):

Previously, kormat (Stephen Shirley) wrote…

@karampok : my mental model of how the BS sends revocations was wrong, so i would instead change the metric to be:

bs_ifstate_sent_revocations{dst="core|ps|br"}

super!
Another question

bs_ifstate_issued_revocations_total{ifid="1", neigh_as="63-4534", state="new|renew"}

If I understand the renew value is the same as getting the state of the interface to be revoked?
Is that accurate?


@karampok karampok force-pushed the pub-bs-revocation-metrics branch from ef1e3b1 to 52fb6e8 Compare September 23, 2019 11:20
@karampok karampok requested review from oncilla and removed request for lukedirtwalker September 23, 2019 11:21
Copy link
Contributor Author

@karampok karampok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 18 files reviewed, 6 unresolved discussions (waiting on @kormat and @oncilla)


go/beacon_srv/internal/metrics/metrics.go, line 18 at r1 (raw file):

Previously, kormat (Stephen Shirley) wrote…

This is begging for an import cycle - go/lib/infra imports a lot of libraries.

done


go/beacon_srv/internal/metrics/revocation.go, line 47 at r1 (raw file):

Previously, kormat (Stephen Shirley) wrote…

Need a metric for issuing a revocation. It should have a label to say whether it's a fresh revocation, or an update of an existing one.

Done.


go/beacon_srv/internal/metrics/revocation.go, line 49 at r1 (raw file):

Previously, kormat (Stephen Shirley) wrote…

This is very vague. The BS has 3 different ways of sending revocations:

  • to local PS
  • to all local BRs
  • to the local ISD core (when/if #3168 is implemented)

There should be a label to distinguish between these cases.

Done.

@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 52fb6e8 to 7fcf4c5 Compare September 23, 2019 11:24
Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 11 files at r1, 6 of 13 files at r2, 6 of 9 files at r3.
Reviewable status: 16 of 18 files reviewed, 19 unresolved discussions (waiting on @karampok, @kormat, and @oncilla)


go/beacon_srv/internal/ifstate/metrics.go, line 47 at r3 (raw file):

			State:   string(intf.State()),
		}
		mc <- metrics.Ifstate.IfstateMetric(l, up)

this indirection seems a bit artificial to me. Why not use prometheus.MustNewConstMetric instead?


go/beacon_srv/internal/ifstate/revoker.go, line 91 at r3 (raw file):

			IfID:    ifid,
			NeighAS: intf.TopoInfo().ISD_AS,
			State:   metrics.RevNew,

State: metrics.RevRenew


go/beacon_srv/internal/ifstate/revoker.go, line 100 at r3 (raw file):

		if intf.Expire() && !r.hasValidRevocation(intf) {
			if intf.State() == Revoked {
				labelsIssued.State = metrics.RevRenew

move with next if statement
and assign metrics.RevNew instead


go/beacon_srv/internal/ifstate/revoker.go, line 112 at r3 (raw file):

			}
			if err := intf.Revoke(srev); err != nil {
				logger.Error("[ifstate.Revoker] Failed to revoke!", "ifid", ifid, "err", err)

I'm surprised that there is no label/counter for this.


go/beacon_srv/internal/ifstate/revoker.go, line 124 at r3 (raw file):

	if len(revs) > 0 {
		wg := &sync.WaitGroup{}
		l := metrics.RevocationLabels{Result: metrics.Success}

not used?


go/beacon_srv/internal/metrics/ifstate.go, line 24 at r3 (raw file):

)

type exporterI struct {

to me exporterI is a lot less obvious then ifstate.
But it is private so 🤷‍♂️


go/beacon_srv/internal/metrics/ifstate.go, line 40 at r3 (raw file):

		issued: *prom.NewCounterVec(Namespace, sub, "issued_revocations_total",
			"Total number of issued revocations.", IssuedLabels{}.Labels()),
		duration: *prom.NewCounterVec(Namespace, sub, "revocations_duration_seconds",

seconds_total


go/beacon_srv/internal/metrics/ifstate.go, line 65 at r3 (raw file):

// Transmit return the duration counter
func (e *exporterI) Transmit(l SentLabels) prometheus.Counter {

keep it consistent with sent


go/beacon_srv/internal/metrics/metrics.go, line 22 at r3 (raw file):

const (
	// DstBR indicates the destination to be Border Router.

group const blocks by purpose

e.g. namespace should be its own block
destinations should be their own block
etc.

This makes for much nicer godoc.


go/beacon_srv/internal/metrics/metrics.go, line 34 at r3 (raw file):

	// RevRenew indicates a renew of an already issued revocation.
	RevRenew string = "renew"
	// RevFromCTRL indicates that revocation was sent by ctrl.

"sent in a control payload."


go/beacon_srv/internal/metrics/metrics.go, line 35 at r3 (raw file):

	RevRenew string = "renew"
	// RevFromCTRL indicates that revocation was sent by ctrl.
	RevFromCTRL string = "ctrl"

Ctrl


go/beacon_srv/internal/revocation/handler.go, line 88 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

the fact that this does not return error, makes hard to decide whether we have success or not.
One approach would be to have the function return the error.
Or when create the function pass the labels and the counter.

tbh, SendAckHelper should expose the error.

If code does not care, it can just ignore the return value.
If it does care, it can use it.


go/beacon_srv/internal/revocation/metrics.go, line 2 at r3 (raw file):

// Copyright 2019 Anapaya Systems
//

Why does this exist?


go/beacon_srv/internal/revocation/metrics.go, line 24 at r3 (raw file):

const (
	// Success indicates a successful result.
	Success string = prom.Success

drop this. Client code should just use metrics.{Success,ErrProcess} instead.

@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 7fcf4c5 to b43c62d Compare September 23, 2019 13:45
Copy link
Contributor Author

@karampok karampok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 14 of 18 files reviewed, 19 unresolved discussions (waiting on @kormat and @oncilla)


go/beacon_srv/internal/ifstate/metrics.go, line 47 at r3 (raw file):

Previously, Oncilla wrote…

this indirection seems a bit artificial to me. Why not use prometheus.MustNewConstMetric instead?

because I do not want to export the .Values() function. I know that we already export it but I want to keep it possible to make it private.


go/beacon_srv/internal/ifstate/revoker.go, line 91 at r3 (raw file):

Previously, Oncilla wrote…

State: metrics.RevRenew

Done


go/beacon_srv/internal/ifstate/revoker.go, line 100 at r3 (raw file):

Previously, Oncilla wrote…

move with next if statement
and assign metrics.RevNew instead

Done


go/beacon_srv/internal/ifstate/revoker.go, line 112 at r3 (raw file):

Previously, Oncilla wrote…

I'm surprised that there is no label/counter for this.

What do you mean? that there should be a metric with error result?


go/beacon_srv/internal/ifstate/revoker.go, line 124 at r3 (raw file):

Previously, Oncilla wrote…

not used?

Done.


go/beacon_srv/internal/metrics/ifstate.go, line 24 at r3 (raw file):

Previously, Oncilla wrote…

to me exporterI is a lot less obvious then ifstate.
But it is private so 🤷‍♂️

Done.


go/beacon_srv/internal/metrics/ifstate.go, line 40 at r3 (raw file):

Previously, Oncilla wrote…

seconds_total

Done.


go/beacon_srv/internal/metrics/ifstate.go, line 65 at r3 (raw file):

Previously, Oncilla wrote…

keep it consistent with sent

Done.


go/beacon_srv/internal/metrics/metrics.go, line 22 at r3 (raw file):

Previously, Oncilla wrote…

group const blocks by purpose

e.g. namespace should be its own block
destinations should be their own block
etc.

This makes for much nicer godoc.

do we want to be sorted also?


go/beacon_srv/internal/metrics/metrics.go, line 34 at r3 (raw file):

Previously, Oncilla wrote…

"sent in a control payload."

Done.


go/beacon_srv/internal/metrics/metrics.go, line 35 at r3 (raw file):

Previously, Oncilla wrote…

Ctrl

all strings in prom.* are lowercase


go/beacon_srv/internal/metrics/revocation.go, line 24 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

Can you please update the issue #3104
with the exact metrics as you would like to see them in prometheus?
That will help greatly

Done.


go/beacon_srv/internal/revocation/handler.go, line 88 at r1 (raw file):

Previously, Oncilla wrote…

tbh, SendAckHelper should expose the error.

If code does not care, it can just ignore the return value.
If it does care, it can use it.

it is not needed for the metrics in that PR


go/beacon_srv/internal/revocation/metrics.go, line 2 at r3 (raw file):

Previously, Oncilla wrote…

Why does this exist?

So this file existed in revocation/metrics/metrics.go link and the import of metrics was a conflict.
Since I am not feeling comfortable to refactor this part, i just place it here and the call now does no use the metrics package

return metrics.ErrBeaconStore(err)


go/beacon_srv/internal/revocation/metrics.go, line 24 at r3 (raw file):

Previously, Oncilla wrote…

drop this. Client code should just use metrics.{Success,ErrProcess} instead.

other part of my changes

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 14 of 18 files reviewed, 20 unresolved discussions (waiting on @karampok, @kormat, and @oncilla)


go/beacon_srv/internal/metrics/ifstate.go, line 88 at r3 (raw file):

	IfID    common.IFIDType
	NeighAS addr.IA
	State   string

I don't think we want to expose this, it's going away when #2926 gets implemented. I saw that i had accidentally left the state label in #3104, so i've updated it to remove it.

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 14 of 18 files reviewed, 16 unresolved discussions (waiting on @karampok and @oncilla)


go/beacon_srv/internal/ifstate/metrics.go, line 23 at r4 (raw file):

var _ prometheus.Collector = (*Collector)(nil)

Why remove this?

@karampok karampok force-pushed the pub-bs-revocation-metrics branch from b43c62d to 84bcc5e Compare September 23, 2019 14:46
Copy link
Contributor Author

@karampok karampok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 13 of 18 files reviewed, 16 unresolved discussions (waiting on @kormat and @oncilla)


go/beacon_srv/internal/ifstate/metrics.go, line 47 at r3 (raw file):

Previously, karampok (Konstantinos) wrote…

because I do not want to export the .Values() function. I know that we already export it but I want to keep it possible to make it private.

Done. unless you have strong preference.


go/beacon_srv/internal/ifstate/metrics.go, line 23 at r4 (raw file):

Previously, kormat (Stephen Shirley) wrote…
var _ prometheus.Collector = (*Collector)(nil)

Why remove this?

It does not seem that we need that. Is there a specific reason we had that in the first moment?


go/beacon_srv/internal/metrics/ifstate.go, line 88 at r3 (raw file):

Previously, kormat (Stephen Shirley) wrote…

I don't think we want to expose this, it's going away when #2926 gets implemented. I saw that i had accidentally left the state label in #3104, so i've updated it to remove it.

Done.

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 13 of 18 files reviewed, 15 unresolved discussions (waiting on @karampok and @oncilla)


go/beacon_srv/internal/ifstate/metrics.go, line 23 at r4 (raw file):

Previously, karampok (Konstantinos) wrote…

It does not seem that we need that. Is there a specific reason we had that in the first moment?

Yes. It ensures at compile time that the type does implement what the docstring claims.

(On a side note - if you don't know why something is there, it would be better to ask than to remove it silently)

Copy link
Contributor Author

@karampok karampok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 13 of 18 files reviewed, 15 unresolved discussions (waiting on @kormat and @oncilla)


go/beacon_srv/internal/ifstate/metrics.go, line 23 at r4 (raw file):

Previously, kormat (Stephen Shirley) wrote…

Yes. It ensures at compile time that the type does implement what the docstring claims.

(On a side note - if you don't know why something is there, it would be better to ask than to remove it silently)

me removing this == me asking ;)

To my understanding, when compile time (aka go test or go build) the compiler will complain if the type does not implement the interface that should. This is a standard golang approach. In specific according to https://golang.org/doc/effective_go.html#blank_implements we don't need

 By convention, such declarations are only used when there are no static conversions already present in the code, which is a rare event.

Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 9 files at r3, 2 of 3 files at r4, 2 of 2 files at r5.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @karampok and @kormat)


go/beacon_srv/internal/ifstate/metrics.go, line 23 at r4 (raw file):

Previously, karampok (Konstantinos) wrote…

me removing this == me asking ;)

To my understanding, when compile time (aka go test or go build) the compiler will complain if the type does not implement the interface that should. This is a standard golang approach. In specific according to https://golang.org/doc/effective_go.html#blank_implements we don't need

 By convention, such declarations are only used when there are no static conversions already present in the code, which is a rare event.

I agree with @karampok on this.

Either code compiles, and all is fine.
Or code does not compile.

The check is superfluous.


go/beacon_srv/internal/ifstate/revoker.go, line 112 at r3 (raw file):

Previously, karampok (Konstantinos) wrote…

What do you mean? that there should be a metric with error result?

🤷‍♂️
just expressing my surprise 😅


go/beacon_srv/internal/metrics/metrics.go, line 22 at r3 (raw file):

Previously, karampok (Konstantinos) wrote…

do we want to be sorted also?

meh, no strong opinion


go/beacon_srv/internal/metrics/metrics.go, line 35 at r3 (raw file):

Previously, karampok (Konstantinos) wrote…

all strings in prom.* are lowercase

No, I mean s/CTRL/Ctrl


go/beacon_srv/internal/revocation/handler.go, line 88 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

it is not needed for the metrics in that PR

Sure.


go/beacon_srv/internal/revocation/metrics.go, line 2 at r3 (raw file):

Previously, karampok (Konstantinos) wrote…

So this file existed in revocation/metrics/metrics.go link and the import of metrics was a conflict.
Since I am not feeling comfortable to refactor this part, i just place it here and the call now does no use the metrics package

return metrics.ErrBeaconStore(err)

ack.


go/beacon_srv/internal/revocation/metrics.go, line 24 at r3 (raw file):

Previously, karampok (Konstantinos) wrote…

other part of my changes

What does that mean?

@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 84bcc5e to 200deed Compare September 24, 2019 07:53
Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r6.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @kormat)

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @oncilla)


go/beacon_srv/internal/ifstate/metrics.go, line 23 at r4 (raw file):

Previously, karampok (Konstantinos) wrote…

ack

This library will compile fine without it; compilation would fail on anywhere that used it as a prometheus.Collector. If there is no such code at a given point in time (or it's commented out, etc), then we won't notice any issues until potentially much later.

We use this pattern a lot:

$ git grep 'var _' -- go/ | wc -l
271

It makes it explicit what interfaces a type implements, so it acts as documentation as well as safety.

@karampok karampok force-pushed the pub-bs-revocation-metrics branch from e62b144 to 62454e3 Compare September 24, 2019 08:53
Copy link
Contributor Author

@karampok karampok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 17 of 18 files reviewed, 1 unresolved discussion (waiting on @kormat and @oncilla)


go/beacon_srv/internal/ifstate/metrics.go, line 23 at r4 (raw file):

Previously, kormat (Stephen Shirley) wrote…

This library will compile fine without it; compilation would fail on anywhere that used it as a prometheus.Collector. If there is no such code at a given point in time (or it's commented out, etc), then we won't notice any issues until potentially much later.

We use this pattern a lot:

$ git grep 'var _' -- go/ | wc -l
271

It makes it explicit what interfaces a type implements, so it acts as documentation as well as safety.

Without it, if I change the type not to implement the interface it fails, so we will notice any issue instantly.
What I agree with you is that this PR does not need to have this change.

In order to move forward, I suggest that we defer the conversation elsewhere so to include the opinion of the rest of the team.
And if we decide to remove it, then to do it in a specific PR.

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 11 files at r1, 2 of 13 files at r2, 1 of 9 files at r3, 1 of 1 files at r7.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @karampok)


go/lib/prom/promtest/promtest.go, line 28 at r7 (raw file):

// CheckLabelsStruct checks that labels has a Values and Labels method. It also
// checks that labels.Labels() returns the struct field names.
func CheckLabelsStruct(t *testing.T, xLabels interface{}) {

This change isn't mentioned in the PR description.

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @karampok)


go/beacon_srv/internal/revocation/metrics.go, line 24 at r7 (raw file):

var (
	errBeaconStore   = &infra.HandlerResult{Result: "err_beaconstore", Status: prom.StatusErr}
	errBeaconStoreTo = &infra.HandlerResult{

I'd use Tout as a short-hand for timeout.

@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 62454e3 to 5e18b30 Compare September 24, 2019 09:23
Copy link
Contributor Author

@karampok karampok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 17 of 18 files reviewed, 2 unresolved discussions (waiting on @kormat)


go/beacon_srv/internal/revocation/metrics.go, line 24 at r7 (raw file):

Previously, kormat (Stephen Shirley) wrote…

I'd use Tout as a short-hand for timeout.

Done but
this file already existed in revocation/metrics/metrics.go link and the import of metrics was a conflict.
Since I am not feeling comfortable to refactor this part, i just placed in a new location and the call now does not use the metrics package. I am sure it will be refactored once I touch this part of metrics


go/lib/prom/promtest/promtest.go, line 28 at r7 (raw file):

Previously, kormat (Stephen Shirley) wrote…

This change isn't mentioned in the PR description.

Done.

@karampok karampok force-pushed the pub-bs-revocation-metrics branch 2 times, most recently from 38ef923 to c027f12 Compare September 24, 2019 10:40
Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r8.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @karampok)

a discussion (no related file):
PR description needs an update (the metrics are the old versions). I'd suggest using this as the bottom part of the description:

Note: the BS does not currently support revocations received over SCMP.

Also:

  • Improve the promtest check function

There's no need to mention not sending revocations to the core as that isn't settled yet.



go/beacon_srv/internal/revocation/handler.go, line 41 at r7 (raw file):

	timeout  time.Duration
}

Add a FIXME to add support for revocations received over SCMP.


go/beacon_srv/internal/revocation/metrics.go, line 24 at r7 (raw file):

Previously, karampok (Konstantinos) wrote…

Done but
this file already existed in revocation/metrics/metrics.go link and the import of metrics was a conflict.
Since I am not feeling comfortable to refactor this part, i just placed in a new location and the call now does not use the metrics package. I am sure it will be refactored once I touch this part of metrics

My comment was specific to this line - errBeaconStoreTo where To apparently stands for "timeout". I wasn't talking about renaming err_beaconstore_timeout.

Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @karampok and @kormat)


go/beacon_srv/internal/revocation/handler.go, line 41 at r7 (raw file):

Previously, kormat (Stephen Shirley) wrote…

Add a FIXME to add support for revocations received over SCMP.

reference #3166 in the fixme

@karampok karampok force-pushed the pub-bs-revocation-metrics branch 3 times, most recently from ce9fd83 to 79bc168 Compare September 24, 2019 11:02
Copy link
Contributor Author

@karampok karampok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 16 of 18 files reviewed, 3 unresolved discussions (waiting on @kormat and @oncilla)

a discussion (no related file):

Previously, kormat (Stephen Shirley) wrote…

PR description needs an update (the metrics are the old versions). I'd suggest using this as the bottom part of the description:

Note: the BS does not currently support revocations received over SCMP.

Also:

  • Improve the promtest check function

There's no need to mention not sending revocations to the core as that isn't settled yet.

Done.



go/beacon_srv/internal/revocation/handler.go, line 41 at r7 (raw file):

Previously, Oncilla wrote…

reference #3166 in the fixme

Done.


go/beacon_srv/internal/revocation/metrics.go, line 24 at r7 (raw file):

Previously, kormat (Stephen Shirley) wrote…

My comment was specific to this line - errBeaconStoreTo where To apparently stands for "timeout". I wasn't talking about renaming err_beaconstore_timeout.

is not yet "apparently" to me, done

@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 79bc168 to 6abce52 Compare September 24, 2019 11:21
Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 15 of 18 files reviewed, 2 unresolved discussions (waiting on @karampok, @kormat, and @oncilla)

a discussion (no related file):

Previously, karampok (Konstantinos) wrote…

Done.

If you're using , you don't need to indent the block - as it is github is displaying the as literals.

If you use - instead of *, github will format the "Also" list correctly.



go/beacon_srv/internal/revocation/handler.go, line 41 at r7 (raw file):

Previously, karampok (Konstantinos) wrote…

Done.

Use full urls for referenced issues.

Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 15 of 18 files reviewed, 2 unresolved discussions (waiting on @karampok, @kormat, and @oncilla)

a discussion (no related file):

Previously, kormat (Stephen Shirley) wrote…

If you're using , you don't need to indent the block - as it is github is displaying the as literals.

If you use - instead of *, github will format the "Also" list correctly.

Ah, that got scrambled. If you're using ``` you don't need to indent the block.


@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 6abce52 to 2f241a8 Compare September 24, 2019 12:56
This commit adds the following prometheus metrics

    # HELP bs_ifstate_state Interface state, 0==inactive/expired/revoked, 1==active
    # TYPE bs_ifstate_state gauge
    bs_ifstate_state{if_id="41",neigh_as="1-ff00:0:110"} 1

    # HELP bs_ifstate_sent_revocations_total Total number of sent revocations.
    # TYPE bs_ifstate_sent_revocations_total counter
    bs_ifstate_sent_revocations_total{dst="br"} 1

    # HELP bs_ifstate_issued_revocations_total Total number of issued revocations.
    # TYPE bs_ifstate_issued_revocations_total counter
    bs_ifstate_issued_revocations_total{if_id="41",neigh_as="1-ff00:0:110",state="new"} 2
    bs_ifstate_issued_revocations_total{if_id="41",neigh_as="1-ff00:0:110",state="renew"} 9

    # HELP bs_ifstate_sent_revocations_total Total number of sent revocations.
    # TYPE bs_ifstate_sent_revocations_total counter
    bs_ifstate_sent_revocations_total{dst="br"} 13
    bs_ifstate_sent_revocations_total{dst="ps"} 11

    # HELP bs_revocation_received_revocation_total Total number of received revocation msgs.
    # TYPE bs_revocation_received_revocation_total counter
    bs_revocation_received_revocation_total{method="ctrl",result="success"} 2

* currently we support only revocation from the ctlr, no scmp
* currently we support only revocation to BR,PS, not core
* improves the promtest check function

Contributes scionproto#3104
@karampok karampok force-pushed the pub-bs-revocation-metrics branch from 2f241a8 to 2f1f7d2 Compare September 24, 2019 12:58
Copy link
Contributor

@kormat kormat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 3 files at r9.
Reviewable status: 16 of 18 files reviewed, 1 unresolved discussion (waiting on @kormat and @oncilla)

Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 3 files at r9.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @oncilla)

Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @oncilla)

Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @kormat)

Copy link
Contributor

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dismissed @kormat from a discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@karampok karampok merged commit 06a8bf4 into scionproto:master Sep 24, 2019
@karampok karampok deleted the pub-bs-revocation-metrics branch September 24, 2019 14:33
@kormat kormat mentioned this pull request Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants