istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/wasm/monitoring.go (about)

     1  // Copyright Istio 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 wasm
    16  
    17  import "istio.io/istio/pkg/monitoring"
    18  
    19  // Const strings for label value.
    20  const (
    21  	// For remote fetch metric.
    22  	fetchSuccess     = "success"
    23  	downloadFailure  = "download_failure"
    24  	manifestFailure  = "manifest_failure"
    25  	checksumMismatch = "checksum_mismatched"
    26  
    27  	// For Wasm conversion metric.
    28  	conversionSuccess   = "success"
    29  	noRemoteLoad        = "no_remote_load"
    30  	marshalFailure      = "marshal_failure"
    31  	unmarshalFailure    = "unmarshal_failure"
    32  	fetchFailure        = "fetch_failure"
    33  	missRemoteFetchHint = "miss_remote_fetch_hint"
    34  )
    35  
    36  var (
    37  	hitTag    = monitoring.CreateLabel("hit")
    38  	resultTag = monitoring.CreateLabel("result")
    39  
    40  	wasmCacheEntries = monitoring.NewGauge(
    41  		"wasm_cache_entries",
    42  		"number of Wasm remote fetch cache entries.",
    43  	)
    44  
    45  	wasmCacheLookupCount = monitoring.NewSum(
    46  		"wasm_cache_lookup_count",
    47  		"number of Wasm remote fetch cache lookups.",
    48  	)
    49  
    50  	wasmRemoteFetchCount = monitoring.NewSum(
    51  		"wasm_remote_fetch_count",
    52  		"number of Wasm remote fetches and results, including success, download failure, and checksum mismatch.",
    53  	)
    54  
    55  	wasmConfigConversionCount = monitoring.NewSum(
    56  		"wasm_config_conversion_count",
    57  		"number of Wasm config conversion count and results, including success, no remote load, marshal failure, remote fetch failure, miss remote fetch hint.",
    58  	)
    59  
    60  	wasmConfigConversionDuration = monitoring.NewDistribution(
    61  		"wasm_config_conversion_duration",
    62  		"Total time in milliseconds istio-agent spends on converting remote load in Wasm config.",
    63  		[]float64{1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384},
    64  	)
    65  )