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
9 changes: 8 additions & 1 deletion contrib/opbot/botmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"log"
"math/big"
"regexp"
"sort"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -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>",

Check warning on line 54 in contrib/opbot/botmd/commands.go

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L54

Added line #L54 was not covered by tests
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

Description: "find a transaction in signoz",
Examples: []string{
"trace transaction_id:0x1234 serviceName:rfq",
Expand Down Expand Up @@ -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

if isDescending {
sort.Slice(traceList, func(i, j int) bool {
return traceList[i].Timestamp.After(traceList[j].Timestamp)
})

Check warning on line 113 in contrib/opbot/botmd/commands.go

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L109-L113

Added lines #L109 - L113 were not covered by tests
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

}
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


slackBlocks := []slack.Block{slack.NewHeaderBlock(slack.NewTextBlockObject(slack.PlainTextType, fmt.Sprintf("Traces for %s", tags), false, false))}

Expand Down
Loading