@@ -48,7 +48,9 @@ func handleIP(connSpec schema.Web100ValueMap, prefix string, ipString string) {
4848 connSpec .SetString (prefix + "_ip" , ipString )
4949 ip := net .ParseIP (ipString )
5050 if ip == nil {
51- // TODO - log/metric
51+ log .Printf ("Failed parsing connSpec IP: %s\n " , ipString )
52+ metrics .WarningCount .WithLabelValues (
53+ "ndt" , "unknown" , "failed parsing connSpec IP" ).Inc ()
5254 } else {
5355 connSpec .SetString (prefix + "_ip" , ip .String ())
5456 if ip .To4 () != nil {
@@ -62,18 +64,33 @@ func handleIP(connSpec schema.Web100ValueMap, prefix string, ipString string) {
6264func (mfd * MetaFileData ) PopulateConnSpec (connSpec schema.Web100ValueMap ) {
6365 for k , v := range fieldPairs {
6466 s , ok := mfd .Fields [k ]
65- if ok && s != "" {
66- connSpec .SetString (v , s )
67+ if ok {
68+ if s != "" {
69+ connSpec .SetString (v , s )
70+ }
71+ } else {
72+ log .Printf ("Missing field: %s %v\n " , k , v )
6773 }
6874 }
69- s , ok := mfd . Fields ["server_ip" ]
75+ s , ok := connSpec ["server_ip" ]
7076 // TODO - extract function for this stanza
71- if ok && s != "" {
72- handleIP (connSpec , "server" , s )
77+ if ok {
78+ if s != "" {
79+ handleIP (connSpec , "server" , s .(string ))
80+ }
81+ } else {
82+ metrics .WarningCount .WithLabelValues (
83+ "table" , "unknown" , "missing server_ip" ).Inc ()
7384 }
74- s , ok = mfd .Fields ["client_ip" ]
75- if ok && s != "" {
76- handleIP (connSpec , "client" , s )
85+ s , ok = connSpec ["client_ip" ]
86+ if ok {
87+ if s != "" {
88+ handleIP (connSpec , "client" , s .(string ))
89+ }
90+ } else {
91+ log .Println ("client_ip missing from .meta" )
92+ metrics .WarningCount .WithLabelValues (
93+ "table" , "unknown" , "missing client_ip" ).Inc ()
7794 }
7895}
7996
0 commit comments