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

Remove unused CheckResponse.Error #906

Merged
merged 1 commit into from
Nov 9, 2022
Merged

Remove unused CheckResponse.Error #906

merged 1 commit into from
Nov 9, 2022

Conversation

krdln
Copy link
Contributor

@krdln krdln commented Nov 8, 2022

This field described only authz-specific errors and was filled in
envoy.Handler.Check() response when also returning non-nil error, but in
such case the grpc framework was not using the response anyway.
This field was also used for metrics, but no codepath was actually
setting them, as flowcontrol never set these.

Also:

  • Create errors using grpc/status package, so that we have control on the grpc
    status.
  • Add missing sampled logs for error conditions.

Drive-by:

  • Remove unused error from ClassifierEngine.Classify(), as it's
    infallible (all errors are reported individually per-label).
  • Remove unused code from authz.go.

Resolves #894

Checklist
  • Tested in playground or other setup

This change is Reviewable

@krdln krdln requested review from a team as code owners November 8, 2022 17:11
@codecov
Copy link

codecov bot commented Nov 8, 2022

Codecov Report

Base: 37.54% // Head: 37.55% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (ee2bfb3) compared to base (2bbfe8d).
Patch coverage: 25.00% of modified lines in pull request are covered.

❗ Current head ee2bfb3 differs from pull request most recent head f4b603f. Consider uploading reports for the commit f4b603f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #906      +/-   ##
==========================================
+ Coverage   37.54%   37.55%   +0.01%     
==========================================
  Files         286      286              
  Lines       20852    20825      -27     
==========================================
- Hits         7828     7821       -7     
+ Misses      12541    12522      -19     
+ Partials      483      482       -1     
Impacted Files Coverage Δ
...metricsprocessor/internal/check_response_labels.go 96.96% <ø> (-0.04%) ⬇️
pkg/policies/flowcontrol/service/envoy/authz.go 54.87% <10.52%> (+5.43%) ⬆️
...trol/resources/classifier/classification-engine.go 73.98% <66.66%> (ø)
pkg/policies/flowcontrol/service/check/check.go 100.00% <100.00%> (ø)
pkg/policies/flowcontrol/service/check/metrics.go 76.74% <100.00%> (+1.27%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@kwapik kwapik left a comment

Choose a reason for hiding this comment

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

Reviewed 15 of 15 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @krdln)


api/aperture/flowcontrol/check/v1/check.proto line 39 at r1 (raw file):

  google.protobuf.Timestamp end = 2;
  // services that matched
  repeated string services = 4;

Shouldn't we change numbering now? If not, shouldn't we somehow "reserve" the 3?


docs/content/assets/openapiv2/aperture.swagger.yaml line 235 at r1 (raw file):

    default: REJECT_REASON_NONE
    description: RejectReason contains fields that give further information about rejection.
  ClassifierInfoError:

I don't understand why this change in docs happens

This field described only authz-specific errors and was filled in
envoy.Handler.Check() response when also returning non-nil error, but in
such case the grpc framework was not using the response anyway.
This field was also used for metrics, but no codepath was actually
setting them, as flowcontrol never set these.

Also:
* Create errors using grpc/status package, so that we can control the
  grpc status.
* Add missing sampled logs for error conditions.

Drive-by:
* Remove unused error from ClassifierEngine.Classify(), as it's
  infallible (all errors are reported individually per-label).
* Remove unused code from authz.go.
Copy link
Contributor Author

@krdln krdln 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 @kwapik)


api/aperture/flowcontrol/check/v1/check.proto line 39 at r1 (raw file):

Previously, kwapik (Krzysztof Kwapisiewicz) wrote…

Shouldn't we change numbering now? If not, shouldn't we somehow "reserve" the 3?

Don't see any compelling reason on why to renumber. Even though we don't care too much about compatibility, it won't hurt being more compatible than less 🤷

We could reserve, but since we're still alpha, I don't see too much value in it.


docs/content/assets/openapiv2/aperture.swagger.yaml line 235 at r1 (raw file):

Previously, kwapik (Krzysztof Kwapisiewicz) wrote…

I don't understand why this change in docs happens

I don't think anyone does :P I guess that now there are less entities called Error and this affects autogenerated names?

@krdln krdln force-pushed the authz-error-revamp branch from ee2bfb3 to f4b603f Compare November 8, 2022 17:45
Copy link
Contributor

@kwapik kwapik 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @krdln)


api/aperture/flowcontrol/check/v1/check.proto line 39 at r1 (raw file):

Previously, krdln (Michał Krasnoborski) wrote…

Don't see any compelling reason on why to renumber. Even though we don't care too much about compatibility, it won't hurt being more compatible than less 🤷

We could reserve, but since we're still alpha, I don't see too much value in it.

I don't have strong opinion on that, so let's just keep it as is.

@krdln krdln merged commit ac564c3 into main Nov 9, 2022
@krdln krdln deleted the authz-error-revamp branch November 9, 2022 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop emitting error and non-error response simultaneusly in envoy authz Check
2 participants