github.com/GoogleCloudPlatform/testgrid@v0.0.174/pkg/summarizer/common/common.go (about)

     1  /*
     2  Copyright 2020 The TestGrid Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package common
    18  
    19  // GridMetrics contains the gathered metrics such as passed and failed test count
    20  // for a state.proto Grid
    21  type GridMetrics struct {
    22  	Name             string
    23  	Passed           int
    24  	Failed           int
    25  	FlakyCount       int
    26  	AverageFlakiness float64
    27  	FailedInfraCount int
    28  	InfraFailures    map[string]int
    29  }
    30  
    31  // NewGridMetrics constructs a new GridMetrics struct with nil default values
    32  // reassigned to working versions.
    33  func NewGridMetrics(name string) *GridMetrics {
    34  	gridMetrics := GridMetrics{Name: name, InfraFailures: make(map[string]int, 0)}
    35  	return &gridMetrics
    36  }