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

fix passing options to logscribe consumer #2254

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

Intizar-T
Copy link
Contributor

Description

allow customizing important params, service, logscribe endpoing, buffer size, etc., from logscribe consumer

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.

Deployment

  • Should publish npm package
  • Should publish Docker image

@Intizar-T Intizar-T self-assigned this Aug 29, 2024
@Intizar-T Intizar-T requested a review from a team as a code owner August 29, 2024 06:42
Copy link
Contributor

coderabbitai bot commented Aug 29, 2024

Walkthrough

Walkthrough

The changes involve modifying the invocation of the logscribeconsumer.Start function across multiple files. The function's signature has been updated to accept functional options instead of a single string identifier. This adjustment enhances flexibility in configuration, allowing for more modular and extensible design patterns throughout the codebase.

Changes

File Path Change Summary
node/cmd/api/main.go Updated logscribeconsumer.Start to use WithStoreService("api") instead of a string.
node/cmd/boot_api/main.go Changed logscribeconsumer.Start to accept WithStoreService("boot_api") as an option.
node/cmd/dal/main.go Modified logscribeconsumer.Start to use WithStoreService("dal") instead of a string.
node/cmd/delegator/main.go Altered logscribeconsumer.Start to include WithStoreService("delegator") as an option.
node/cmd/node/main.go Changed logscribeconsumer.Start to utilize WithStoreService("node") instead of a string.
node/cmd/por/main.go Updated logscribeconsumer.Start to use WithStoreService("por") instead of a string.
node/cmd/reporter/main.go Modified logscribeconsumer.Start to include WithStoreService("reporter") as an option.
node/cmd/sentinel/main.go Changed logscribeconsumer.Start to utilize WithStoreService("sentinel") instead of a string.
node/pkg/logscribeconsumer/app.go Updated Start function in App struct to accept variadic AppOption instead of a string.

Sequence Diagram(s)

sequenceDiagram
    participant Main
    participant LogscribeConsumer

    Main->>LogscribeConsumer: Start(ctx, WithStoreService("identifier"))
    LogscribeConsumer-->>Main: Success/Error
Loading

🐰 "Oh, what a change in the code we see,
Options now dance, so wild and free!
No more just strings, but choices galore,
Flexibility blooms, who could ask for more?
Hopping through functions, we celebrate,
In the garden of code, we cultivate!" 🌼


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.

Copy link
Collaborator

@nick-bisonai nick-bisonai left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e7b8270 and fc1ed96.

Files selected for processing (9)
  • node/cmd/api/main.go (1 hunks)
  • node/cmd/boot_api/main.go (1 hunks)
  • node/cmd/dal/main.go (1 hunks)
  • node/cmd/delegator/main.go (1 hunks)
  • node/cmd/node/main.go (1 hunks)
  • node/cmd/por/main.go (1 hunks)
  • node/cmd/reporter/main.go (1 hunks)
  • node/cmd/sentinel/main.go (1 hunks)
  • node/pkg/logscribeconsumer/app.go (1 hunks)
Additional comments not posted (10)
node/cmd/por/main.go (1)

14-14: LGTM!

The change enhances the flexibility of the Start function by allowing it to accept configuration options. This is a positive change as it makes the function more modular and extensible.

The code changes are approved.

node/cmd/dal/main.go (1)

15-15: LGTM!

The change enhances the flexibility of the Start function by allowing it to accept configuration options. This is a positive change as it makes the function more modular and extensible.

The code changes are approved.

node/cmd/boot_api/main.go (1)

15-15: LGTM!

The change enhances the flexibility of the Start function by allowing it to accept configuration options. This is a positive change as it makes the function more modular and extensible.

The code changes are approved.

node/cmd/reporter/main.go (1)

19-19: LGTM! But verify the function usage in the codebase.

The change enhances flexibility by allowing more structured configuration options. Ensure that all function calls to logscribeconsumer.Start match the new signature.

The code changes are approved.

Run the following script to verify the function usage:

Verification successful

Verification Successful: All instances of logscribeconsumer.Start use the new signature.

The function logscribeconsumer.Start is consistently used with the logscribeconsumer.WithStoreService option across the codebase, ensuring the new signature is correctly implemented.

  • Files verified include main.go in sentinel, reporter, por, node, delegator, dal, boot_api, and api.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `logscribeconsumer.Start` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'logscribeconsumer.Start'

Length of output: 2619

node/cmd/delegator/main.go (1)

31-31: LGTM! But verify the function usage in the codebase.

The change enhances flexibility by allowing more structured configuration options. Ensure that all function calls to logscribeconsumer.Start match the new signature.

The code changes are approved.

Run the following script to verify the function usage:

Verification successful

Function usage verified successfully.

All instances of logscribeconsumer.Start in the codebase match the new signature with logscribeconsumer.WithStoreService. No discrepancies were found.

  • Files with updated usage:
    • node/cmd/node/main.go
    • node/cmd/sentinel/main.go
    • node/cmd/reporter/main.go
    • node/cmd/por/main.go
    • node/cmd/delegator/main.go
    • node/cmd/boot_api/main.go
    • node/cmd/dal/main.go
    • node/cmd/api/main.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `logscribeconsumer.Start` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'logscribeconsumer.Start'

Length of output: 2619

node/cmd/api/main.go (1)

32-35: LGTM! But verify the function usage in the codebase.

The change enhances flexibility by allowing more structured configuration options. Ensure that all function calls to logscribeconsumer.Start match the new signature.

The code changes are approved.

Run the following script to verify the function usage:

Verification successful

Function usage verified successfully.

All instances of logscribeconsumer.Start in the codebase use the new signature with logscribeconsumer.WithStoreService, confirming consistent application of the change.

  • node/cmd/reporter/main.go
  • node/cmd/sentinel/main.go
  • node/cmd/por/main.go
  • node/cmd/node/main.go
  • node/cmd/delegator/main.go
  • node/cmd/api/main.go
  • node/cmd/boot_api/main.go
  • node/cmd/dal/main.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `logscribeconsumer.Start` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'logscribeconsumer.Start'

Length of output: 2619

node/cmd/node/main.go (1)

24-24: LGTM!

The update to use functional options in the logscribeconsumer.Start function call enhances flexibility and aligns with common patterns in Go for managing options.

The code changes are approved.

node/cmd/sentinel/main.go (1)

26-26: LGTM!

The update to use functional options in the logscribeconsumer.Start function call enhances flexibility and aligns with common patterns in Go for managing options.

The code changes are approved.

node/pkg/logscribeconsumer/app.go (2)

97-99: LGTM!

The update to the Start function signature to accept variadic parameters of type AppOption enhances flexibility and aligns with common patterns in Go for managing options.

The code changes are approved.


99-99: LGTM!

The update to utilize the new options parameter in the instantiation of the App object enhances flexibility and aligns with common patterns in Go for managing options.

The code changes are approved.

@Intizar-T Intizar-T merged commit 9e49285 into master Aug 29, 2024
3 checks passed
@Intizar-T Intizar-T deleted the fix/logscribe-consumer-options branch August 29, 2024 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants