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

metrics: Add remaining server RPC rate metrics #15901

Merged
merged 4 commits into from
Jan 27, 2023
Merged

Conversation

tgross
Copy link
Member

@tgross tgross commented Jan 26, 2023

Continues the work done in #15876 by extending rate metrics measurement over a few stragglers that got missed in the original PR (probably because of concurrent PRs landing).

This changeset includes an update to the semgrep rule to add a rule for rate metrics, and another so that we're matching on only the currently used patterns. I've also left a some TODOs in the auth rule pointing to #15875, which isn't likely to ship in 1.5.0

@tgross tgross added this to the 1.5.0 milestone Jan 26, 2023
@tgross tgross changed the title metrics: Add remaining RPC rate metrics metrics: Add remaining server RPC rate metrics Jan 26, 2023
@tgross tgross marked this pull request as ready for review January 26, 2023 17:10
@tgross
Copy link
Member Author

tgross commented Jan 26, 2023

Looks like I've got a failing set of tests from clients getting their tokens. Moving to draft till that's fixed.

@tgross tgross marked this pull request as draft January 26, 2023 17:17
@tgross
Copy link
Member Author

tgross commented Jan 26, 2023

Tests fixed! There's a fussy little bit around whether errors get returned wrapped with rpc error: %v or not depending on where the error originate, and that broke some tests.

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines -103 to +110
- "*_endpoint.go"
- "nomad/*_endpoint.go"
Copy link
Contributor

Choose a reason for hiding this comment

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

This will exclude client endpoints, do they follow a different pattern for authorization now?

Copy link
Member Author

Choose a reason for hiding this comment

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

There's two kinds of "client endpoints": the server-side client RPCs are in files like nomad/client_*_endpoint.go and get picked up with this glob. The client-side client RPCs in files like client/*_endpoint.go have always been excluded, because they don't match the first pattern with the RPC forwarding:

    patterns:
      - pattern: |
          if done, err := $A.$B.forward($METHOD, ...); done {
            return err
          }

This change just makes sure we don't bother checking the files that will never have this pattern.

@tgross tgross merged commit e53b591 into main Jan 27, 2023
@tgross tgross deleted the rpc-rate-metrics-misc branch January 27, 2023 13:29
tgross added a commit that referenced this pull request Feb 9, 2023
In #15901 we introduced pre-forwarding authentication for RPCs so that we can
grab the identity for rate metrics. The `ACL.Bootstrap` RPC is an
unauthenticated endpoint, so any error message from authentication is not
particularly useful. This would be harmless, but if you try to bootstrap with
your `NOMAD_TOKEN` already set (perhaps because you were talking to another
cluster previously from the same shell session), you'll get an authentication
error instead of just having the token be ignored. This is a regression from the
existing behavior, so have this endpoint ignore auth errors the same way we do
for every other unauthenticated endpoint (ex `Status.Peers`)
tgross added a commit that referenced this pull request Feb 9, 2023
In #15901 we introduced pre-forwarding authentication for RPCs so that we can
grab the identity for rate metrics. The `ACL.Bootstrap` RPC is an
unauthenticated endpoint, so any error message from authentication is not
particularly useful. This would be harmless, but if you try to bootstrap with
your `NOMAD_TOKEN` already set (perhaps because you were talking to another
cluster previously from the same shell session), you'll get an authentication
error instead of just having the token be ignored. This is a regression from the
existing behavior, so have this endpoint ignore auth errors the same way we do
for every other unauthenticated endpoint (ex `Status.Peers`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants