-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1603 from ydb-platform/fix-conns-counter
fix broken metric `ydb_go_sdk_ydb_database_sql_conns`
- Loading branch information
Showing
12 changed files
with
256 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package xslices | ||
|
||
import ( | ||
"cmp" | ||
"slices" | ||
) | ||
|
||
func Keys[Key cmp.Ordered, T any](m map[Key]T) []Key { | ||
keys := make([]Key, 0, len(m)) | ||
|
||
for key := range m { | ||
keys = append(keys, key) | ||
} | ||
|
||
slices.Sort(keys) | ||
|
||
return keys | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package xslices | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestKeys(t *testing.T) { | ||
require.Equal(t, []string{"1", "2"}, Keys(map[string]any{ | ||
"1": nil, | ||
"2": nil, | ||
})) | ||
require.Equal(t, []int{1, 2}, Keys(map[int]any{ | ||
1: nil, | ||
2: nil, | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.