Skip to content

Commit

Permalink
chore(analytics): comment out sendinstrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
j-luong committed May 21, 2024
1 parent 091daa1 commit 8639157
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions cliv2/cmd/cliv2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"github.com/spf13/pflag"

"github.com/google/uuid"
v20240307 "github.com/snyk/go-application-framework/pkg/analytics/2024-03-07"

"github.com/snyk/cli-extension-dep-graph/pkg/depgraph"
"github.com/snyk/cli-extension-iac-rules/iacrules"
"github.com/snyk/cli-extension-sbom/pkg/sbom"
Expand Down Expand Up @@ -243,21 +241,22 @@ func sendAnalytics(analytics analytics.Analytics, debugLogger *zerolog.Logger) {
}
}

func sendInstrumentation(a analytics.Analytics) {
api := globalConfiguration.GetString(configuration.API_URL)
org := globalConfiguration.GetString(configuration.ORGANIZATION)
data := analytics.GetV2InstrumentationObject(a.GetInstrumentation())
v2InstrumentationData := utils.ValueOf(json.Marshal(data))
request, err := v20240307.NewCreateAnalyticsRequest(api+"/hidden/", utils.ValueOf(uuid.Parse(org)), &v20240307.CreateAnalyticsParams{Version: "2024-03-07~experimental"}, *data)
globalLogger.Printf("%v", request)
globalLogger.Printf("%v", err)

response, err := globalEngine.GetNetworkAccess().GetHttpClient().Do(request)
defer response.Body.Close()
globalLogger.Printf("%v", response)

globalLogger.Println(string(v2InstrumentationData))
}
// TODO: delete once CLI-303 implemented
//func sendInstrumentation(a analytics.Analytics) {
// api := globalConfiguration.GetString(configuration.API_URL)
// org := globalConfiguration.GetString(configuration.ORGANIZATION)
// data := analytics.GetV2InstrumentationObject(a.GetInstrumentation())
// v2InstrumentationData := utils.ValueOf(json.Marshal(data))
// request, err := v20240307.NewCreateAnalyticsRequest(api+"/hidden/", utils.ValueOf(uuid.Parse(org)), &v20240307.CreateAnalyticsParams{Version: "2024-03-07~experimental"}, *data)
// globalLogger.Printf("%v", request)
// globalLogger.Printf("%v", err)
//
// response, err := globalEngine.GetNetworkAccess().GetHttpClient().Do(request)
// defer response.Body.Close()
// globalLogger.Printf("%v", response)
//
// globalLogger.Println(string(v2InstrumentationData))
//}

func help(_ *cobra.Command, _ []string) error {
helpProvided = true
Expand Down Expand Up @@ -499,7 +498,7 @@ func MainWithErrorCode() int {
if !globalConfiguration.GetBool(configuration.ANALYTICS_DISABLED) {
defer sendAnalytics(cliAnalytics, globalLogger)
}
defer sendInstrumentation(cliAnalytics)
//defer sendInstrumentation(cliAnalytics)

setTimeout(globalConfiguration, func() {
os.Exit(constants.SNYK_EXIT_CODE_EX_UNAVAILABLE)
Expand Down

0 comments on commit 8639157

Please sign in to comment.