@@ -374,7 +374,8 @@ func NewPTParser(ins etl.Inserter, ann ...v2as.Annotator) *PTParser {
374374}
375375
376376// ProcessAllNodes take the array of the Nodes, and generate one ScamperHop entry from each node.
377- func ProcessAllNodes (allNodes []Node , server_IP , protocol string , tableName string ) []schema.ScamperHop {
377+ func ProcessAllNodes (allNodes []Node , server_IP , protocol string , tableName string ,
378+ logTime time.Time , machine string ) []schema.ScamperHop {
378379 var results []schema.ScamperHop
379380 if len (allNodes ) == 0 {
380381 return nil
@@ -399,6 +400,7 @@ func ProcessAllNodes(allNodes []Node, server_IP, protocol string, tableName stri
399400 source := schema.HopIP {
400401 IP : server_IP ,
401402 }
403+ source .HopAnnotation1 = getParisHopAnnotation (logTime , machine , source .IP )
402404 oneHop := schema.ScamperHop {
403405 Source : source ,
404406 Links : links ,
@@ -410,6 +412,7 @@ func ProcessAllNodes(allNodes []Node, server_IP, protocol string, tableName stri
410412 IP : allNodes [i ].parent_ip ,
411413 Hostname : allNodes [i ].parent_hostname ,
412414 }
415+ source .HopAnnotation1 = getParisHopAnnotation (logTime , machine , source .IP )
413416 oneHop := schema.ScamperHop {
414417 Source : source ,
415418 Links : links ,
@@ -420,6 +423,16 @@ func ProcessAllNodes(allNodes []Node, server_IP, protocol string, tableName stri
420423 return results
421424}
422425
426+ // getParisHopAnnotation() returns returns a new `*hopannotation.HopAnnotation1` to use
427+ // as a synthetic annotation for paris-traceroute hops.
428+ func getParisHopAnnotation (logTime time.Time , machine string , IP string ) * hopannotation.HopAnnotation1 {
429+ hopID := GetHopID (float64 (logTime .UTC ().Unix ()), machine , IP )
430+ return & hopannotation.HopAnnotation1 {
431+ ID : hopID ,
432+ Timestamp : logTime ,
433+ }
434+ }
435+
423436// This function was designed for hops with multiple flows. When the source IP are duplicate flows, but the destination IP is
424437// single flow IP, those hops will result in just one node in the list.
425438func Unique (oneNode Node , list []Node ) bool {
@@ -587,12 +600,12 @@ func (pt *PTParser) ParseAndInsert(meta map[string]bigquery.Value, testName stri
587600 return nil
588601 }
589602
603+ // ArchiveURL must already be valid, so error is safe to ignore.
604+ dp , _ := etl .ValidateTestPath (pt .taskFileName )
590605 // Process the jsonl output of Scamper binary.
591606 if strings .HasSuffix (testName , ".jsonl" ) {
592607 ptTest , err := ParseJSONL (testName , rawContent , pt .TableName (), pt .taskFileName )
593608 if err == nil {
594- // ArchiveURL must already be valid, so error is safe to ignore.
595- dp , _ := etl .ValidateTestPath (pt .taskFileName )
596609 ptTest .ServerX .Site = dp .Site
597610 ptTest .ServerX .Machine = dp .Host
598611
@@ -611,7 +624,7 @@ func (pt *PTParser) ParseAndInsert(meta map[string]bigquery.Value, testName stri
611624 }
612625
613626 // Process the legacy Paris Traceroute txt output
614- cachedTest , err := Parse (meta , testName , testId , rawContent , pt .TableName ())
627+ cachedTest , err := Parse (meta , testName , testId , rawContent , pt .TableName (), dp )
615628 if err != nil {
616629 // These are happening at a high rate, so demote them to warnings until we can fix them.
617630 metrics .WarningCount .WithLabelValues (
@@ -786,7 +799,8 @@ func ProcessOneTuple(parts []string, protocol string, currentLeaves []Node, allN
786799
787800// Parse the raw test file into hops ParisTracerouteHop.
788801// TODO(dev): dedup the hops that are identical.
789- func Parse (meta map [string ]bigquery.Value , testName string , testId string , rawContent []byte , tableName string ) (cachedPTData , error ) {
802+ func Parse (meta map [string ]bigquery.Value , testName string , testId string , rawContent []byte ,
803+ tableName string , dp etl.DataPath ) (cachedPTData , error ) {
790804 //log.Printf("%s", testName)
791805 metrics .WorkerState .WithLabelValues (tableName , "pt-parse" ).Inc ()
792806 defer metrics .WorkerState .WithLabelValues (tableName , "pt-parse" ).Dec ()
@@ -911,8 +925,9 @@ func Parse(meta map[string]bigquery.Value, testName string, testId string, rawCo
911925 metrics .PTBitsAwayFromDestV6 .WithLabelValues (iataCode ).Observe (float64 (bitsDiff ))
912926 }
913927
928+ machine := fmt .Sprintf ("%s-%s" , dp .Host , dp .Site )
914929 // Generate Hops from allNodes
915- PTHops := ProcessAllNodes (allNodes , serverIP , protocol , tableName )
930+ PTHops := ProcessAllNodes (allNodes , serverIP , protocol , tableName , logTime , machine )
916931
917932 source := schema.ServerInfo {
918933 IP : serverIP ,
0 commit comments