Skip to content

Commit

Permalink
Appdynamics update (#544)
Browse files Browse the repository at this point in the history
* add labels for appdynamics

* update configure for appdynamics

* snakecase update
  • Loading branch information
kongfei605 authored Jun 16, 2023
1 parent 7fdef35 commit d6f2e4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conf/input.appdynamics/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# # 指定url_vars中哪些key 作为最终的label附加
# url_var_label_keys= []

# #从url中提取变量
# #从url中提取变量
# url_label_key="instance"
# url_label_value="{{.Host}}"
# #自定义 http header
Expand Down
12 changes: 9 additions & 3 deletions pkg/stringx/strx.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ func SnakeCase(in string) string {
if runes[i] == '.' {
continue
}
if i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {
if runes[i-1] != '_' {
out = append(out, '_')
if i > 0 {
if (runes[i] == '_' && runes[i-1] == '_') ||
(i == length-1 && runes[i] == '_') {
continue
}
if unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {
if runes[i-1] != '_' {
out = append(out, '_')
}
}
}
out = append(out, unicode.ToLower(runes[i]))
Expand Down

0 comments on commit d6f2e4d

Please sign in to comment.