Skip to content

Commit

Permalink
Send discovered intents
Browse files Browse the repository at this point in the history
  • Loading branch information
NetanelBollag committed Sep 6, 2023
1 parent 06f494e commit 9741fb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/mapper/pkg/intentsstore/holder.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ func (i *IntentsHolder) GetIntents(
return result, nil
}

func (i *IntentsHolder) GetIntentsCount() int {
i.lock.Lock()
defer i.lock.Unlock()

return len(i.accumulatingStore)
}

func (i *IntentsHolder) GetNewIntentsSinceLastGet() []TimestampedIntent {
i.lock.Lock()
defer i.lock.Unlock()
Expand Down
4 changes: 4 additions & 0 deletions src/mapper/pkg/resolvers/schema.resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func (r *mutationResolver) ReportCaptureResults(ctx context.Context, results mod
}
}
telemetrysender.SendNetworkMapper(telemetriesgql.EventTypeIntentsDiscoveredCapture, len(results.Results))
telemetrysender.SendNetworkMapper(telemetriesgql.EventTypeIntentsDiscovered, r.intentsHolder.GetIntentsCount())
return true, nil
}

Expand Down Expand Up @@ -144,6 +145,7 @@ func (r *mutationResolver) ReportSocketScanResults(ctx context.Context, results
}
}
telemetrysender.SendNetworkMapper(telemetriesgql.EventTypeIntentsDiscoveredSocketScan, len(results.Results))
telemetrysender.SendNetworkMapper(telemetriesgql.EventTypeIntentsDiscovered, r.intentsHolder.GetIntentsCount())
return true, nil
}

Expand Down Expand Up @@ -214,6 +216,7 @@ func (r *mutationResolver) ReportKafkaMapperResults(ctx context.Context, results
}

telemetrysender.SendNetworkMapper(telemetriesgql.EventTypeIntentsDiscoveredKafka, len(results.Results))
telemetrysender.SendNetworkMapper(telemetriesgql.EventTypeIntentsDiscovered, r.intentsHolder.GetIntentsCount())
return true, nil
}

Expand Down Expand Up @@ -258,6 +261,7 @@ func (r *mutationResolver) ReportIstioConnectionResults(ctx context.Context, res
}

telemetrysender.SendNetworkMapper(telemetriesgql.EventTypeIntentsDiscoveredIstio, len(results.Results))
telemetrysender.SendNetworkMapper(telemetriesgql.EventTypeIntentsDiscovered, r.intentsHolder.GetIntentsCount())
return true, nil
}

Expand Down

0 comments on commit 9741fb6

Please sign in to comment.