Skip to content

test: add e2e test for OpenCensus to OpenTelemetry metrics migration#2811

Open
khrm wants to merge 1 commit into
tektoncd:mainfrom
khrm:e2e-otel-metrics-test
Open

test: add e2e test for OpenCensus to OpenTelemetry metrics migration#2811
khrm wants to merge 1 commit into
tektoncd:mainfrom
khrm:e2e-otel-metrics-test

Conversation

@khrm

@khrm khrm commented Jun 29, 2026

Copy link
Copy Markdown

Adds TestOTelMetrics, a consolidated e2e test for the OC→OTel metrics migration in Pipelines-as-Code (PR #2567). The test scrapes two pods:

Controller (app.kubernetes.io/name=controller):

  • Asserts http_client_* metrics from knative k8s client OTel instrumentation
  • Asserts go_* runtime metrics
  • Checks PAC application metrics (pipelines_as_code_*) are absent/present
  • Asserts old OC metric names are absent

Watcher (app.kubernetes.io/name=watcher):

  • Asserts kn_workqueue_* metrics (watcher uses knative reconciler)
  • Asserts go_* runtime metrics

Verified locally with PAC controller and watcher deployed to kind via ko.

Relates to #2567

📝 Description of the Change

🔗 Linked GitHub Issue

Fixes #

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

AI assistance can be used for various tasks, such as code generation,
documentation, or testing.

Please indicate whether you have used AI assistance
for this PR and provide details if applicable.

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

Important

Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Claude noreply@anthropic.com

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new end-to-end test (test/metrics_otel_test.go) to verify the OpenCensus-to-OpenTelemetry metrics migration in Pipelines-as-Code by scraping the controller and watcher pods' metrics endpoints. The review feedback focuses on improving test robustness and efficiency: it recommends refactoring the metrics scraping helper to return errors instead of calling t.Fatalf (which would prematurely abort the test on transient errors during polling), reusing a single pre-initialized Kubernetes client across helper functions, and adding the necessary fmt import.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread test/metrics_otel_test.go
Comment thread test/metrics_otel_test.go Outdated
Comment thread test/metrics_otel_test.go Outdated
Comment thread test/metrics_otel_test.go Outdated
Comment thread test/metrics_otel_test.go Outdated
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.12%. Comparing base (e1a2f48) to head (b6ca870).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2811   +/-   ##
=======================================
  Coverage   60.12%   60.12%           
=======================================
  Files         210      210           
  Lines       21151    21151           
=======================================
  Hits        12716    12716           
  Misses       7642     7642           
  Partials      793      793           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@khrm khrm force-pushed the e2e-otel-metrics-test branch from d4ec0f5 to 7c391cc Compare June 29, 2026 12:57
@khrm

khrm commented Jun 29, 2026

Copy link
Copy Markdown
Author

//gemini help

@gemini-code-assist

Copy link
Copy Markdown
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@khrm

khrm commented Jun 29, 2026

Copy link
Copy Markdown
Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new E2E test file test/metrics_otel_test.go to verify the OpenCensus-to-OpenTelemetry metrics migration in Pipelines-as-Code by scraping and asserting metrics from the controller and watcher pods. The feedback recommends parameterizing the waitForPACMetric helper function with a labelSelector parameter. This allows reusing the helper to poll and wait for the watcher pod's metrics, resolving potential test flakiness caused by scraping the watcher metrics only once without retries.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread test/metrics_otel_test.go Outdated
Comment thread test/metrics_otel_test.go Outdated
Comment thread test/metrics_otel_test.go Outdated
@khrm khrm force-pushed the e2e-otel-metrics-test branch from 7c391cc to 16c8b75 Compare June 29, 2026 13:12
Comment thread test/metrics_otel_test.go Outdated

// ========== Infrastructure metric assertions (OTel renames) ==========

t.Run("Renames/k8s_client_uses_http_client_prefix", func(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plesae use testcase as per convention on this repo insteda of t.Run...

@khrm khrm force-pushed the e2e-otel-metrics-test branch 8 times, most recently from 317d87a to da6459d Compare June 29, 2026 14:19
@zakisk zakisk force-pushed the e2e-otel-metrics-test branch from da6459d to 3337cc1 Compare June 29, 2026 15:18
Comment thread test/metrics_otel_test.go Outdated
@khrm khrm force-pushed the e2e-otel-metrics-test branch 3 times, most recently from 402786c to 44bfe89 Compare June 29, 2026 18:10
Adds TestOTelMetrics, a consolidated e2e test for the OC→OTel metrics
migration in Pipelines-as-Code (PR tektoncd#2567). The test scrapes two pods:

Controller (app.kubernetes.io/name=controller):
- Asserts http_client_* metrics from knative k8s client OTel instrumentation
- Asserts go_* runtime metrics
- Checks PAC application metrics (pipelines_as_code_*) are absent/present
- Asserts old OC metric names are absent

Watcher (app.kubernetes.io/name=watcher):
- Asserts kn_workqueue_* metrics (watcher uses knative reconciler)
- Asserts go_* runtime metrics

Verified locally with PAC controller and watcher deployed to kind via ko.

Relates to tektoncd#2567

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants