Skip to content

Commit 49decf1

Browse files
authored
Remove tool_version_snapshot telemetry (#1131)
1 parent 0277bd8 commit 49decf1

File tree

5 files changed

+0
-396
lines changed

5 files changed

+0
-396
lines changed

analytics/tracker.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"fmt"
66
"os"
7-
"runtime"
87
"time"
98

109
"github.com/bitrise-io/bitrise/v2/configs"
@@ -30,7 +29,6 @@ const (
3029
stepPreparationFailedEventName = "step_preparation_failed"
3130
stepSkippedEventName = "step_skipped"
3231
cliWarningEventName = "cli_warning"
33-
toolVersionSnapshotEventName = "tool_version_snapshot"
3432
cliCommandEventName = "cli_command"
3533
toolSetupEventName = "cli_tool_setup"
3634

@@ -63,7 +61,6 @@ const (
6361
osProperty = "os"
6462
stackRevIDProperty = "stack_rev_id"
6563
snapshotProperty = "snapshot"
66-
toolVersionsProperty = "tool_versions"
6764
commandProperty = "command"
6865
subcommandProperty = "subcommand"
6966
flagsProperty = "flags"
@@ -114,7 +111,6 @@ type Tracker interface {
114111
SendStepStartedEvent(properties analytics.Properties, info StepInfo, activateDuration time.Duration, expandedInputs map[string]interface{}, originalInputs map[string]string)
115112
SendStepFinishedEvent(properties analytics.Properties, result StepResult)
116113
SendCLIWarning(message string)
117-
SendToolVersionSnapshot(toolVersions, snapshotType string)
118114
SendCommandInfo(command, subcommand string, flags []string)
119115
SendToolSetupEvent(provider string, request provider.ToolRequest, result provider.ToolInstallResult, is_successful bool, setupTime time.Duration)
120116
IsTracking() bool
@@ -231,28 +227,6 @@ func (t tracker) SendCommandInfo(command, subcommand string, flags []string) {
231227
t.tracker.Enqueue(cliCommandEventName, properties)
232228
}
233229

234-
func (t tracker) SendToolVersionSnapshot(toolVersions, snapshotType string) {
235-
if !t.stateChecker.Enabled() {
236-
return
237-
}
238-
239-
stackRevID := t.envRepository.Get(stackRevIDKey)
240-
if stackRevID == "" {
241-
// Legacy
242-
stackRevID = t.envRepository.Get(macStackRevIDKey)
243-
}
244-
245-
properties := analytics.Properties{
246-
ciModeProperty: t.envRepository.Get(configs.CIModeEnvKey) == "true",
247-
osProperty: runtime.GOOS,
248-
stackRevIDProperty: stackRevID,
249-
snapshotProperty: snapshotType,
250-
toolVersionsProperty: toolVersions,
251-
}
252-
253-
t.tracker.Enqueue(toolVersionSnapshotEventName, properties)
254-
}
255-
256230
func (t tracker) SendStepStartedEvent(properties analytics.Properties, info StepInfo, activateDuration time.Duration, expandedInputs map[string]interface{}, originalInputs map[string]string) {
257231
if !t.stateChecker.Enabled() {
258232
return

cli/run_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,6 @@ func (n noOpTracker) SendStepFinishedEvent(analytics.Properties, cliAnalytics.St
21042104
func (n noOpTracker) SendCLIWarning(string) {}
21052105
func (n noOpTracker) SendWorkflowStarted(analytics.Properties, string, string) {}
21062106
func (n noOpTracker) SendWorkflowFinished(analytics.Properties, bool) {}
2107-
func (n noOpTracker) SendToolVersionSnapshot(string, string) {}
21082107
func (n noOpTracker) SendCommandInfo(string, string, []string) {}
21092108
func (n noOpTracker) SendToolSetupEvent(provider string, request provider.ToolRequest, result provider.ToolInstallResult, is_successful bool, setupTime time.Duration) {}
21102109
func (n noOpTracker) Wait() {}

cli/run_util.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"github.com/bitrise-io/bitrise/v2/models"
2323
"github.com/bitrise-io/bitrise/v2/stepruncmd"
2424
"github.com/bitrise-io/bitrise/v2/tools"
25-
"github.com/bitrise-io/bitrise/v2/toolversions"
2625
envman "github.com/bitrise-io/envman/v2/cli"
2726
envmanEnv "github.com/bitrise-io/envman/v2/env"
2827
envmanModels "github.com/bitrise-io/envman/v2/models"
@@ -33,8 +32,6 @@ import (
3332
"github.com/bitrise-io/go-utils/pointers"
3433
"github.com/bitrise-io/go-utils/retry"
3534
coreanalytics "github.com/bitrise-io/go-utils/v2/analytics"
36-
commandV2 "github.com/bitrise-io/go-utils/v2/command"
37-
envV2 "github.com/bitrise-io/go-utils/v2/env"
3835
logV2 "github.com/bitrise-io/go-utils/v2/log"
3936
"github.com/bitrise-io/go-utils/versions"
4037
stepmanModels "github.com/bitrise-io/stepman/models"
@@ -57,7 +54,6 @@ func (r WorkflowRunner) runWorkflow(
5754
results := r.activateAndRunSteps(plan, steplibSource, buildRunResults, environments, secrets, isLastWorkflow, tracker, workflowIDProperties)
5855

5956
tracker.SendWorkflowFinished(workflowIDProperties, results.IsBuildFailed())
60-
collectToolVersions(tracker)
6157

6258
return results
6359
}
@@ -1199,34 +1195,6 @@ func prepareAnalyticsStepInfo(step stepmanModels.StepModel, stepInfoPtr stepmanM
11991195
}
12001196
}
12011197

1202-
func collectToolVersions(tracker analytics.Tracker) {
1203-
userHomeDir, err := os.UserHomeDir()
1204-
if err != nil {
1205-
log.Warnf("user home dir not found: %s", err)
1206-
}
1207-
1208-
logger := log.NewLogger(log.GetGlobalLoggerOpts())
1209-
reporter := toolversions.NewASDFVersionReporter(envV2.NewCommandLocator(), commandV2.NewFactory(envV2.NewRepository()), logger, userHomeDir)
1210-
1211-
if !reporter.IsAvailable() {
1212-
log.Debugf("ASDF is not available, skipping tool version reporting")
1213-
return
1214-
}
1215-
1216-
toolVersions, err := reporter.CurrentToolVersions()
1217-
if err != nil {
1218-
log.Warnf("Tool version reporting: %s", err)
1219-
return
1220-
}
1221-
toolVersionsBytes, err := json.Marshal(toolVersions)
1222-
if err != nil {
1223-
logger.Warnf("Tool version reporting: JSON marshal: %s", err)
1224-
return
1225-
}
1226-
1227-
tracker.SendToolVersionSnapshot(string(toolVersionsBytes), analytics.ToolSnapshotEndOfWorkflowValue)
1228-
}
1229-
12301198
func addTestMetadata(testDirPath string, testResultStepInfo models.TestResultStepInfo) error {
12311199
// check if the test dir is empty
12321200
if empty, err := isDirEmpty(testDirPath); err != nil {

toolversions/toolversions.go

Lines changed: 0 additions & 122 deletions
This file was deleted.

0 commit comments

Comments
 (0)