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

add metrics for indexer and sidecar #642

Merged

Conversation

rinx
Copy link
Contributor

@rinx rinx commented Aug 25, 2020

Description:

Added new metrics for indexer and sidecar.

Related Issue:

#343

How Has This Been Tested?:

nothing.

Environment:

  • Go Version: 1.14.4
  • Docker Version: 19.03.8
  • Kubernetes Version: 1.18.2
  • NGT Version: 1.12.0

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.

@pull-assistant
Copy link

pull-assistant bot commented Aug 25, 2020

Score: 0.99

Best reviewed: commit by commit


Optimal code review plan

     ✨ Add indexer metrics

     ✨ add sidecar metrics

     🚚 rename

     ✅ fix tests

     🔧 add RoughMillisecondsDistribution

Powered by Pull Assistant. Last update 317fc83 ... 778656f. Read the comment docs.

@vdaas-ci
Copy link
Collaborator

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 💌 /changelog - add changelog comment
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • /rebase - rebase master

@codecov
Copy link

codecov bot commented Aug 25, 2020

Codecov Report

Merging #642 into master will decrease coverage by 0.23%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #642      +/-   ##
==========================================
- Coverage   15.48%   15.25%   -0.24%     
==========================================
  Files         412      411       -1     
  Lines       21598    21578      -20     
==========================================
- Hits         3344     3291      -53     
- Misses      18000    18036      +36     
+ Partials      254      251       -3     
Impacted Files Coverage Δ
internal/observability/metrics/metrics.go 0.00% <ø> (ø)
pkg/agent/sidecar/service/observer/observer.go 0.00% <0.00%> (ø)
pkg/agent/sidecar/service/observer/option.go 9.80% <0.00%> (-1.83%) ⬇️
pkg/agent/sidecar/service/storage/storage.go 0.00% <0.00%> (ø)
pkg/agent/sidecar/usecase/sidecar/sidecar.go 0.00% <0.00%> (ø)
pkg/manager/index/service/indexer.go 0.00% <ø> (ø)
pkg/manager/index/usecase/indexer.go 0.00% <0.00%> (ø)
internal/net/net.go
internal/worker/worker.go 85.45% <0.00%> (+0.90%) ⬆️
internal/worker/queue.go 100.00% <0.00%> (+1.44%) ⬆️

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 782e84b...778656f. Read the comment docs.

@github-actions github-actions bot added the team/set SET team label Aug 25, 2020

func (i *indexerMetrics) View() []*metrics.View {
return []*metrics.View{
&metrics.View{
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 🐶
File is not gofmt-ed with -s (gofmt)

@@ -392,8 +394,27 @@ func (o *observer) requestBackup(ctx context.Context) error {
return nil
}

func (o *observer) backup(ctx context.Context) error {
func (o *observer) backup(ctx context.Context) (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 🐶
Function 'backup' has too many statements (42 > 40) (funlen)

@github-actions github-actions bot added size/XL and removed size/L labels Aug 26, 2020
@@ -392,8 +394,27 @@ func (o *observer) requestBackup(ctx context.Context) error {
return nil
}

func (o *observer) backup(ctx context.Context) error {
func (o *observer) backup(ctx context.Context) (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 🐶
cognitive complexity 53 of func (*observer).backup is high (> 30) (gocognit)

@@ -40,7 +40,90 @@ var (
LastValue = view.LastValue
Sum = view.Sum

DefaultMillisecondsDistribution = Distribution(0.01, 0.05, 0.1, 0.3, 0.6, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 130, 160, 200, 250, 300, 400, 500, 650, 800, 1000, 2000, 5000, 10000, 20000, 50000, 100000)
DefaultMillisecondsDistribution = Distribution(
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 🐶
DefaultMillisecondsDistribution is a global variable (gochecknoglobals)

50000,
100000,
)
RoughMillisecondsDistribution = Distribution(
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 🐶
RoughMillisecondsDistribution is a global variable (gochecknoglobals)

@@ -40,7 +40,90 @@ var (
LastValue = view.LastValue
Sum = view.Sum

DefaultMillisecondsDistribution = Distribution(0.01, 0.05, 0.1, 0.3, 0.6, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 130, 160, 200, 250, 300, 400, 500, 650, 800, 1000, 2000, 5000, 10000, 20000, 50000, 100000)
DefaultMillisecondsDistribution = Distribution(
0.01,
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 🐶
mnd: Magic number: 0.01, in detected (gomnd)

}

return []*metrics.View{
&metrics.View{
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 🐶
File is not gofmt-ed with -s (gofmt)

@rinx rinx marked this pull request as ready for review August 26, 2020 06:38
@rinx
Copy link
Contributor Author

rinx commented Sep 1, 2020

/rebase
/format

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Sep 1, 2020

[REBASE] Rebase triggered by rinx for branch: feature/observability/add-metrics-for-indexer-and-sidecar

@vdaas-ci vdaas-ci force-pushed the feature/observability/add-metrics-for-indexer-and-sidecar branch from e1c34ee to 6bfcf6b Compare September 1, 2020 05:43
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Sep 1, 2020

[FORMAT] Updating license headers and formatting go codes triggered by rinx.

@kpango
Copy link
Collaborator

kpango commented Sep 2, 2020

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Sep 2, 2020

[REBASE] Rebase triggered by kpango for branch: feature/observability/add-metrics-for-indexer-and-sidecar

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
@vdaas-ci vdaas-ci force-pushed the feature/observability/add-metrics-for-indexer-and-sidecar branch from 6bfcf6b to 778656f Compare September 2, 2020 09:41
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Sep 2, 2020

[FORMAT] Updating license headers and formatting go codes triggered by kpango.

Copy link
Collaborator

@vdaas-ci vdaas-ci left a comment

Choose a reason for hiding this comment

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

[APPROVED] This PR is approved by kpango.

ms []metrics.MeasurementWithTags
}

type MetricsHook interface {
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 🐶
exported type MetricsHook should have comment or be unexported (golint)

observer.Hook
}

func New() (MetricsHook, 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 🐶
exported function New should have comment or be unexported (golint)

sm.ms = append(
sm.ms,
metrics.MeasurementWithTags{
Measurement: sm.uploadTotal.M(1),
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 🐶
mnd: Magic number: 1, in detected (gomnd)

@kpango kpango merged commit b8f7ced into master Sep 2, 2020
@kpango kpango deleted the feature/observability/add-metrics-for-indexer-and-sidecar branch September 2, 2020 09:48
@vdaas-ci vdaas-ci mentioned this pull request Sep 2, 2020
18 tasks
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.

3 participants