diff --git a/docs/metrics.md b/docs/metrics.md index 68441559ead..acbf0f46a08 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -15,17 +15,11 @@ We expose several kinds of exporters, including Prometheus, Google Stackdriver, |-----------------------------------------------------------------------------------------| ----------- |-------------------------------------------------| ----------- | | `tekton_pipelines_controller_pipelinerun_duration_seconds_[bucket, sum, count]` | Histogram/LastValue(Gauge) | `*pipeline`=<pipeline_name>
`*pipelinerun`=<pipelinerun_name>
`status`=<status>
`namespace`=<pipelinerun-namespace> | experimental | | `tekton_pipelines_controller_pipelinerun_taskrun_duration_seconds_[bucket, sum, count]` | Histogram/LastValue(Gauge) | `*pipeline`=<pipeline_name>
`*pipelinerun`=<pipelinerun_name>
`status`=<status>
`*task`=<task_name>
`*taskrun`=<taskrun_name>
`namespace`=<pipelineruns-taskruns-namespace>
`*reason`=<reason> | experimental | -| `tekton_pipelines_controller_pipelinerun_count` | Counter | `status`=<status>
`*reason`=<reason> | deprecate | | `tekton_pipelines_controller_pipelinerun_total` | Counter | `status`=<status> | experimental | -| `tekton_pipelines_controller_running_pipelineruns_count` | Gauge | | deprecate | | `tekton_pipelines_controller_running_pipelineruns` | Gauge | | experimental | | `tekton_pipelines_controller_taskrun_duration_seconds_[bucket, sum, count]` | Histogram/LastValue(Gauge) | `status`=<status>
`*task`=<task_name>
`*taskrun`=<taskrun_name>
`namespace`=<pipelineruns-taskruns-namespace>
`*reason`=<reason> | experimental | -| `tekton_pipelines_controller_taskrun_count` | Counter | `status`=<status>
`*reason`=<reason> | deprecate | | `tekton_pipelines_controller_taskrun_total` | Counter | `status`=<status> | experimental | -| `tekton_pipelines_controller_running_taskruns_count` | Gauge | | deprecate | | `tekton_pipelines_controller_running_taskruns` | Gauge | | experimental | -| `tekton_pipelines_controller_running_taskruns_throttled_by_quota_count` | Gauge |
`namespace`=<pipelinerun-namespace> | deprecate | -| `tekton_pipelines_controller_running_taskruns_throttled_by_node_count` | Gauge |
`namespace`=<pipelinerun-namespace> | deprecate | | `tekton_pipelines_controller_running_taskruns_throttled_by_quota` | Gauge |
`namespace`=<pipelinerun-namespace> | experimental | | `tekton_pipelines_controller_running_taskruns_throttled_by_node` | Gauge |
`namespace`=<pipelinerun-namespace> | experimental | | `tekton_pipelines_controller_client_latency_[bucket, sum, count]` | Histogram | | experimental | diff --git a/pkg/pipelinerunmetrics/metrics.go b/pkg/pipelinerunmetrics/metrics.go index d528681db9f..0e85bb16579 100644 --- a/pkg/pipelinerunmetrics/metrics.go +++ b/pkg/pipelinerunmetrics/metrics.go @@ -52,21 +52,11 @@ var ( stats.UnitDimensionless) prDurationView *view.View - prCount = stats.Float64("pipelinerun_count", - "number of pipelineruns", - stats.UnitDimensionless) - prCountView *view.View - prTotal = stats.Float64("pipelinerun_total", "Number of pipelineruns", stats.UnitDimensionless) prTotalView *view.View - runningPRsCount = stats.Float64("running_pipelineruns_count", - "Number of pipelineruns executing currently", - stats.UnitDimensionless) - runningPRsCountView *view.View - runningPRs = stats.Float64("running_pipelineruns", "Number of pipelineruns executing currently", stats.UnitDimensionless) @@ -82,10 +72,6 @@ var ( stats.UnitDimensionless) runningPRsWaitingOnPipelineResolutionView *view.View - runningPRsWaitingOnTaskResolutionCount = stats.Float64("running_pipelineruns_waiting_on_task_resolution_count", - "Number of pipelineruns executing currently that are waiting on resolution requests for the task references of their taskrun children.", - stats.UnitDimensionless) - runningPRsWaitingOnTaskResolutionCountView *view.View runningPRsWaitingOnTaskResolution = stats.Float64("running_pipelineruns_waiting_on_task_resolution", "Number of pipelineruns executing currently that are waiting on resolution requests for the task references of their taskrun children.", @@ -178,9 +164,7 @@ func viewRegister(cfg *config.Metrics) error { } } - prCountViewTags := []tag.Key{statusTag} if cfg.CountWithReason { - prCountViewTags = append(prCountViewTags, reasonTag) prunTag = append(prunTag, reasonTag) } @@ -191,12 +175,6 @@ func viewRegister(cfg *config.Metrics) error { TagKeys: append([]tag.Key{statusTag, namespaceTag}, prunTag...), } - prCountView = &view.View{ - Description: prCount.Description(), - Measure: prCount, - Aggregation: view.Count(), - TagKeys: prCountViewTags, - } prTotalView = &view.View{ Description: prTotal.Description(), Measure: prTotal, @@ -215,22 +193,12 @@ func viewRegister(cfg *config.Metrics) error { Aggregation: view.LastValue(), } - runningPRsWaitingOnPipelineResolutionCountView = &view.View{ - Description: runningPRsWaitingOnPipelineResolutionCount.Description(), - Measure: runningPRsWaitingOnPipelineResolutionCount, - Aggregation: view.LastValue(), - } runningPRsWaitingOnPipelineResolutionView = &view.View{ Description: runningPRsWaitingOnPipelineResolution.Description(), Measure: runningPRsWaitingOnPipelineResolution, Aggregation: view.LastValue(), } - runningPRsWaitingOnTaskResolutionCountView = &view.View{ - Description: runningPRsWaitingOnTaskResolutionCount.Description(), - Measure: runningPRsWaitingOnTaskResolutionCount, - Aggregation: view.LastValue(), - } runningPRsWaitingOnTaskResolutionView = &view.View{ Description: runningPRsWaitingOnTaskResolution.Description(), Measure: runningPRsWaitingOnTaskResolution, @@ -239,26 +207,18 @@ func viewRegister(cfg *config.Metrics) error { return view.Register( prDurationView, - prCountView, prTotalView, - runningPRsCountView, runningPRsView, - runningPRsWaitingOnPipelineResolutionCountView, runningPRsWaitingOnPipelineResolutionView, - runningPRsWaitingOnTaskResolutionCountView, runningPRsWaitingOnTaskResolutionView, ) } func viewUnregister() { view.Unregister(prDurationView, - prCountView, prTotalView, - runningPRsCountView, runningPRsView, - runningPRsWaitingOnPipelineResolutionCountView, runningPRsWaitingOnPipelineResolutionView, - runningPRsWaitingOnTaskResolutionCountView, runningPRsWaitingOnTaskResolutionView) } @@ -372,7 +332,6 @@ func (r *Recorder) DurationAndCount(pr *v1.PipelineRun, beforeCondition *apis.Co } metrics.Record(ctx, prDuration.M(duration.Seconds())) - metrics.Record(ctx, prCount.M(1)) metrics.Record(ctx, prTotal.M(1)) return nil @@ -416,11 +375,8 @@ func (r *Recorder) RunningPipelineRuns(lister listers.PipelineRunLister) error { if err != nil { return err } - metrics.Record(ctx, runningPRsWaitingOnPipelineResolutionCount.M(float64(prsWaitResolvingPipelineRef))) metrics.Record(ctx, runningPRsWaitingOnPipelineResolution.M(float64(prsWaitResolvingPipelineRef))) - metrics.Record(ctx, runningPRsWaitingOnTaskResolutionCount.M(float64(trsWaitResolvingTaskRef))) metrics.Record(ctx, runningPRsWaitingOnTaskResolution.M(float64(trsWaitResolvingTaskRef))) - metrics.Record(ctx, runningPRsCount.M(float64(runningPipelineRuns))) metrics.Record(ctx, runningPRs.M(float64(runningPipelineRuns))) return nil diff --git a/pkg/taskrunmetrics/metrics.go b/pkg/taskrunmetrics/metrics.go index 94a5dad73b7..ccd5937343b 100644 --- a/pkg/taskrunmetrics/metrics.go +++ b/pkg/taskrunmetrics/metrics.go @@ -76,30 +76,15 @@ var ( "The pipelinerun's taskrun execution time in seconds", stats.UnitDimensionless) - trCount = stats.Float64("taskrun_count", - "number of taskruns", - stats.UnitDimensionless) - trTotal = stats.Float64("taskrun_total", "Number of taskruns", stats.UnitDimensionless) - runningTRsCount = stats.Float64("running_taskruns_count", - "Number of taskruns executing currently", - stats.UnitDimensionless) runningTRs = stats.Float64("running_taskruns", "Number of taskruns executing currently", stats.UnitDimensionless) - runningTRsThrottledByQuotaCount = stats.Float64("running_taskruns_throttled_by_quota_count", - "Number of taskruns executing currently, but whose underlying Pods or Containers are suspended by k8s because of defined ResourceQuotas. Such suspensions can occur as part of initial scheduling of the Pod, or scheduling of any of the subsequent Container(s) in the Pod after the first Container is started", - stats.UnitDimensionless) - - runningTRsThrottledByNodeCount = stats.Float64("running_taskruns_throttled_by_node_count", - "Number of taskruns executing currently, but whose underlying Pods or Containers are suspended by k8s because of Node level constraints. Such suspensions can occur as part of initial scheduling of the Pod, or scheduling of any of the subsequent Container(s) in the Pod after the first Container is started", - stats.UnitDimensionless) - runningTRsWaitingOnTaskResolutionCount = stats.Float64("running_taskruns_waiting_on_task_resolution_count", "Number of taskruns executing currently that are waiting on resolution requests for their task references.", stats.UnitDimensionless) @@ -296,12 +281,8 @@ func viewRegister(cfg *config.Metrics) error { return view.Register( trDurationView, prTRDurationView, - trCountView, trTotalView, - runningTRsCountView, runningTRsView, - runningTRsThrottledByQuotaCountView, - runningTRsThrottledByNodeCountView, runningTRsWaitingOnTaskResolutionCountView, runningTRsThrottledByQuotaView, runningTRsThrottledByNodeView, @@ -313,12 +294,8 @@ func viewUnregister() { view.Unregister( trDurationView, prTRDurationView, - trCountView, trTotalView, - runningTRsCountView, runningTRsView, - runningTRsThrottledByQuotaCountView, - runningTRsThrottledByNodeCountView, runningTRsWaitingOnTaskResolutionCountView, runningTRsThrottledByQuotaView, runningTRsThrottledByNodeView, @@ -451,7 +428,6 @@ func (r *Recorder) DurationAndCount(ctx context.Context, tr *v1.TaskRun, beforeC } metrics.Record(ctx, durationStat.M(duration.Seconds())) - metrics.Record(ctx, trCount.M(1)) metrics.Record(ctx, trTotal.M(1)) return nil @@ -476,9 +452,7 @@ func (r *Recorder) RunningTaskRuns(ctx context.Context, lister listers.TaskRunLi var runningTrs int trsThrottledByQuota := map[string]int{} - trsThrottledByQuotaCount := 0 trsThrottledByNode := map[string]int{} - trsThrottledByNodeCount := 0 var trsWaitResolvingTaskRef int for _, pr := range trs { // initialize metrics with namespace tag to zero if unset; will then update as needed below @@ -519,10 +493,8 @@ func (r *Recorder) RunningTaskRuns(ctx context.Context, lister listers.TaskRunLi if err != nil { return err } - metrics.Record(ctx, runningTRsCount.M(float64(runningTrs))) metrics.Record(ctx, runningTRs.M(float64(runningTrs))) metrics.Record(ctx, runningTRsWaitingOnTaskResolutionCount.M(float64(trsWaitResolvingTaskRef))) - metrics.Record(ctx, runningTRsThrottledByQuotaCount.M(float64(trsThrottledByQuotaCount))) metrics.Record(ctx, runningTRsThrottledByNodeCount.M(float64(trsThrottledByNodeCount))) for ns, cnt := range trsThrottledByQuota {