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

[SLT-152] feat(opbot): descending traces timestamp support #3092

Merged
merged 9 commits into from
Sep 17, 2024

Conversation

golangisfun123
Copy link
Collaborator

@golangisfun123 golangisfun123 commented Sep 3, 2024

Description
A clear and concise description of the features you're adding in this pull request.

Additional context
Add any other context about the problem you're solving.

Metadata

  • Fixes #[Link to Issue]

Summary by CodeRabbit

  • New Features

    • Enhanced the trace command functionality to allow users to specify sorting order directly through command input.
    • Improved tag handling by converting tags to lowercase and limiting the number of processed tags.
    • Added flexible sorting options for trace results based on user-defined keywords.
  • Bug Fixes

    • Improved consistency in tag processing and sorting logic for trace results.

Copy link
Contributor

coderabbitai bot commented Sep 3, 2024

Walkthrough

The changes enhance the traceCommand method in the Bot class by introducing an additional parameter for sorting order, allowing users to specify how trace results should be ordered. The method processes tag inputs by converting them to lowercase and limiting the number of tags. A boolean variable, isDescending, determines the sorting order based on specific keywords in the new parameter.

Changes

Files Change Summary
contrib/opbot/botmd/commands.go Modified traceCommand method to include an {order} parameter for sorting, standardize tag handling, and enhance sorting flexibility.

Poem

In the meadow where bunnies play,
Tags now dance in a uniform way.
With sorting so fine,
And traces align,
Oh, what a bright, hopping day! 🐇✨

Tip

Announcements
  • The review status is no longer posted as a separate comment when there are no actionable or nitpick comments. In such cases, the review status is included in the walkthrough comment.
  • We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs: Walkthrough comment now includes a list of potentially related PRs to help you recall past context. Please share any feedback in the discussion post on our Discord.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs in the walkthrough comment. You can also provide custom labeling instructions in the UI or configuration file.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b39d3d8 and dbdd179.

Files selected for processing (1)
  • contrib/opbot/botmd/commands.go (3 hunks)
Additional context used
GitHub Check: codecov/patch
contrib/opbot/botmd/commands.go

[warning] 54-54: contrib/opbot/botmd/commands.go#L54
Added line #L54 was not covered by tests


[warning] 57-59: contrib/opbot/botmd/commands.go#L57-L59
Added lines #L57 - L59 were not covered by tests


[warning] 63-63: contrib/opbot/botmd/commands.go#L63
Added line #L63 was not covered by tests


[warning] 112-117: contrib/opbot/botmd/commands.go#L112-L117
Added lines #L112 - L117 were not covered by tests

Additional comments not posted (1)
contrib/opbot/botmd/commands.go (1)

57-59: LGTM!

The code changes to add new examples for the trace command are approved.

Tools
GitHub Check: codecov/patch

[warning] 57-59: contrib/opbot/botmd/commands.go#L57-L59
Added lines #L57 - L59 were not covered by tests


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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@github-actions github-actions bot added go Pull requests that update Go code size/xs labels Sep 3, 2024
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Project coverage is 33.67474%. Comparing base (b4a560f) to head (dbdd179).
Report is 20 commits behind head on master.

Files with missing lines Patch % Lines
contrib/opbot/botmd/commands.go 0.00000% 11 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #3092         +/-   ##
===================================================
+ Coverage   25.09282%   33.67474%   +8.58192%     
===================================================
  Files            225         148         -77     
  Lines          12390        6444       -5946     
  Branches          82          82                 
===================================================
- Hits            3109        2170        -939     
+ Misses          9044        4139       -4905     
+ Partials         237         135        -102     
Flag Coverage Δ
opbot 0.49020% <0.00000%> (-0.00241%) ⬇️
promexporter ?
scribe ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

cloudflare-workers-and-pages bot commented Sep 3, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: dbdd179
Status: ✅  Deploy successful!
Preview URL: https://05b08f9e.sanguine-fe.pages.dev
Branch Preview URL: https://opbot-orders.sanguine-fe.pages.dev

View logs

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: 3

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4a17c15 and 983dd48.

Files selected for processing (1)
  • contrib/opbot/botmd/commands.go (4 hunks)
Additional context used
GitHub Check: codecov/patch
contrib/opbot/botmd/commands.go

[warning] 59-60: contrib/opbot/botmd/commands.go#L59-L60
Added lines #L59 - L60 were not covered by tests


[warning] 70-70: contrib/opbot/botmd/commands.go#L70
Added line #L70 was not covered by tests


[warning] 112-115: contrib/opbot/botmd/commands.go#L112-L115
Added lines #L112 - L115 were not covered by tests

Additional comments not posted (1)
contrib/opbot/botmd/commands.go (1)

12-12: LGTM!

The import statement for the sort package is approved.

Comment on lines 59 to 60
tags := strings.ToLower(stripLinks(ctx.Request().Param("tags")))
splitTags := strings.Split(tags, " ")[:2]
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

The code changes to standardize tag inputs and limit the number of tags are approved.

Consider adding test coverage.

The static analysis tool indicates that these lines are not covered by tests.

Do you want me to generate test cases for these lines or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 59-60: contrib/opbot/botmd/commands.go#L59-L60
Added lines #L59 - L60 were not covered by tests

@@ -65,6 +66,8 @@
return
}

isDescending := strings.Contains(tags, "desc") || strings.Contains(tags, "dsc") || strings.Contains(tags, "d")
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

The code change to introduce the isDescending variable is approved.

Consider adding test coverage.

The static analysis tool indicates that this line is not covered by tests.

Do you want me to generate test cases for this line or open a GitHub issue to track this task?

Comment on lines 111 to 115
if isDescending {
sort.Slice(traceList, func(i, j int) bool {
return traceList[i].Timestamp.After(traceList[j].Timestamp)
})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

The code changes to sort the traceList in descending order are approved.

Consider adding test coverage.

The static analysis tool indicates that these lines are not covered by tests.

Do you want me to generate test cases for these lines or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 112-115: contrib/opbot/botmd/commands.go#L112-L115
Added lines #L112 - L115 were not covered by tests

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: 3

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 983dd48 and b6472d7.

Files selected for processing (1)
  • contrib/opbot/botmd/commands.go (3 hunks)
Additional context used
GitHub Check: codecov/patch
contrib/opbot/botmd/commands.go

[warning] 54-54: contrib/opbot/botmd/commands.go#L54
Added line #L54 was not covered by tests


[warning] 109-113: contrib/opbot/botmd/commands.go#L109-L113
Added lines #L109 - L113 were not covered by tests

@@ -50,7 +51,7 @@
// TODO: add trace middleware.
func (b *Bot) traceCommand() *slacker.CommandDefinition {
return b.requiresSignoz(&slacker.CommandDefinition{
Command: "trace <tags>",
Command: "trace <tags> <order>",
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

The code change to introduce the <order> parameter is approved.

Consider adding test coverage.

The static analysis tool indicates that this line is not covered by tests.

Do you want me to generate test cases for this line or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 54-54: contrib/opbot/botmd/commands.go#L54
Added line #L54 was not covered by tests

@@ -105,6 +106,12 @@
}
return
}
isDescending := ctx.Request().Param("order") == "desc" || ctx.Request().Param("order") == "d"
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

The code change to introduce the isDescending variable is approved.

Consider adding test coverage.

The static analysis tool indicates that this line is not covered by tests.

Do you want me to generate test cases for this line or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 109-113: contrib/opbot/botmd/commands.go#L109-L113
Added lines #L109 - L113 were not covered by tests

Comment on lines 110 to 113
if isDescending {
sort.Slice(traceList, func(i, j int) bool {
return traceList[i].Timestamp.After(traceList[j].Timestamp)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

The code changes to sort the traceList in descending order are approved.

Consider adding test coverage.

The static analysis tool indicates that these lines are not covered by tests.

Do you want me to generate test cases for these lines or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 109-113: contrib/opbot/botmd/commands.go#L109-L113
Added lines #L109 - L113 were not covered by tests

@trajan0x trajan0x changed the title feat(opbot): descending traces timestamp support [SLT-152] feat(opbot): descending traces timestamp support Sep 10, 2024
Copy link

codecov bot commented Sep 10, 2024

Bundle Report

Changes will decrease total bundle size by 1 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
synapse-interface-server-cjs 1.47MB 1 bytes ⬇️

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: 3

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b39d3d8 and dbdd179.

Files selected for processing (1)
  • contrib/opbot/botmd/commands.go (3 hunks)
Additional context used
GitHub Check: codecov/patch
contrib/opbot/botmd/commands.go

[warning] 54-54: contrib/opbot/botmd/commands.go#L54
Added line #L54 was not covered by tests


[warning] 57-59: contrib/opbot/botmd/commands.go#L57-L59
Added lines #L57 - L59 were not covered by tests


[warning] 63-63: contrib/opbot/botmd/commands.go#L63
Added line #L63 was not covered by tests


[warning] 112-117: contrib/opbot/botmd/commands.go#L112-L117
Added lines #L112 - L117 were not covered by tests

Additional comments not posted (1)
contrib/opbot/botmd/commands.go (1)

57-59: LGTM!

The code changes to add new examples for the trace command are approved.

Tools
GitHub Check: codecov/patch

[warning] 57-59: contrib/opbot/botmd/commands.go#L57-L59
Added lines #L57 - L59 were not covered by tests

@@ -50,14 +51,16 @@
// TODO: add trace middleware.
func (b *Bot) traceCommand() *slacker.CommandDefinition {
return b.requiresSignoz(&slacker.CommandDefinition{
Command: "trace <tags>",
Command: "trace {tags} {order}",
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM, but consider adding test coverage.

The code change to introduce the {order} parameter is approved.

However, the static analysis tool indicates that this line is not covered by tests.

Do you want me to generate test cases for this line or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 54-54: contrib/opbot/botmd/commands.go#L54
Added line #L54 was not covered by tests

},
Handler: func(ctx *slacker.CommandContext) {
tags := stripLinks(ctx.Request().Param("tags"))
splitTags := strings.Split(tags, " ")
splitTags := strings.Split(tags, "@")
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM, but consider adding test coverage.

The code change to convert the tags parameter to lowercase is approved.

However, the static analysis tool indicates that this line is not covered by tests.

Do you want me to generate test cases for this line or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 63-63: contrib/opbot/botmd/commands.go#L63
Added line #L63 was not covered by tests

Comment on lines +112 to +117
order := strings.ToLower(ctx.Request().Param("order"))
isAscending := order == "a" || order == "asc"
if isAscending {
sort.Slice(traceList, func(i, j int) bool {
return traceList[i].Timestamp.Before(traceList[j].Timestamp)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM, but consider adding test coverage.

The code changes to introduce the isAscending variable and sort the traceList in ascending order are approved.

However, the static analysis tool indicates that these lines are not covered by tests.

Do you want me to generate test cases for these lines or open a GitHub issue to track this task?

Tools
GitHub Check: codecov/patch

[warning] 112-117: contrib/opbot/botmd/commands.go#L112-L117
Added lines #L112 - L117 were not covered by tests

@trajan0x trajan0x merged commit 9aadad2 into master Sep 17, 2024
28 of 29 checks passed
@trajan0x trajan0x deleted the opbot-orders branch September 17, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size/xs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants