go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/cv/internal/run/impl/handler/metrics.go (about)

     1  // Copyright 2021 The LUCI Authors.
     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  
    15  package handler
    16  
    17  import (
    18  	"math"
    19  
    20  	"go.chromium.org/luci/common/tsmon/distribution"
    21  	"go.chromium.org/luci/common/tsmon/field"
    22  	"go.chromium.org/luci/common/tsmon/metric"
    23  	"go.chromium.org/luci/common/tsmon/types"
    24  )
    25  
    26  var (
    27  	metricPickupLatencyS = metric.NewCumulativeDistribution(
    28  		"cv/pickup/latency",
    29  		"Time between triggering CV and when CV processing actually starts",
    30  		&types.MetricMetadata{Units: types.Seconds},
    31  		// Bucketer for 1s..2.5h range.
    32  		//
    33  		// $ python3 -c "print(((10**0.04)**100)/60.0/60.0)"
    34  		// 2.7777777777777977
    35  		distribution.GeometricBucketer(math.Pow(10, 0.04), 100),
    36  		field.String("project"),
    37  	)
    38  	metricPickupLatencyAdjustedS = metric.NewCumulativeDistribution(
    39  		"cv/pickup/latency_adjusted",
    40  		"Time between triggering CV and when CV processing actually starts but adjusted by the configured stabilization delay",
    41  		&types.MetricMetadata{Units: types.Seconds},
    42  		distribution.GeometricBucketer(math.Pow(10, 0.04), 100),
    43  		field.String("project"),
    44  	)
    45  )