Skip to content

Commit 53834cb

Browse files
feat(metrics): Migrate from OpenCensus to OpenTelemetry (#1550)
Signed-off-by: Anitha Natarajan <anataraj@redhat.com>
1 parent eff5aad commit 53834cb

593 files changed

Lines changed: 34723 additions & 40777 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/config-observability.yaml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ metadata:
2121
app.kubernetes.io/instance: default
2222
app.kubernetes.io/part-of: tekton-chains
2323
data:
24+
# metrics-protocol specifies the OpenTelemetry export protocol for metrics.
25+
# Supported values: prometheus (default), grpc, http/protobuf, none.
26+
metrics-protocol: prometheus
2427
_example: |
2528
################################
2629
# #
@@ -36,23 +39,17 @@ data:
3639
# this example block and unindented to be in the data block
3740
# to actually change the configuration.
3841
#
39-
# metrics.backend-destination field specifies the system metrics destination.
40-
# It supports either prometheus (the default) or stackdriver.
41-
# Note: Using Stackdriver will incur additional charges.
42+
# metrics-protocol specifies the OpenTelemetry export protocol.
43+
# Supported values: prometheus (default), grpc, http/protobuf, none.
4244
#
43-
metrics.backend-destination: prometheus
45+
metrics-protocol: prometheus
4446
#
45-
# metrics.stackdriver-project-id field specifies the Stackdriver project ID. This
46-
# field is optional. When running on GCE, application default credentials will be
47-
# used and metrics will be sent to the cluster's project if this field is
48-
# not provided.
47+
# metrics-endpoint is the OTLP collector endpoint to send metrics to.
48+
# Required when metrics-protocol is grpc or http/protobuf.
4949
#
50-
metrics.stackdriver-project-id: "<your stackdriver project id>"
50+
metrics-endpoint: "otel-collector.observability.svc.cluster.local:4317"
5151
#
52-
# metrics.allow-stackdriver-custom-metrics indicates whether it is allowed
53-
# to send metrics to Stackdriver using "global" resource type and custom
54-
# metric type. Setting this flag to "true" could cause extra Stackdriver
55-
# charge. If metrics.backend-destination is not Stackdriver, this is
56-
# ignored.
52+
# metrics-export-interval is the interval at which metrics are exported.
53+
# Uses Go duration format (e.g. 30s, 1m). Defaults to 30s.
5754
#
58-
metrics.allow-stackdriver-custom-metrics: "false"
55+
metrics-export-interval: 30s

docs/metrics.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ The following chains metrics are also available at `tekton-chains-metrics` servi
1616

1717
| Name | Type | Description |
1818
|---------------------------------------------------------------|---------|----------------------------------------------------------------------|
19-
| `watcher_pipelinerun_sign_created_total` | Counter | Total number of signed messages for pipelineruns |
20-
| `watcher_pipelinerun_payload_uploaded_total` | Counter | Total number of uploaded payloads for pipelineruns |
21-
| `watcher_pipelinerun_payload_stored_total` | Counter | Total number of stored payloads for pipelineruns |
22-
| `watcher_pipelinerun_marked_signed_total` | Counter | Total number of objects marked as signed for pipelineruns |
23-
| `watcher_pipelinerun_signing_failures_total` | Counter | Total number of signing failures for pipelineruns |
24-
| `watcher_taskrun_sign_created_total` | Counter | Total number of signed messages for taskruns |
25-
| `watcher_taskrun_payload_uploaded_total` | Counter | Total number of uploaded payloads for taskruns |
26-
| `watcher_taskrun_payload_stored_total` | Counter | Total number of stored payloads for taskruns |
27-
| `watcher_taskrun_marked_signed_total` | Counter | Total number of objects marked as signed for taskruns |
28-
| `watcher_taskrun_signing_failures_total` | Counter | Total number of signing failures for taskruns |
19+
| `watcher_pipelinerun_sign_created_total` | Counter | Total number of signed messages for pipelineruns |
20+
| `watcher_pipelinerun_payload_uploaded_total` | Counter | Total number of uploaded payloads for pipelineruns |
21+
| `watcher_pipelinerun_payload_stored_total` | Counter | Total number of stored payloads for pipelineruns |
22+
| `watcher_pipelinerun_marked_signed_total` | Counter | Total number of objects marked as signed for pipelineruns |
23+
| `watcher_pipelinerun_signing_failures_total` | Counter | Total number of PipelineRun signing failures |
24+
| `watcher_taskrun_sign_created_total` | Counter | Total number of signed messages for taskruns |
25+
| `watcher_taskrun_payload_uploaded_total` | Counter | Total number of uploaded payloads for taskruns |
26+
| `watcher_taskrun_payload_stored_total` | Counter | Total number of stored payloads for taskruns |
27+
| `watcher_taskrun_marked_signed_total` | Counter | Total number of objects marked as signed for taskruns |
28+
| `watcher_taskrun_signing_failures_total` | Counter | Total number of TaskRun signing failures |
2929

3030
To access the chains metrics, use the following commands:
3131
```shell

go.mod

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ require (
3030
github.com/sigstore/sigstore/pkg/signature/kms/hashivault v1.10.4
3131
github.com/spiffe/go-spiffe/v2 v2.6.0
3232
github.com/stretchr/testify v1.11.1
33-
github.com/tektoncd/pipeline v1.9.1
33+
github.com/tektoncd/pipeline v1.10.2
3434
github.com/tektoncd/plumbing v0.0.0-20250115133002-f515628dffea
35-
go.opencensus.io v0.24.0
35+
go.opentelemetry.io/otel v1.40.0
36+
go.opentelemetry.io/otel/metric v1.40.0
37+
go.opentelemetry.io/otel/sdk/metric v1.40.0
3638
go.uber.org/zap v1.27.1
3739
gocloud.dev v0.43.0
3840
gocloud.dev/docstore/mongodocstore v0.43.0
@@ -45,7 +47,7 @@ require (
4547
k8s.io/apimachinery v0.35.3
4648
k8s.io/client-go v0.35.3
4749
k8s.io/code-generator v0.35.3
48-
knative.dev/pkg v0.0.0-20250415155312-ed3e2158b883
50+
knative.dev/pkg v0.0.0-20260225113719-b239e967f175
4951
sigs.k8s.io/yaml v1.6.0
5052
)
5153

@@ -61,8 +63,6 @@ require (
6163
cloud.google.com/go/kms v1.25.0 // indirect
6264
cloud.google.com/go/longrunning v0.8.0 // indirect
6365
cloud.google.com/go/monitoring v1.24.3 // indirect
64-
contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect
65-
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
6666
filippo.io/edwards25519 v1.1.1 // indirect
6767
github.com/4meepo/tagalign v1.4.2 // indirect
6868
github.com/Abirdcfly/dupword v0.1.3 // indirect
@@ -157,7 +157,6 @@ require (
157157
github.com/ccojocar/zxcvbn-go v1.0.2 // indirect
158158
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
159159
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
160-
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
161160
github.com/cespare/xxhash/v2 v2.3.0 // indirect
162161
github.com/charithe/durationcheck v0.0.10 // indirect
163162
github.com/chavacava/garif v0.1.0 // indirect
@@ -204,10 +203,9 @@ require (
204203
github.com/go-chi/chi/v5 v5.2.4 // indirect
205204
github.com/go-critic/go-critic v0.12.0 // indirect
206205
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
207-
github.com/go-kit/log v0.2.1 // indirect
208-
github.com/go-logfmt/logfmt v0.6.0 // indirect
209206
github.com/go-logr/logr v1.4.3 // indirect
210207
github.com/go-logr/stdr v1.2.2 // indirect
208+
github.com/go-logr/zapr v1.3.0 // indirect
211209
github.com/go-openapi/analysis v0.24.1 // indirect
212210
github.com/go-openapi/errors v0.22.6 // indirect
213211
github.com/go-openapi/jsonpointer v0.22.4 // indirect
@@ -240,7 +238,6 @@ require (
240238
github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect
241239
github.com/gobwas/glob v0.2.3 // indirect
242240
github.com/gofrs/flock v0.12.1 // indirect
243-
github.com/gogo/protobuf v1.3.2 // indirect
244241
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
245242
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
246243
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
@@ -270,7 +267,7 @@ require (
270267
github.com/gostaticanalysis/comment v1.5.0 // indirect
271268
github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect
272269
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
273-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.4 // indirect
270+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect
274271
github.com/hashicorp/errwrap v1.1.0 // indirect
275272
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
276273
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
@@ -349,7 +346,6 @@ require (
349346
github.com/olekukonko/ll v0.1.3 // indirect
350347
github.com/olekukonko/tablewriter v1.1.2 // indirect
351348
github.com/opencontainers/image-spec v1.1.1 // indirect
352-
github.com/openzipkin/zipkin-go v0.4.3 // indirect
353349
github.com/pborman/uuid v1.2.1 // indirect
354350
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
355351
github.com/pierrec/lz4/v4 v4.1.22 // indirect
@@ -360,8 +356,8 @@ require (
360356
github.com/prometheus/client_golang v1.23.2 // indirect
361357
github.com/prometheus/client_model v0.6.2 // indirect
362358
github.com/prometheus/common v0.67.5 // indirect
363-
github.com/prometheus/procfs v0.17.0 // indirect
364-
github.com/prometheus/statsd_exporter v0.22.7 // indirect
359+
github.com/prometheus/otlptranslator v1.0.0 // indirect
360+
github.com/prometheus/procfs v0.19.2 // indirect
365361
github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 // indirect
366362
github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect
367363
github.com/quasilyte/gogrep v0.5.0 // indirect
@@ -437,15 +433,22 @@ require (
437433
go-simpler.org/musttag v0.13.0 // indirect
438434
go-simpler.org/sloglint v0.9.0 // indirect
439435
go.mongodb.org/mongo-driver v1.17.6 // indirect
436+
go.opencensus.io v0.24.0 // indirect
440437
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
441438
go.opentelemetry.io/contrib/detectors/gcp v1.39.0 // indirect
442439
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
443-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
444-
go.opentelemetry.io/otel v1.40.0 // indirect
445-
go.opentelemetry.io/otel/metric v1.40.0 // indirect
440+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect
441+
go.opentelemetry.io/contrib/instrumentation/runtime v0.65.0 // indirect
442+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.40.0 // indirect
443+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.40.0 // indirect
444+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect
445+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 // indirect
446+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 // indirect
447+
go.opentelemetry.io/otel/exporters/prometheus v0.62.0 // indirect
448+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.40.0 // indirect
446449
go.opentelemetry.io/otel/sdk v1.40.0 // indirect
447-
go.opentelemetry.io/otel/sdk/metric v1.40.0 // indirect
448450
go.opentelemetry.io/otel/trace v1.40.0 // indirect
451+
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
449452
go.step.sm/crypto v0.75.0 // indirect
450453
go.uber.org/automaxprocs v1.6.0 // indirect
451454
go.uber.org/multierr v1.11.0 // indirect
@@ -476,7 +479,7 @@ require (
476479
gopkg.in/yaml.v2 v2.4.0 // indirect
477480
gopkg.in/yaml.v3 v3.0.1 // indirect
478481
honnef.co/go/tools v0.6.1 // indirect
479-
k8s.io/apiextensions-apiserver v0.32.11 // indirect
482+
k8s.io/apiextensions-apiserver v0.35.1 // indirect
480483
k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect
481484
k8s.io/klog/v2 v2.130.1 // indirect
482485
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect

0 commit comments

Comments
 (0)