-
Notifications
You must be signed in to change notification settings - Fork 32
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
Changes from 1 commit
983dd48
a25e2b5
b6472d7
c64526f
15f48b2
b0337ac
3d6f64e
b39d3d8
dbdd179
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
"log" | ||
"math/big" | ||
"regexp" | ||
"sort" | ||
"strings" | ||
"sync" | ||
"time" | ||
|
@@ -55,8 +56,8 @@ | |
"trace transaction_id:0x1234 serviceName:rfq", | ||
}, | ||
Handler: func(ctx *slacker.CommandContext) { | ||
tags := stripLinks(ctx.Request().Param("tags")) | ||
splitTags := strings.Split(tags, " ") | ||
tags := strings.ToLower(stripLinks(ctx.Request().Param("tags"))) | ||
splitTags := strings.Split(tags, " ")[:2] | ||
if len(splitTags) == 0 { | ||
_, err := ctx.Response().Reply("please provide tags in a key:value format") | ||
if err != nil { | ||
|
@@ -65,6 +66,8 @@ | |
return | ||
} | ||
|
||
isDescending := strings.Contains(tags, "desc") || strings.Contains(tags, "dsc") || strings.Contains(tags, "d") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM! The code change to introduce the 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? |
||
|
||
searchMap := make(map[string]string) | ||
for _, combinedTag := range splitTags { | ||
tag := strings.Split(combinedTag, ":") | ||
|
@@ -105,6 +108,12 @@ | |
return | ||
} | ||
|
||
if isDescending { | ||
sort.Slice(traceList, func(i, j int) bool { | ||
return traceList[i].Timestamp.After(traceList[j].Timestamp) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM! The code changes to sort the 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? ToolsGitHub Check: codecov/patch
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM! The code changes to sort the 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? ToolsGitHub Check: codecov/patch
|
||
|
||
slackBlocks := []slack.Block{slack.NewHeaderBlock(slack.NewTextBlockObject(slack.PlainTextType, fmt.Sprintf("Traces for %s", tags), false, false))} | ||
|
||
for _, results := range traceList { | ||
|
There was a problem hiding this comment.
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