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

small refactor circuitbreaker #1816

Merged
merged 2 commits into from Oct 24, 2022
Merged

small refactor circuitbreaker #1816

merged 2 commits into from Oct 24, 2022

Conversation

kpango
Copy link
Collaborator

@kpango kpango commented Oct 21, 2022

Signed-off-by: kpango kpango@vdaas.org

Description:

  1. refactor circuitbreaker
  2. update go dependencies
  3. update otel version and fix vald code

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.19.2
  • Docker Version: 20.10.8
  • Kubernetes Version: 1.22.0
  • NGT Version: 1.14.8

Types of changes:

  • Bug fix [type/bug]
  • New feature [type/feature]
  • Add tests [type/test]
  • Security related changes [type/security]
  • Add documents [type/documentation]
  • Refactoring [type/refactoring]
  • Update dependencies [type/dependency]
  • Update benchmarks and performances [type/bench]
  • Update CI [type/ci]

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Checklist:

  • I have read the CONTRIBUTING document.
  • I have checked open Pull Requests for the similar feature or fixes?
  • I have added tests and benchmarks to cover my changes.
  • I have ensured all new and existing tests passed.
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly.

@cloudflare-pages
Copy link

cloudflare-pages bot commented Oct 21, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: e14bb31
Status: ✅  Deploy successful!
Preview URL: https://b6370216.vald.pages.dev
Branch Preview URL: https://refactor-internal-circuitbre.vald.pages.dev

View logs

@vdaas-ci
Copy link
Collaborator

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 💌 /changelog - replace the PR body by changelog details
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • /rebase - rebase main
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

hlts2
hlts2 previously approved these changes Oct 21, 2022
@codecov
Copy link

codecov bot commented Oct 21, 2022

Codecov Report

Base: 50.23% // Head: 30.33% // Decreases project coverage by -19.90% ⚠️

Coverage data is based on head (e14bb31) compared to base (97eed29).
Patch coverage: 33.53% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1816       +/-   ##
===========================================
- Coverage   50.23%   30.33%   -19.91%     
===========================================
  Files         231      371      +140     
  Lines       13464    34033    +20569     
===========================================
+ Hits         6764    10323     +3559     
- Misses       6499    23288    +16789     
- Partials      201      422      +221     
Impacted Files Coverage Δ
cmd/tools/cli/loadtest/main.go 0.00% <ø> (ø)
hack/benchmark/assets/x1b/loader.go 0.00% <ø> (ø)
hack/benchmark/internal/assets/dataset.go 0.00% <ø> (ø)
hack/benchmark/internal/operation/insert.go 0.00% <ø> (ø)
hack/benchmark/internal/operation/operation.go 0.00% <ø> (ø)
hack/benchmark/internal/operation/option.go 0.00% <ø> (ø)
hack/benchmark/internal/operation/remove.go 0.00% <ø> (ø)
hack/benchmark/internal/operation/search.go 0.00% <ø> (ø)
hack/benchmark/internal/operation/util.go 0.00% <ø> (ø)
hack/license/gen/main.go 0.00% <0.00%> (ø)
... and 248 more

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.

@kpango kpango force-pushed the refactor/internal/circuitbreaker branch 2 times, most recently from 94d2ea6 to d6607ee Compare October 21, 2022 07:35
@github-actions
Copy link
Contributor

@vdaas-ci
Copy link
Collaborator

Profile Report

typevald-agent-ngtvald-lb-gatewayvald-discoverervald-manager-index
cpu
heap
other images

if errors.As(err, &serr) {
b.success()
return nil, b.currentState(), serr.Unwrap()
return nil, b.currentState(), err.(*errors.ErrCircuitBreakerMarkWithSuccess).Unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)

if errors.As(err, &igerr) {
return nil, b.currentState(), igerr.Unwrap()
return nil, b.currentState(), err.(*errors.ErrCircuitBreakerIgnorable).Unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)

if err != nil {
return nil, err
switch st {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
missing cases in switch of type State: StateUnknown (exhaustive)

@@ -39,10 +39,15 @@
closedRefreshExp int64 // unix time
}

var (
serr = new(errors.ErrCircuitBreakerMarkWithSuccess)
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
serr is a global variable (gochecknoglobals)

@@ -39,10 +39,15 @@
closedRefreshExp int64 // unix time
}

var (
serr = new(errors.ErrCircuitBreakerMarkWithSuccess)
igerr = new(errors.ErrCircuitBreakerIgnorable)
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
igerr is a global variable (gochecknoglobals)

@@ -72,20 +72,41 @@
mu.Unlock()
}()

var br *breaker
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
variable name 'br' is too short for the scope of its usage (varnamelen)

Signed-off-by: kpango <kpango@vdaas.org>
Copy link
Contributor

@hlts2 hlts2 left a comment

Choose a reason for hiding this comment

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

LGTM

@kpango kpango merged commit 80c42fc into main Oct 24, 2022
@kpango kpango deleted the refactor/internal/circuitbreaker branch October 24, 2022 02:27
@kpango kpango mentioned this pull request Jan 19, 2023
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.

None yet

4 participants