Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Remove Deprecated Metrics #8301

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`=&lt;pipeline_name&gt; <br> `*pipelinerun`=&lt;pipelinerun_name&gt; <br> `status`=&lt;status&gt; <br> `namespace`=&lt;pipelinerun-namespace&gt; | experimental |
| `tekton_pipelines_controller_pipelinerun_taskrun_duration_seconds_[bucket, sum, count]` | Histogram/LastValue(Gauge) | `*pipeline`=&lt;pipeline_name&gt; <br> `*pipelinerun`=&lt;pipelinerun_name&gt; <br> `status`=&lt;status&gt; <br> `*task`=&lt;task_name&gt; <br> `*taskrun`=&lt;taskrun_name&gt;<br> `namespace`=&lt;pipelineruns-taskruns-namespace&gt; <br> `*reason`=&lt;reason&gt; | experimental |
| `tekton_pipelines_controller_pipelinerun_count` | Counter | `status`=&lt;status&gt; <br> `*reason`=&lt;reason&gt; | deprecate |
| `tekton_pipelines_controller_pipelinerun_total` | Counter | `status`=&lt;status&gt; | 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`=&lt;status&gt; <br> `*task`=&lt;task_name&gt; <br> `*taskrun`=&lt;taskrun_name&gt;<br> `namespace`=&lt;pipelineruns-taskruns-namespace&gt; <br> `*reason`=&lt;reason&gt; | experimental |
| `tekton_pipelines_controller_taskrun_count` | Counter | `status`=&lt;status&gt; <br> `*reason`=&lt;reason&gt; | deprecate |
| `tekton_pipelines_controller_taskrun_total` | Counter | `status`=&lt;status&gt; | 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 | <br> `namespace`=&lt;pipelinerun-namespace&gt; | deprecate |
| `tekton_pipelines_controller_running_taskruns_throttled_by_node_count` | Gauge | <br> `namespace`=&lt;pipelinerun-namespace&gt; | deprecate |
| `tekton_pipelines_controller_running_taskruns_throttled_by_quota` | Gauge | <br> `namespace`=&lt;pipelinerun-namespace&gt; | experimental |
| `tekton_pipelines_controller_running_taskruns_throttled_by_node` | Gauge | <br> `namespace`=&lt;pipelinerun-namespace&gt; | experimental |
| `tekton_pipelines_controller_client_latency_[bucket, sum, count]` | Histogram | | experimental |
Expand Down
44 changes: 0 additions & 44 deletions pkg/pipelinerunmetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,11 @@
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)
Expand All @@ -82,10 +72,6 @@
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.",
Expand Down Expand Up @@ -178,9 +164,7 @@
}
}

prCountViewTags := []tag.Key{statusTag}
if cfg.CountWithReason {
prCountViewTags = append(prCountViewTags, reasonTag)
prunTag = append(prunTag, reasonTag)
}

Expand All @@ -191,21 +175,15 @@
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,
Aggregation: view.Count(),
TagKeys: []tag.Key{statusTag},
}

Check failure on line 184 in pkg/pipelinerunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: runningPRsCountView
runningPRsCountView = &view.View{

Check failure on line 185 in pkg/pipelinerunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: runningPRsCount
Description: runningPRsCount.Description(),

Check failure on line 186 in pkg/pipelinerunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: runningPRsCount
Measure: runningPRsCount,
Aggregation: view.LastValue(),
}
Expand All @@ -215,22 +193,12 @@
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,
Expand All @@ -239,26 +207,18 @@

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)
}

Expand Down Expand Up @@ -372,7 +332,6 @@
}

metrics.Record(ctx, prDuration.M(duration.Seconds()))
metrics.Record(ctx, prCount.M(1))
metrics.Record(ctx, prTotal.M(1))

return nil
Expand Down Expand Up @@ -416,11 +375,8 @@
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
Expand Down
28 changes: 0 additions & 28 deletions pkg/taskrunmetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,30 +76,15 @@
"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)
Expand Down Expand Up @@ -232,8 +217,8 @@
TagKeys: append([]tag.Key{statusTag, namespaceTag}, append(trunTag, prunTag...)...),
}

trCountView = &view.View{

Check failure on line 220 in pkg/taskrunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: trCount
Description: trCount.Description(),

Check failure on line 221 in pkg/taskrunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: trCount
Measure: trCount,
Aggregation: view.Count(),
TagKeys: trCountViewTags,
Expand All @@ -244,8 +229,8 @@
Aggregation: view.Count(),
TagKeys: []tag.Key{statusTag},
}
runningTRsCountView = &view.View{

Check failure on line 232 in pkg/taskrunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: runningTRsCount
Description: runningTRsCount.Description(),

Check failure on line 233 in pkg/taskrunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: runningTRsCount
Measure: runningTRsCount,
Aggregation: view.LastValue(),
}
Expand All @@ -255,12 +240,12 @@
Measure: runningTRs,
Aggregation: view.LastValue(),
}
runningTRsThrottledByQuotaCountView = &view.View{

Check failure on line 243 in pkg/taskrunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: runningTRsThrottledByQuotaCount
Description: runningTRsThrottledByQuotaCount.Description(),

Check failure on line 244 in pkg/taskrunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: runningTRsThrottledByQuotaCount
Measure: runningTRsThrottledByQuotaCount,
Aggregation: view.LastValue(),
}
runningTRsThrottledByNodeCountView = &view.View{

Check failure on line 248 in pkg/taskrunmetrics/metrics.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: runningTRsThrottledByNodeCount
Description: runningTRsThrottledByNodeCount.Description(),
Measure: runningTRsThrottledByNodeCount,
Aggregation: view.LastValue(),
Expand Down Expand Up @@ -296,12 +281,8 @@
return view.Register(
trDurationView,
prTRDurationView,
trCountView,
trTotalView,
runningTRsCountView,
runningTRsView,
runningTRsThrottledByQuotaCountView,
runningTRsThrottledByNodeCountView,
runningTRsWaitingOnTaskResolutionCountView,
runningTRsThrottledByQuotaView,
runningTRsThrottledByNodeView,
Expand All @@ -313,12 +294,8 @@
view.Unregister(
trDurationView,
prTRDurationView,
trCountView,
trTotalView,
runningTRsCountView,
runningTRsView,
runningTRsThrottledByQuotaCountView,
runningTRsThrottledByNodeCountView,
runningTRsWaitingOnTaskResolutionCountView,
runningTRsThrottledByQuotaView,
runningTRsThrottledByNodeView,
Expand Down Expand Up @@ -451,7 +428,6 @@
}

metrics.Record(ctx, durationStat.M(duration.Seconds()))
metrics.Record(ctx, trCount.M(1))
metrics.Record(ctx, trTotal.M(1))

return nil
Expand All @@ -476,9 +452,7 @@

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
Expand Down Expand Up @@ -519,10 +493,8 @@
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 {
Expand Down