github.com/oam-dev/kubevela@v1.9.11/pkg/monitor/metrics/application.go (about)

     1  /*
     2   Copyright 2021. The KubeVela 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 metrics
    18  
    19  import (
    20  	"github.com/prometheus/client_golang/prometheus"
    21  
    22  	velametrics "github.com/kubevela/pkg/monitor/metrics"
    23  )
    24  
    25  var (
    26  	// AppReconcileStageDurationHistogram report staged reconcile time for application
    27  	AppReconcileStageDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
    28  		Name:        "kubevela_app_reconcile_time_seconds",
    29  		Help:        "application reconcile time costs.",
    30  		Buckets:     velametrics.FineGrainedBuckets,
    31  		ConstLabels: prometheus.Labels{},
    32  	}, []string{"stage"})
    33  
    34  	// ApplicationReconcileTimeHistogram report the reconciling time cost of application controller with state transition recorded
    35  	ApplicationReconcileTimeHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
    36  		Name:        "application_reconcile_time_seconds",
    37  		Help:        "application reconcile duration distributions.",
    38  		Buckets:     velametrics.FineGrainedBuckets,
    39  		ConstLabels: prometheus.Labels{},
    40  	}, []string{"begin_phase", "end_phase"})
    41  
    42  	// ApplyComponentTimeHistogram report the time cost of applyComponentFunc
    43  	ApplyComponentTimeHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
    44  		Name:        "apply_component_time_seconds",
    45  		Help:        "apply component duration distributions.",
    46  		Buckets:     velametrics.FineGrainedBuckets,
    47  		ConstLabels: prometheus.Labels{},
    48  	}, []string{"stage"})
    49  
    50  	// WorkflowFinishedTimeHistogram report the time for finished workflow
    51  	WorkflowFinishedTimeHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
    52  		Name:        "workflow_finished_time_seconds",
    53  		Help:        "workflow finished time distributions.",
    54  		Buckets:     velametrics.FineGrainedBuckets,
    55  		ConstLabels: prometheus.Labels{},
    56  	}, []string{"phase"})
    57  
    58  	// ApplicationPhaseCounter report the number of application phase
    59  	ApplicationPhaseCounter = prometheus.NewGaugeVec(prometheus.GaugeOpts{
    60  		Name: "application_phase_number",
    61  		Help: "application phase number",
    62  	}, []string{"phase"})
    63  
    64  	// WorkflowStepPhaseGauge report the number of workflow step state
    65  	WorkflowStepPhaseGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
    66  		Name: "workflow_step_phase_number",
    67  		Help: "workflow step phase number",
    68  	}, []string{"step_type", "phase"})
    69  )
    70  
    71  var (
    72  	// ListResourceTrackerCounter report the list resource tracker number.
    73  	ListResourceTrackerCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
    74  		Name: "list_resourcetracker_num",
    75  		Help: "list resourceTrackers times.",
    76  	}, []string{"controller"})
    77  )