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

[DONT MERGE] Add logic to get backoff metrics #1666

Closed
wants to merge 44 commits into from

Conversation

hlts2
Copy link
Collaborator

@hlts2 hlts2 commented May 20, 2022

Description:

WHAT

I have added the logic to be able to get backoff metrics.
This allows collection of backoff metrics (retry count) within each RPC request when observability and backoff are enabled

WHY

We are in the process of implementing CircuitBreaker, but first we need to get proper metrics on the backoffs that occur inside RPC requests.

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.18.2
  • Docker Version: 20.10.8
  • Kubernetes Version: 1.22.0
  • NGT Version: 1.14.3

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.

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@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 master
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

@codecov
Copy link

codecov bot commented May 20, 2022

Codecov Report

Merging #1666 (e92afd7) into master (46334b2) will decrease coverage by 0.11%.
The diff coverage is 6.45%.

@@            Coverage Diff             @@
##           master    #1666      +/-   ##
==========================================
- Coverage   31.20%   31.09%   -0.12%     
==========================================
  Files         372      374       +2     
  Lines       32502    32602     +100     
==========================================
- Hits        10142    10136       -6     
- Misses      21982    22081      +99     
- Partials      378      385       +7     
Impacted Files Coverage Δ
internal/client/v1/client/discoverer/discover.go 0.00% <0.00%> (ø)
internal/config/backoff.go 63.88% <0.00%> (-36.12%) ⬇️
internal/net/grpc/client.go 0.00% <0.00%> (ø)
internal/net/grpc/context.go 0.00% <0.00%> (ø)
internal/net/http/transport/roundtrip_mock.go 50.00% <0.00%> (-16.67%) ⬇️
pkg/gateway/lb/handler/grpc/handler.go 0.00% <0.00%> (ø)
pkg/gateway/lb/usecase/vald.go 0.00% <0.00%> (ø)
pkg/manager/index/service/indexer.go 0.00% <0.00%> (ø)
pkg/manager/index/usecase/indexer.go 0.00% <0.00%> (ø)
internal/backoff/backoff.go 74.25% <11.11%> (-13.70%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3f0823...e92afd7. Read the comment docs.

hlts2 added 5 commits May 23, 2022 14:26
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@github-actions github-actions bot added size/L and removed size/M labels May 23, 2022
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@github-actions github-actions bot added the team/set SET team label May 23, 2022
@hlts2 hlts2 self-assigned this May 23, 2022
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
return []metrics.Measurement{}, nil
}

func (bm *backoffMetrics) MeasurementWithTags(ctx context.Context) (mts []metrics.MeasurementWithTags, err error) {
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 🐶
named return "mts" with type "[]metrics.MeasurementWithTags" found (nonamedreturns)

internal/backoff/backoff.go Outdated Show resolved Hide resolved
hlts2 added 2 commits May 24, 2022 10:35
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@@ -31,7 +31,7 @@ import (
"github.com/vdaas/vald/internal/test/goleak"
)

func TestDo(t *testing.T) {
func TestDo_for_race(t *testing.T) {
Copy link
Collaborator Author

@hlts2 hlts2 May 24, 2022

Choose a reason for hiding this comment

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

I have fixed function name because of CI fails.
The reason why CI fails was because there was a same function in to the same package.

https://github.com/vdaas/vald/blob/master/internal/runner/runner_test.go#L284

hlts2 added 2 commits May 24, 2022 18:28
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@vdaas-ci
Copy link
Collaborator

[WARNING:INTCFG] Changes in interal/config may require you to change Helm charts. Please check.

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
hlts2 added 6 commits May 26, 2022 20:33
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
hlts2 added 2 commits May 30, 2022 13:28
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@hlts2 hlts2 requested review from kpango and datelier May 30, 2022 04:52
@hlts2 hlts2 changed the title [WIP] Add logic to get backoff metrics Add logic to get backoff metrics May 30, 2022
internal/observability/metrics/backoff/backoff.go Outdated Show resolved Hide resolved
"github.com/vdaas/vald/internal/observability/metrics"
)

type backoffMetrics struct {
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 🐶
fieldalignment: struct with 48 pointer bytes could be 32 (govet)

pkg/gateway/lb/usecase/vald.go Show resolved Hide resolved
internal/backoff/backoff.go Outdated Show resolved Hide resolved
@hlts2 hlts2 marked this pull request as ready for review May 30, 2022 07:25
hlts2 added 6 commits May 30, 2022 17:20
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
_, err = idx.client.GetClient().Do(ctx, addr, func(ctx context.Context, conn *grpc.ClientConn, copts ...grpc.CallOption) (_ interface{}, err error) {
return agent.NewAgentClient(conn).SaveIndex(ctx, &payload.Empty{}, copts...)
})
_, err = idx.client.GetClient().Do(grpc.WithGRPCMethod(ctx, "v1.vald.SaveIndex"), addr,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
_, err = idx.client.GetClient().Do(grpc.WithGRPCMethod(ctx, "v1.vald.SaveIndex"), addr,
_, err = idx.client.GetClient().Do(grpc.WithGRPCMethod(ctx, "vald.v1.SaveIndex"), addr,
Suggested change
_, err = idx.client.GetClient().Do(grpc.WithGRPCMethod(ctx, "v1.vald.SaveIndex"), addr,
_, err = idx.client.GetClient().Do(grpc.WithGRPCMethod(ctx, "v1.vald.SaveIndex"), addr,

hlts2 added 2 commits May 31, 2022 11:03
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@@ -0,0 +1,82 @@
//
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 🐶
ST1000: package comment should be of the form "Package backoff ..." (stylecheck)

@@ -0,0 +1,35 @@
//
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 🐶
ST1000: package comment should be of the form "Package backoff ..." (stylecheck)

@hlts2 hlts2 changed the title Add logic to get backoff metrics [DONT MERGE] Add logic to get backoff metrics Jun 2, 2022
@hlts2 hlts2 mentioned this pull request Jun 2, 2022
18 tasks
@hlts2
Copy link
Collaborator Author

hlts2 commented Jun 6, 2022

I will close this PR. Because the following PR was merged to master.

#1684

@hlts2 hlts2 closed this Jun 6, 2022
@hlts2 hlts2 deleted the feature/add-backoff-metrics branch June 6, 2022 06:51
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