Skip to content

Commit

Permalink
Change Default Metrics Level for Taskrun and Pipelinerun
Browse files Browse the repository at this point in the history
Change default metrics level for Taskrun to task and
Pipelinerun to pipeline. Part of TEP0073
  • Loading branch information
khrm authored and tekton-robot committed Mar 10, 2022
1 parent 71237ba commit 4116bdd
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
4 changes: 2 additions & 2 deletions config/config-observability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ data:
# charge. If metrics.backend-destination is not Stackdriver, this is
# ignored.
metrics.allow-stackdriver-custom-metrics: "false"
metrics.taskrun.level: "taskrun"
metrics.taskrun.level: "task"
metrics.taskrun.duration-type: "histogram"
metrics.pipelinerun.level: "pipelinerun"
metrics.pipelinerun.level: "pipeline"
metrics.pipelinerun.duration-type: "histogram"
5 changes: 2 additions & 3 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ The Labels/Tag marked as "*" are optional. And there's a choice between Histogra
A sample config-map has been provided as [config-observability](./../config/config-observability.yaml). By default, taskrun and pipelinerun metrics have these values:

``` yaml
metrics.taskrun.level: "taskrun"
metrics.taskrun.level: "task"
metrics.taskrun.duration-type: "histogram"
metrics.pipelinerun.level: "pipelinerun"
metrics.pipelinerun.level: "pipeline"
metrics.pipelinerun.duration-type: "histogram"
```
Levels for taskrun and pipelinerun will be changed to task and pipeline respectively in the next release.
Following values are available in the configmap:
Expand Down
8 changes: 2 additions & 6 deletions pkg/apis/config/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ const (

// DefaultTaskrunLevel determines to what level to aggregate metrics
// when it isn't specified in configmap
// TBD: Change to task in next
// relase and taskrun level will be deprecated
DefaultTaskrunLevel = "taskrun"
DefaultTaskrunLevel = TaskrunLevelAtTask
// TaskrunLevelAtTaskrun specify that aggregation will be done at
// taskrun level
TaskrunLevelAtTaskrun = "taskrun"
Expand All @@ -50,9 +48,7 @@ const (
TaskrunLevelAtNS = "namespace"
// DefaultPipelinerunLevel determines to what level to aggregate metrics
// when it isn't specified in configmap
// TBD: Change to pipeline in next
// relase and pipelinerun level will be deprecated
DefaultPipelinerunLevel = "pipelinerun"
DefaultPipelinerunLevel = PipelinerunLevelAtPipeline
// PipelinerunLevelAtPipelinerun specify that aggregation will be done at
// pipelienrun level
PipelinerunLevelAtPipelinerun = "pipelinerun"
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/config/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func TestNewMetricsFromConfigMap(t *testing.T) {
func TestNewMetricsFromEmptyConfigMap(t *testing.T) {
MetricsConfigEmptyName := "config-observability-empty"
expectedConfig := &config.Metrics{
TaskrunLevel: config.TaskrunLevelAtTaskrun,
PipelinerunLevel: config.PipelinerunLevelAtPipelinerun,
TaskrunLevel: config.TaskrunLevelAtTask,
PipelinerunLevel: config.PipelinerunLevelAtPipeline,
DurationTaskrunType: config.DurationPipelinerunTypeHistogram,
DurationPipelinerunType: config.DurationPipelinerunTypeHistogram,
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/pipelinerunmetrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func getConfigContext() context.Context {
ctx := context.Background()
cfg := &config.Config{
Metrics: &config.Metrics{
TaskrunLevel: config.DefaultTaskrunLevel,
PipelinerunLevel: config.DefaultPipelinerunLevel,
TaskrunLevel: config.TaskrunLevelAtTaskrun,
PipelinerunLevel: config.PipelinerunLevelAtPipelinerun,
DurationTaskrunType: config.DefaultDurationTaskrunType,
DurationPipelinerunType: config.DefaultDurationPipelinerunType,
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/taskrunmetrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func getConfigContext() context.Context {
ctx := context.Background()
cfg := &config.Config{
Metrics: &config.Metrics{
TaskrunLevel: config.DefaultTaskrunLevel,
PipelinerunLevel: config.DefaultPipelinerunLevel,
TaskrunLevel: config.TaskrunLevelAtTaskrun,
PipelinerunLevel: config.PipelinerunLevelAtPipelinerun,
DurationTaskrunType: config.DefaultDurationTaskrunType,
DurationPipelinerunType: config.DefaultDurationPipelinerunType,
},
Expand Down

0 comments on commit 4116bdd

Please sign in to comment.