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

feat!: added receiving a logger object #470

Merged
merged 2 commits into from
Jul 5, 2024

Conversation

mojtaba-esk
Copy link
Contributor

@mojtaba-esk mojtaba-esk commented Jul 2, 2024

Closes #446

Summary by CodeRabbit

  • Refactor

    • Standardized logging across Kubernetes and Minio clients by passing a consistent logger parameter to various functions.
  • New Features

    • Introduced centralized logging in the Minio struct, enhancing traceability and debugging capabilities.

@mojtaba-esk mojtaba-esk added this to the v0.15.0 milestone Jul 2, 2024
@mojtaba-esk mojtaba-esk requested a review from a team July 2, 2024 09:17
@mojtaba-esk mojtaba-esk self-assigned this Jul 2, 2024
Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

The recent updates refactor the Minio package to accept a logger object instead of relying on the default logrus logger. This change introduces new parameters to the k8s.NewClient and minio.New function calls within the end-to-end tests and internal pkg/knuu. The updated functions now ensure consistent logging behavior by utilizing the same logger instance throughout the implementation.

Changes

Files Change Summary
e2e/system/build_from_git_test.go, e2e/tshark/... Updated function calls to k8s.NewClient and minio.New to include a logger parameter.
pkg/knuu/knuu_old.go Modified InitializeWithScope to pass a logger when creating minioClient.
pkg/minio/minio.go Added Logger field to Minio struct and updated New function to accept a logger. Replaced logging calls.

Assessment against linked issues

Objective Addressed Explanation
Refactor Minio pkg to receive a logger object instead of default logrus (#446)

Poem

In the code, a change does ring,
Loggers unified, let them sing,
Minio and Kubernetes in stride,
With logrus, now they glide.
Debugging's now a delight,
Through the logs, each byte in sight.


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 Configration 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
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 73b30c8 and 74e4ad8.

Files selected for processing (4)
  • e2e/system/build_from_git_test.go (1 hunks)
  • e2e/tshark/tshark_test.go (1 hunks)
  • pkg/knuu/knuu_old.go (1 hunks)
  • pkg/minio/minio.go (13 hunks)
Additional comments not posted (13)
e2e/tshark/tshark_test.go (2)

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

The code changes are approved.

However, ensure that all function calls to k8s.NewClient and minio.New match the new signature.


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

The code changes are approved.

However, ensure that all function calls to minio.New match the new signature.

Verification successful

All function calls to minio.New match the new signature.

  • pkg/knuu/knuu_old.go:83
  • e2e/system/build_from_git_test.go:80
  • e2e/tshark/tshark_test.go:41
Scripts executed

The following scripts were executed for the analysis:


Script:

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

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go $'minio.New'

Length of output: 270



Script:

#!/bin/bash
# Extract lines containing `minio.New` from the identified files to verify their signatures.
rg --type go --line-number "minio.New" e2e/system/build_from_git_test.go pkg/knuu/knuu_old.go

Length of output: 264

e2e/system/build_from_git_test.go (2)

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

The code changes are approved.

However, ensure that all function calls to minio.New match the new signature.

Verification successful

Verified function usage in the codebase.

All occurrences of minio.New match the new signature (ctx, k8sClient, logger).

  • pkg/knuu/knuu_old.go
  • e2e/tshark/tshark_test.go
  • e2e/system/build_from_git_test.go
Scripts executed

The following scripts were executed for the analysis:


Script:

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

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go $'minio.New'

Length of output: 270



Script:

#!/bin/bash
# Description: Verify the function signature of `minio.New` in the identified files.

# Check the function signature in pkg/knuu/knuu_old.go
echo "Checking pkg/knuu/knuu_old.go"
rg --context 2 'minio.New' pkg/knuu/knuu_old.go

# Check the function signature in e2e/tshark/tshark_test.go
echo "Checking e2e/tshark/tshark_test.go"
rg --context 2 'minio.New' e2e/tshark/tshark_test.go

# Check the function signature in e2e/system/build_from_git_test.go
echo "Checking e2e/system/build_from_git_test.go"
rg --context 2 'minio.New' e2e/system/build_from_git_test.go

Length of output: 911


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

The code changes are approved.

However, ensure that all function calls to k8s.NewClient match the new signature.

Verification successful

Verification successful. All occurrences of k8s.NewClient and k8s.NewClientCustom include the logger parameter, matching the new function signature.

  • pkg/knuu/knuu.go
  • pkg/k8s/test_suite_test.go
  • pkg/knuu/knuu_old.go
  • pkg/builder/kaniko/kaniko_test.go
  • e2e/tshark/tshark_test.go
  • e2e/system/build_from_git_test.go
Scripts executed

The following scripts were executed for the analysis:


Script:

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

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go $'k8s.NewClient'

Length of output: 607



Script:

#!/bin/bash
# Description: Verify all occurrences of `k8s.NewClient` and `k8s.NewClientCustom` match the new signature.

# Extracting lines around the occurrences to inspect the function signature.
rg --type go --context 2 'k8s.NewClient' > new_client_occurrences.txt
rg --type go --context 2 'k8s.NewClientCustom' > new_client_custom_occurrences.txt

# Display the files with occurrences for manual inspection.
cat new_client_occurrences.txt
cat new_client_custom_occurrences.txt

Length of output: 2622

pkg/knuu/knuu_old.go (1)

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

The code changes are approved.

However, ensure that all function calls to minio.New match the new signature.

Verification successful

All instances of minio.New match the new signature. No issues found.

  • pkg/knuu/knuu_old.go at line 83
  • e2e/tshark/tshark_test.go at line 41
  • e2e/system/build_from_git_test.go at line 80
Scripts executed

The following scripts were executed for the analysis:


Script:

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

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go $'minio.New'

Length of output: 270



Script:

#!/bin/bash
# Verify that the function calls to `minio.New` match the new signature in the identified files.

# Check the specific lines in each file
rg --line-number 'minio.New' pkg/knuu/knuu_old.go
rg --line-number 'minio.New' e2e/tshark/tshark_test.go
rg --line-number 'minio.New' e2e/system/build_from_git_test.go

Length of output: 341

pkg/minio/minio.go (8)

50-50: LGTM!

The code changes are approved.


100-100: LGTM!

The code changes are approved.


121-121: LGTM!

The code changes are approved.


177-177: LGTM!

The code changes are approved.


249-249: LGTM!

The code changes are approved.

Also applies to: 259-259


297-297: LGTM!

The code changes are approved.

Also applies to: 302-302, 311-311


398-398: LGTM!

The code changes are approved.

Also applies to: 439-439, 462-462


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

The code changes are approved.

However, ensure that all function calls to New match the new signature.

@smuu smuu merged commit 198f896 into main Jul 5, 2024
4 of 9 checks passed
@smuu smuu deleted the mojtaba/446-refactoring-Minio-pkg-to-receive-a-logger branch July 5, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Consider refactoring Minio pkg to receive a logger object instead of default logrus
3 participants