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

[WIP] Implement ngt Statistics API #2533

Closed
wants to merge 1 commit into from

Conversation

kpango
Copy link
Collaborator

@kpango kpango commented Jul 24, 2024

Description

Summary

This pull request introduces several significant updates and enhancements, primarily focusing on adding new API functionalities for index statistics and improving observability metrics.

The _test.go and pb.go diffs are just re-generated please ignore them.

Changes

  1. Protobuf Updates:

    • Added Info.Index.Statistics to apis/proto/v1/payload/payload.proto.
    • Introduced IndexStatistics and IndexStatisticsDetail APIs in apis/proto/v1/vald/index.proto to return Info.Index.Statistics.
  2. Handler Implementations:

    • Implemented IndexStatistics and IndexStatisticsDetail API handlers in pkg/gateway/lb/handler/grpc/handler.go.
    • Added the same API handlers in pkg/agent/core/ngt/service/ngt.go.
  3. Algorithm Enhancements:

    • Added GraphStatistics struct and GetGraphStatistics(m statisticsType) (stats *GraphStatistics, err error) function in internal/core/algorithm/ngt/ngt.go to enable retrieval of index statistics.
    • Incorporated logic to obtain GraphStatistics post CreateIndex based on options in pkg/agent/core/ngt/service/ngt.go.
  4. Metrics Export:

    • Added export processing for GraphStatistics metrics in internal/observability/metrics/agent/core/ngt/ngt.go.
    • Introduced type aliases for Int64ObservableGauge and Float64ObservableGauge in internal/observability/metrics/metrics.go.
  5. Configuration and Formatting:

    • Updated .github/workflows/format.yml to add ignore settings for Format and license.
    • Enhanced Makefile under format/go to include formatting of artifacts generated from Proto.

Additional Notes

  • These changes enhance the functionality of the Vald project by providing detailed index statistics, which are crucial for monitoring and performance tuning.
  • The observability improvements will facilitate better metric tracking and reporting, contributing to overall system stability and performance.

Related Issue

Versions

  • Go Version: 1.22.5
  • Rust Version: 1.77.2
  • Docker Version: 20.10.8
  • Kubernetes Version: v1.30.3
  • NGT Version: 2.2.3

Checklist

Special notes for your reviewer

Copy link
Contributor

coderabbitai bot commented Jul 24, 2024

Important

Review skipped

Ignore keyword(s) in the title.

Ignored keywords (3)
  • WIP
  • DO NOT MERGE
  • DNM

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vdaas-ci
Copy link
Collaborator

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

Copy link

cloudflare-workers-and-pages bot commented Jul 24, 2024

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: 714027d
Status: ✅  Deploy successful!
Preview URL: https://898c68e1.vald.pages.dev
Branch Preview URL: https://feature-agent-ngt-statistics.vald.pages.dev

View logs

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 0.94340% with 315 lines in your changes missing coverage. Please review.

Project coverage is 7.90%. Comparing base (76eb8d7) to head (e445bb1).
Report is 1 commits behind head on main.

Files Patch % Lines
apis/grpc/v1/payload/payload.pb.go 0.48% 205 Missing ⚠️
internal/core/algorithm/ngt/ngt.go 0.00% 62 Missing ⚠️
apis/grpc/v1/vald/index_vtproto.pb.go 0.00% 40 Missing ⚠️
apis/grpc/v1/payload/payload.pb.json.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #2533       +/-   ##
==========================================
- Coverage   18.43%   7.90%   -10.54%     
==========================================
  Files         566     162      -404     
  Lines       66342   35872    -30470     
==========================================
- Hits        12232    2835     -9397     
+ Misses      53320   32736    -20584     
+ Partials      790     301      -489     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kpango kpango force-pushed the feature/agent/ngt-statistics-api branch 4 times, most recently from 164ac1a to 826cd8e Compare July 24, 2024 08:07
@kpango kpango force-pushed the feature/agent/ngt-statistics-api branch 2 times, most recently from cfbaf2f to 2b3754d Compare July 24, 2024 08:41
@kpango kpango force-pushed the feature/agent/ngt-statistics-api branch from 99cfe7e to 597f8e2 Compare July 25, 2024 01:08
deepsource-autofix bot added a commit that referenced this pull request Jul 25, 2024
This commit fixes the style issues introduced in 597f8e2 according to the output
from Gofumpt and Prettier.

Details: #2533
@vdaas-ci
Copy link
Collaborator

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

@kpango kpango force-pushed the feature/agent/ngt-statistics-api branch 3 times, most recently from 6047dc0 to 3df1ba1 Compare July 25, 2024 01:49
@kpango kpango force-pushed the feature/agent/ngt-statistics-api branch 4 times, most recently from 496be06 to c460b18 Compare July 25, 2024 02:22
deepsource-autofix bot added a commit that referenced this pull request Jul 25, 2024
This commit fixes the style issues introduced in c460b18 according to the output
from Gofumpt and Prettier.

Details: #2533
@kpango kpango force-pushed the feature/agent/ngt-statistics-api branch 2 times, most recently from 50f5c99 to bb96c49 Compare July 25, 2024 02:53
return merged
}

var indegrees, outdegrees []int32
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 🐶
Consider pre-allocating indegrees (prealloc)

}

var indegrees, outdegrees []int32
var indegreeCounts [][]int64
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 🐶
Consider pre-allocating indegreeCounts (prealloc)


var indegrees, outdegrees []int32
var indegreeCounts [][]int64
var outdegreeHistograms, indegreeHistograms [][]uint64
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 🐶
Consider pre-allocating outdegreeHistograms (prealloc)


func mergeInfoIndexStatistics(
stats map[string]*payload.Info_Index_Statistics,
) *payload.Info_Index_Statistics {
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 🐶
mergeInfoIndexStatistics - result 0 (*github.com/vdaas/vald/apis/grpc/v1/payload.Info_Index_Statistics) is always nil (unparam)

// type want struct{}
// type test struct {
// name string
// want want
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 🐶
Duplicate words (want) found (dupword)

// type fields struct {
// eg errgroup.Group
// dataset *config.BenchmarkDataset
// jobType jobType
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 🐶
Duplicate words (jobType) found (dupword)

// type fields struct {
// eg errgroup.Group
// dataset *config.BenchmarkDataset
// jobType jobType
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 🐶
Duplicate words (jobType) found (dupword)

// type fields struct {
// eg errgroup.Group
// dataset *config.BenchmarkDataset
// jobType jobType
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 🐶
Duplicate words (jobType) found (dupword)

@@ -61,8 +158,8 @@ func New(n service.NGT) metrics.Metric {
}
}

func (n *ngtMetrics) View() ([]metrics.View, error) {
return []metrics.View{
func (n *ngtMetrics) View() (mv []metrics.View, 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 name: View, Cyclomatic Complexity: 2, Halstead Volume: 5766.49, Maintainability Index: 17 (maintidx)

}

func (n *ngtMetrics) Register(m metrics.Meter) error {
indexCount, err := m.Int64ObservableGauge(
func (n *ngtMetrics) Register(m metrics.Meter) (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 name: Register, Cyclomatic Complexity: 51, Halstead Volume: 12248.73, Maintainability Index: 4 (maintidx)

@kpango kpango force-pushed the feature/agent/ngt-statistics-api branch 7 times, most recently from 739fc7a to 6717995 Compare July 25, 2024 08:13
Signed-off-by: kpango <kpango@vdaas.org>
@kpango kpango force-pushed the feature/agent/ngt-statistics-api branch from 6717995 to 714027d Compare July 25, 2024 08:14
@kpango kpango closed this Jul 25, 2024
@kpango kpango deleted the feature/agent/ngt-statistics-api branch July 25, 2024 08:25
@kpango kpango restored the feature/agent/ngt-statistics-api branch July 25, 2024 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment