-
Notifications
You must be signed in to change notification settings - Fork 255
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
优化 pandora key convert #621
Conversation
utils/models/utils.go
Outdated
func PandoraKey(key string) string { | ||
var nk string | ||
for _, c := range key { | ||
func PandoraKey(key string) (string, bool) { |
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.
我觉得加个注释说下这个函数具体是干什么比较好。。
} | ||
return nk | ||
if valid { | ||
return key, true |
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.
这里是true的话不要反回key
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.
性能还能提升
0b72938
to
07b4d9d
Compare
@@ -430,7 +430,7 @@ func formatKey(metricName string, statistic string) string { | |||
} | |||
|
|||
func snakeCase(s string) string { | |||
s = models.PandoraKey(s) | |||
s, _ = models.PandoraKey(s) |
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.
这里要判断是否为true
lgtm |
@wonderflow
@unknwon