-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove high cardinality labels server_route_id and server_gateway_id (#…
…192) * remove high cardinality labels server_route_id and server_gateway_id Signed-off-by: Caleb Lloyd <[email protected]> * remap route/gateway IDs to indexes Signed-off-by: Caleb Lloyd <[email protected]> * lint Signed-off-by: Caleb Lloyd <[email protected]> --------- Signed-off-by: Caleb Lloyd <[email protected]>
- Loading branch information
1 parent
a3f567d
commit 4dcf040
Showing
8 changed files
with
156 additions
and
149 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
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
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,49 @@ | ||
package surveyor | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestRemapIdToIdx(t *testing.T) { | ||
existingMapping := map[string]map[uint64]int{ | ||
"a": { | ||
100: 0, | ||
200: 2, | ||
}, | ||
"b": { | ||
100: 0, | ||
}, | ||
} | ||
|
||
pairs := []nameIDPair{ | ||
{name: "a", id: 200}, | ||
{name: "a", id: 100}, | ||
{name: "a", id: 300}, | ||
{name: "a", id: 400}, | ||
{name: "b", id: 200}, | ||
{name: "c", id: 200}, | ||
{name: "c", id: 100}, | ||
} | ||
|
||
newMapping := remapIDToIdx(pairs, existingMapping) | ||
expected := map[string]map[uint64]int{ | ||
"a": { | ||
100: 0, | ||
200: 2, | ||
300: 1, | ||
400: 3, | ||
}, | ||
"b": { | ||
200: 0, | ||
}, | ||
"c": { | ||
200: 0, | ||
100: 1, | ||
}, | ||
} | ||
|
||
if !reflect.DeepEqual(expected, newMapping) { | ||
t.Fatalf("Invalid mapping config; want: %v; got: %v", expected, newMapping) | ||
} | ||
} |
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