diff --git a/decode/decode.go b/decode/decode.go index cfacd9d..0a89db6 100644 --- a/decode/decode.go +++ b/decode/decode.go @@ -319,9 +319,14 @@ func ExtractKVMeta(kvlog map[string]interface{}) KVMeta { tmp, ok = kvmeta["routes"] if ok { - routes, ok := tmp.([]map[string]interface{}) + routes, ok := tmp.([]interface{}) if ok { - kvRoutes = routes + for _, route := range routes { + rule, ok := route.(map[string]interface{}) + if ok { // TODO: log error + kvRoutes = append(kvRoutes, rule) + } + } } } diff --git a/decode/decode_test.go b/decode/decode_test.go index 9f7a123..4ec3ab6 100644 --- a/decode/decode_test.go +++ b/decode/decode_test.go @@ -551,7 +551,7 @@ func TestExtractKVMeta(t *testing.T) { "team": "green", "kv_version": "three", "kv_language": "tree", - "routes": []map[string]interface{}{ + "routes": []interface{}{ map[string]interface{}{ "type": "metrics", "rule": "cool", @@ -590,7 +590,7 @@ func TestExtractKVMeta(t *testing.T) { "team": "green", "kv_version": "christmas", "kv_language": "tree", - "routes": []map[string]interface{}{ + "routes": []interface{}{ map[string]interface{}{ "type": "analytics", "rule": "what's-this?", @@ -632,7 +632,7 @@ func TestExtractKVMeta(t *testing.T) { "team": "slack", "kv_version": "evergreen", "kv_language": "markdown-ish", - "routes": []map[string]interface{}{ + "routes": []interface{}{ map[string]interface{}{ "type": "notifications", "rule": "did-you-know", @@ -678,7 +678,7 @@ func TestExtractKVMeta(t *testing.T) { "team": "a-team", "kv_version": "old", "kv_language": "jive", - "routes": []map[string]interface{}{ + "routes": []interface{}{ map[string]interface{}{ "type": "alerts", "rule": "last-call", @@ -740,7 +740,7 @@ func TestExtractKVMeta(t *testing.T) { "team": "diversity", "kv_version": "kv-routes", "kv_language": "understanding", - "routes": []map[string]interface{}{ + "routes": []interface{}{ map[string]interface{}{ "type": "metrics", "rule": "all-combos",