1// Copyright 2021 Google Inc. All Rights Reserved. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package soong_build_bp2build_metrics; 18option go_package = "android/soong/ui/metrics/bp2build_metrics_proto"; 19 20message Bp2BuildMetrics { 21 // Total number of Soong modules converted to generated targets 22 uint64 generatedModuleCount = 1; 23 24 // Total number of Soong modules converted to handcrafted targets 25 uint64 handCraftedModuleCount = 2; 26 27 // Total number of unconverted Soong modules 28 uint64 unconvertedModuleCount = 3; 29 30 // Counts of symlinks in synthetic bazel workspace 31 uint64 workspaceSymlinkCount= 9; 32 33 // Counts of mkdir calls during creation of synthetic bazel workspace 34 uint64 workspaceMkDirCount= 10; 35 36 // Counts of generated Bazel targets per Bazel rule class 37 map<string, uint64> ruleClassCount = 4; 38 39 // List of converted modules 40 repeated string convertedModules = 5; 41 42 // Unconverted modules, mapped to the reason the module was not converted. 43 map<string, UnconvertedReason> unconvertedModules = 11; 44 45 // Counts of converted modules by module type. 46 map<string, uint64> convertedModuleTypeCount = 6; 47 48 // Counts of total modules by module type. 49 map<string, uint64> totalModuleTypeCount = 7; 50 51 // List of traced runtime events of bp2build, useful for tracking bp2build 52 // runtime. 53 repeated Event events = 8; 54} 55 56// Traced runtime event of bp2build. 57message Event { 58 // The event name. 59 string name = 1; 60 61 // The absolute start time of the event 62 // The number of nanoseconds elapsed since January 1, 1970 UTC. 63 uint64 start_time = 2; 64 65 // The real running time. 66 // The number of nanoseconds elapsed since start_time. 67 uint64 real_time = 3; 68} 69 70message UnconvertedReason { 71 // The type of reason that the module could not be converted. 72 UnconvertedReasonType type = 1; 73 74 // Descriptive details describing why the module could not be converted. 75 // This detail should be kept very short and should be in the context of 76 // the type. (Otherwise, this would significantly bloat metrics.) 77 string detail = 2; 78} 79 80enum UnconvertedReasonType { 81 // Bp2build does not know how to convert this specific module for some reason 82 // not covered by other reason types. The reason detail should explain the 83 // specific issue. 84 UNSUPPORTED = 0; 85 86 // The module was already defined in a BUILD file available in the source tree. 87 DEFINED_IN_BUILD_FILE = 1; 88 89 // The module was explicitly denylisted by name. 90 DENYLISTED = 2; 91 92 // The module's type has no bp2build implementation. 93 TYPE_UNSUPPORTED = 3; 94 95 // The module has a property not yet supported. The detail field should 96 // name the unsupported property name. 97 PROPERTY_UNSUPPORTED = 4; 98 99 // The module has an unconverted dependency. The detail should consist of 100 // the name of the unconverted module. 101 UNCONVERTED_DEP = 5; 102 103 // The module has a source file with the same name as the module itself. 104 SRC_NAME_COLLISION = 6; 105}