Skip to content

Commit

Permalink
Remove metrics collection option (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofalvai authored Nov 26, 2024
1 parent 674d478 commit 25dbfa5
Show file tree
Hide file tree
Showing 17 changed files with 0 additions and 1,123 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ You can also set up file path filters to avoid exporting unwanted archives or ma
| `mapping_file_exclude_filter` | The Step will **not** copy the generated mapping files that match this filter into the Bitrise deploy directory. You can use this input to avoid moving a beta mapping file, for example. If you specify an empty filter, every mapping file (selected by `mapping_file_include_filter`) will be copied. Example: Do not copy any mapping.txt file that is in a `beta` directoy: ``` */beta/mapping.txt ``` | | `*/tmp/*` |
| `cache_level` | `all` - will cache build-cache and dependencies `only_deps` - will cache dependencies only `none` - won't cache any of the above | required | `only_deps` |
| `gradle_options` | Flags added to the end of the Gradle call. You can use multiple options, separated by a space. Example: `--stacktrace --debug` If `--debug` or `-d` options are set then only the last 20 lines of the raw gradle output will be visible in the build log. The full raw output will be exported to the `$BITRISE_GRADLE_RAW_RESULT_TEXT_PATH` variable and will be added as a build artifact. | | `--stacktrace` |
| `collect_metrics` | Enable Gradle metrics collection and send data to Bitrise. | | `no` |
</details>

<details>
Expand Down
37 changes: 0 additions & 37 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ import (
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/go-utils/retry"
v2command "github.com/bitrise-io/go-utils/v2/command"
"github.com/bitrise-io/go-utils/v2/env"
v2errorutil "github.com/bitrise-io/go-utils/v2/errorutil"
v2log "github.com/bitrise-io/go-utils/v2/log"
v2pathutil "github.com/bitrise-io/go-utils/v2/pathutil"
"github.com/bitrise-steplib/steps-gradle-runner/metrics"
"github.com/kballard/go-shellquote"
)

Expand Down Expand Up @@ -50,9 +44,6 @@ type Config struct {

// Other configs
DeployDir string `env:"BITRISE_DEPLOY_DIR"`

// Metrics
CollectMetrics bool `env:"collect_metrics,opt[yes,no]"`
}

func runGradleTask(gradleTool, buildFile, tasks, options string, destDir string) error {
Expand Down Expand Up @@ -196,23 +187,6 @@ func main() {
failf("Failed to add executable permission on gradlew file (%s): %s", gradlewPath, err)
}

// Enable metrics collection
envRepo := env.NewRepository()
cmdFactory := v2command.NewFactory(envRepo)
pathProvider := v2pathutil.NewPathProvider()
logger := v2log.NewLogger()
collector := metrics.NewCollector(envRepo, cmdFactory, pathProvider, logger, gradlewPath, configs.GradleFile)
if configs.CollectMetrics && collector.CanBeEnabled(configs.GradleOptions) {
err = collector.SetupMetricsCollection()
if err == nil {
configs.GradleOptions = collector.UpdateGradleFlagsWithInitScript(configs.GradleOptions)
log.Donef("Metrics collection is set up")
} else {
log.Warnf(v2errorutil.FormattedError(err))
log.Infof("Continuing task execution without metrics collection")
}
}

gradleStarted := time.Now()

log.Infof("Running gradle task...")
Expand Down Expand Up @@ -405,15 +379,4 @@ func main() {
}
log.Donef("The mapping path is now available in the Environment Variable: $BITRISE_MAPPING_PATH (value: %s)", lastCopiedMappingFile)
}

if configs.CollectMetrics {
log.Printf("\n")
log.Infof("Sending collected metrics...")
err := collector.SendMetrics()
if err != nil {
log.Warnf(v2errorutil.FormattedError(err))
} else {
log.Donef("Done")
}
}
}
26 changes: 0 additions & 26 deletions metrics/init.gradle.gotemplate

This file was deleted.

46 changes: 0 additions & 46 deletions metrics/initscript.go

This file was deleted.

85 changes: 0 additions & 85 deletions metrics/initscript_test.go

This file was deleted.

138 changes: 0 additions & 138 deletions metrics/metrics.go

This file was deleted.

8 changes: 0 additions & 8 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,6 @@ inputs:
You can use multiple options, separated by a space. Example: `--stacktrace --debug`
If `--debug` or `-d` options are set then only the last 20 lines of the raw gradle output will be visible in the build log.
The full raw output will be exported to the `$BITRISE_GRADLE_RAW_RESULT_TEXT_PATH` variable and will be added as a build artifact.
- collect_metrics: "no"
opts:
title: Collect Gradle metrics
description: |
Enable Gradle metrics collection and send data to Bitrise.
value_options:
- "yes"
- "no"
outputs:
- BITRISE_APK_PATH:
opts:
Expand Down
Loading

0 comments on commit 25dbfa5

Please sign in to comment.