Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed2253e8 authored by MarkDacek's avatar MarkDacek
Browse files

Process bazel metrics prior to potentially exiting upload.go

This is a necessary step for running b on CI with metrics collection.

Bug: 280491043
Test: b build libcore:all
Change-Id: I37d621c38e3f891dd63e5977befa6ce6604487ea
parent 30208863
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -138,6 +138,9 @@ func parsePhaseTiming(line string) bazel_metrics_proto.PhaseTiming {
	return phaseTiming
}

// This method takes a file created by bazel's --analyze-profile mode and
// writes bazel metrics data to the provided filepath.
// TODO(b/279987768) - move this outside of upload.go
func processBazelMetrics(bazelProfileFile string, bazelMetricsFile string, ctx Context) {
	if bazelProfileFile == "" {
		return
@@ -189,12 +192,13 @@ func UploadMetrics(ctx Context, config Config, simpleOutput bool, buildStarted t
	defer ctx.EndTrace()

	uploader := config.MetricsUploaderApp()
	processBazelMetrics(bazelProfileFile, bazelMetricsFile, ctx)

	if uploader == "" {
		// If the uploader path was not specified, no metrics shall be uploaded.
		return
	}

	processBazelMetrics(bazelProfileFile, bazelMetricsFile, ctx)
	// Several of the files might be directories.
	metricsFiles := pruneMetricsFiles(paths)
	if len(metricsFiles) == 0 {