Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segfetcher: Classify error better #3272

Merged
merged 3 commits into from
Oct 25, 2019

Conversation

lukedirtwalker
Copy link
Collaborator

@lukedirtwalker lukedirtwalker commented Oct 24, 2019

This partially classifies the error of the segfetcher.
More work is needed for full classification (see #3281)

Fixes #3240


This change is Reviewable

@lukedirtwalker lukedirtwalker requested a review from scrye October 24, 2019 07:41
@lukedirtwalker lukedirtwalker added the c/observability Metrics, logging, tracing label Oct 24, 2019
Copy link
Contributor

@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.

Reviewed 12 of 12 files at r1.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @lukedirtwalker and @scrye)


go/lib/infra/modules/segfetcher/fetcher.go, line 40 at r1 (raw file):

var (
	// ErrValidate inidicates that validation of the request failed.
	ErrValidate = serrors.New("request validation failed")

Do we really need to have exported these?
As I can see it is only needed for metrics label matching.


go/lib/infra/modules/segfetcher/fetcher.go, line 179 at r1 (raw file):

			}
			// TODO(lukedirtwalker): should we return an error if verification
			// of all segments failed?

there is a question, who will answer that?


go/lib/infra/modules/segfetcher/resolver.go, line 31 at r1 (raw file):

// ErrInvalidRequest indicates an invalid request.
var ErrInvalidRequest = serrors.New("invalid request")

Somehow it feels better to have in a unique file all the errors that are exposed by the segfetcher package.
Maybe even a different file (nevertheless I have no researched any best practise)


go/path_srv/internal/segreq/handler.go, line 120 at r1 (raw file):

}

func errToMetricsLabel(err error) string {

It seems there is duplication of these function, can we avoid that?
Maybe within the segfetcher package


go/sciond/internal/servers/handlers.go, line 77 at r1 (raw file):

		logger.Error("Unable to get paths", "err", err)
		labels.Result = errToMetricsLabel(err)
	} else {

without else preferably

labels.Result = metrics.OkSuccess
if err{
labels.Result=err
}

go/sciond/internal/servers/handlers.go, line 364 at r1 (raw file):

}

func errToMetricsLabel(err error) string {

as usual, I would like to see this metric function help function not in the main code.
As position within the metric package or the prom could be better.

Copy link
Collaborator Author

@lukedirtwalker lukedirtwalker 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, 6 unresolved discussions (waiting on @karampok, @lukedirtwalker, and @scrye)


go/lib/infra/modules/segfetcher/fetcher.go, line 179 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

there is a question, who will answer that?

maybe a future version of myself? I don't know. It's really not clear. It indicates that this approach is kind of flawed and we should rather do individual error counters for stuff that wasn't verified. But this requires a larger discussion with Ops. So for now I would just leave this.


go/lib/infra/modules/segfetcher/resolver.go, line 31 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

Somehow it feels better to have in a unique file all the errors that are exposed by the segfetcher package.
Maybe even a different file (nevertheless I have no researched any best practise)

the others are no longer public, so I wouldn't group them.


go/path_srv/internal/segreq/handler.go, line 120 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

It seems there is duplication of these function, can we avoid that?
Maybe within the segfetcher package

Done.


go/sciond/internal/servers/handlers.go, line 77 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

without else preferably

labels.Result = metrics.OkSuccess
if err{
labels.Result=err
}

Done.


go/sciond/internal/servers/handlers.go, line 364 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

as usual, I would like to see this metric function help function not in the main code.
As position within the metric package or the prom could be better.

Done.

Copy link
Collaborator Author

@lukedirtwalker lukedirtwalker 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: 5 of 11 files reviewed, 6 unresolved discussions (waiting on @karampok and @scrye)


go/lib/infra/modules/segfetcher/fetcher.go, line 40 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

Do we really need to have exported these?
As I can see it is only needed for metrics label matching.

Done.

Copy link
Contributor

@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.

I suppose the commit message should be more concrete what this commit adds.

Reviewed 6 of 8 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @lukedirtwalker and @scrye)


go/lib/infra/modules/segfetcher/fetcher.go, line 40 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Done.

I would drop also the comments.
One idea for the future is to have our errors to have a getMetricName() function to avoid doing the match.

This partially classifies the error of the segfetcher.
To do it better we would have to use classified errors on all used libs,
which would be a huge amount of work.
And it's not yet sure that this approach is the best for metrics.
Maybe individual error counters make more sense.

Fixes scionproto#3240
Copy link
Collaborator Author

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

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

will change the commit msg when I commit.

Unrelated: Please use Start a new discussionbutton to discuss global issues in Reviewable.

Reviewable status: 10 of 11 files reviewed, 1 unresolved discussion (waiting on @karampok and @scrye)


go/lib/infra/modules/segfetcher/fetcher.go, line 40 at r1 (raw file):

Previously, karampok (Konstantinos) wrote…

I would drop also the comments.
One idea for the future is to have our errors to have a getMetricName() function to avoid doing the match.

Done.

Copy link
Contributor

@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.

Reviewed 1 of 1 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @scrye)

@lukedirtwalker lukedirtwalker merged commit 8d13abe into scionproto:master Oct 25, 2019
@lukedirtwalker lukedirtwalker deleted the pubErrorVars branch October 25, 2019 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/observability Metrics, logging, tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

segfetcher: Classify returned error
2 participants