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

优化 pandora key convert #621

Merged
merged 1 commit into from
Jul 20, 2018
Merged

Conversation

redHJ
Copy link
Collaborator

@redHJ redHJ commented Jul 20, 2018

func PandoraKey(key string) string {
var nk string
for _, c := range key {
func PandoraKey(key string) (string, bool) {
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

这里是true的话不要反回key

Copy link
Contributor

Choose a reason for hiding this comment

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

性能还能提升

@redHJ redHJ force-pushed the pandorakeyconvert branch 2 times, most recently from 0b72938 to 07b4d9d Compare July 20, 2018 07:39
@@ -430,7 +430,7 @@ func formatKey(metricName string, statistic string) string {
}

func snakeCase(s string) string {
s = models.PandoraKey(s)
s, _ = models.PandoraKey(s)
Copy link
Contributor

Choose a reason for hiding this comment

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

这里要判断是否为true

@wonderflow
Copy link
Contributor

lgtm

@wonderflow wonderflow merged commit 3ed7660 into qiniu:master Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants