@@ -3,6 +3,7 @@ package parser
33import (
44 "encoding/json"
55 "errors"
6+ "fmt"
67 "log"
78 "regexp"
89 "strings"
@@ -502,7 +503,7 @@ func (n *NDTParser) getAndInsertValues(test *fileInfoAndData, testType string) {
502503 }
503504 results ["connection_spec" ] = connSpec
504505
505- fixValues (results )
506+ n . fixValues (results )
506507 // TODO fix InsertRow so that we can distinguish errors from prior rows.
507508 metrics .EntryFieldCountHistogram .WithLabelValues (n .TableName ()).
508509 Observe (float64 (deltaFieldCount ))
@@ -547,7 +548,7 @@ const (
547548// fixValues updates web100 log values that need post-processing fix-ups.
548549// TODO(dev): does this only apply to NDT or is NPAD also affected?
549550// TODO(dev) - consider improving test coverage.
550- func fixValues (r schema.Web100ValueMap ) {
551+ func ( n * NDTParser ) fixValues (r schema.Web100ValueMap ) {
551552 connSpec := r .GetMap ([]string {"connection_spec" })
552553 logEntry := r .GetMap ([]string {"web100_log_entry" })
553554 snap := logEntry .GetMap ([]string {"snap" })
@@ -560,6 +561,17 @@ func fixValues(r schema.Web100ValueMap) {
560561 delete (connSpec , "client_hostname" )
561562 }
562563
564+ // If there is no meta file then the server hostname will not be set.
565+ if connSpec ["server_hostname" ] == "" {
566+ data , err := etl .ValidateTestPath (n .taskFileName )
567+ if err != nil {
568+ log .Println ("WARNING: taskFileName is unexpectedly invalid." )
569+ } else {
570+ connSpec ["server_hostname" ] = fmt .Sprintf (
571+ "%s.%s.%s" , data .Host , data .Pod , etl .MlabDomain )
572+ }
573+ }
574+
563575 // snapshot addresses are always authoritative. Other sources don't handle
564576 // ipv6 correctly. So, always substitute, unless for some reason the snapshot
565577 // value is missing.
0 commit comments