Skip to content

Commit

Permalink
Add Results Prometheus histogram config
Browse files Browse the repository at this point in the history
This adds the PROMETHEUS_HISTOGRAM configuration option existing in
Tekton Results.
  • Loading branch information
enarha authored and tekton-robot committed Nov 3, 2024
1 parent 5769908 commit f52eab6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
9 changes: 8 additions & 1 deletion docs/TektonResult.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ spec:
is_external_db: false
loki_stack_name: #optional
loki_stack_namespace: #optional

prometheus_port: 9090
prometheus_histogram: false
```
These properties are analogous to the one in configmap of tekton results api `tekton-results-api-config` documented at [api.md]:https://github.com/tektoncd/results/blob/4472848a0fb7c1473cfca8b647553170efac78a1/cmd/api/README.md
Expand Down Expand Up @@ -298,3 +299,9 @@ spec:
inputRefs: [ only-tekton ]
outputRefs: [ default ]
```

### Debugging

#### Debugging gRPC

Set `prometheus_histogram: true` to turns on recording of handling time of RPCs. Histogram metrics can be very expensive for Prometheus to retain and query. Disabled by default.
1 change: 1 addition & 0 deletions pkg/apis/operator/v1alpha1/tektonresult_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type ResultsAPIProperties struct {
DBEnableAutoMigration *bool `json:"db_enable_auto_migration,omitempty"`
ServerPort *int64 `json:"server_port,omitempty"`
PrometheusPort *int64 `json:"prometheus_port,omitempty"`
PrometheusHistogram *bool `json:"prometheus_histogram,omitempty"`
LogLevel string `json:"log_level,omitempty"`
LogsAPI *bool `json:"logs_api,omitempty"`
LogsType string `json:"logs_type,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ data:
DB_PORT=5432
SERVER_PORT=8080
PROMETHEUS_PORT=9090
PROMETHEUS_HISTOGRAM=true
DB_NAME=
DB_SSLMODE=disable
DB_ENABLE_AUTO_MIGRATION=true
Expand Down
5 changes: 4 additions & 1 deletion pkg/reconciler/kubernetes/tektonresult/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func Test_updateApiConfig(t *testing.T) {
TLSHostnameOverride: "localhostTest",
AuthDisable: &boolVal,
AuthImpersonate: &boolVal,
PrometheusPort: &intVal,
PrometheusHistogram: &boolVal,
LogLevel: "warn",
LogsAPI: &boolVal,
LogsPath: "/logs/test",
Expand All @@ -105,7 +107,8 @@ func Test_updateApiConfig(t *testing.T) {
assert.Equal(t, cm.Data["config"], `DB_HOST=localhost
DB_PORT=5432
SERVER_PORT=12345
PROMETHEUS_PORT=9090
PROMETHEUS_PORT=12345
PROMETHEUS_HISTOGRAM=true
DB_NAME=test
DB_SSLMODE=enable
DB_ENABLE_AUTO_MIGRATION=true
Expand Down

0 comments on commit f52eab6

Please sign in to comment.