66 "time"
77
88 "github.com/jfrog/jfrog-cli-security/utils"
9+ "github.com/jfrog/jfrog-cli-security/utils/xray"
910
1011 "github.com/jfrog/jfrog-cli-core/v2/utils/config"
1112 "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
@@ -35,12 +36,12 @@ func CreateAnalyticsEvent(product xscservices.ProductName, eventType xscservices
3536 return & event
3637}
3738
38- func SendNewScanEvent (xrayVersion , xscVersion string , serviceDetails * config.ServerDetails , event * xscservices.XscAnalyticsGeneralEvent ) (multiScanId string , startTime time.Time ) {
39+ func SendNewScanEvent (xrayVersion , xscVersion string , serviceDetails * config.ServerDetails , event * xscservices.XscAnalyticsGeneralEvent , projectKey string ) (multiScanId string , startTime time.Time ) {
3940 if ! shouldReportEvents (xscVersion ) {
4041 log .Debug ("Analytics metrics are disabled, skip sending event request to XSC" )
4142 return
4243 }
43- xscService , err := CreateXscServiceBackwardCompatible (xrayVersion , serviceDetails )
44+ xscService , err := CreateXscServiceBackwardCompatible (xrayVersion , serviceDetails , xray . WithScopedProjectKey ( projectKey ) )
4445 if err != nil {
4546 log .Debug (fmt .Sprintf ("failed to create xsc manager for analytics metrics service, error: %s " , err .Error ()))
4647 return
@@ -62,7 +63,7 @@ func SendScanEndedEvent(xrayVersion, xscVersion string, serviceDetails *config.S
6263 return
6364 }
6465 // Generate the finalize event.
65- xscService , err := CreateXscServiceBackwardCompatible (xrayVersion , serviceDetails )
66+ xscService , err := CreateXscServiceBackwardCompatible (xrayVersion , serviceDetails , xray . WithScopedProjectKey ( resultsContext . ProjectKey ) )
6667 if err != nil {
6768 log .Debug (fmt .Sprintf ("failed to create xsc manager for analytics metrics service, skip sending command finalize event, error: %s " , err .Error ()))
6869 return
@@ -131,12 +132,12 @@ func createFinalizedEvent(cmdResults *results.SecurityCommandResults) xscservice
131132 return CreateFinalizedEvent (cmdResults .XrayVersion , cmdResults .MultiScanId , cmdResults .StartTime , getTotalFindings (cmdResults ), & cmdResults .ResultContext , cmdResults .GetErrors ())
132133}
133134
134- func GetScanEvent (xrayVersion , xscVersion , multiScanId string , serviceDetails * config.ServerDetails ) (* xscservices.XscAnalyticsGeneralEvent , error ) {
135+ func GetScanEvent (xrayVersion , xscVersion , multiScanId string , serviceDetails * config.ServerDetails , projectKey string ) (* xscservices.XscAnalyticsGeneralEvent , error ) {
135136 if ! shouldReportEvents (xscVersion ) {
136137 log .Debug ("Can't get general event from XSC - analytics metrics are disabled." )
137138 return nil , nil
138139 }
139- xscService , err := CreateXscServiceBackwardCompatible (xrayVersion , serviceDetails )
140+ xscService , err := CreateXscServiceBackwardCompatible (xrayVersion , serviceDetails , xray . WithScopedProjectKey ( projectKey ) )
140141 if err != nil {
141142 log .Debug (fmt .Sprintf ("failed to create xsc manager for analytics metrics service, skip getting general event, error: %s " , err .Error ()))
142143 return nil , err
0 commit comments