Skip to content

feat: add time-window support for Prometheus telemetry collection#1054

Open
Sypher845 wants to merge 4 commits into
krkn-chaos:mainfrom
Sypher845:optimize-telemetry-collection-time
Open

feat: add time-window support for Prometheus telemetry collection#1054
Sypher845 wants to merge 4 commits into
krkn-chaos:mainfrom
Sypher845:optimize-telemetry-collection-time

Conversation

@Sypher845

@Sypher845 Sypher845 commented Jan 15, 2026

Copy link
Copy Markdown

Type of change

  • Refactor
  • New feature
  • Bug fix
  • Optimization

Description

This PR adds time-window support for Prometheus telemetry collection, enabling significantly faster metrics gathering by passing test timestamps and Prometheus API credentials to krkn-lib.

Changes Made

Code Changes

  • run_kraken.py: Updated telemetry function calls to pass start_time, end_time, prometheus_url, and prometheus_bearer_token parameters to get_ocp_prometheus_data() and get_prometheus_pod_data()

Configuration Changes

Added three new configuration options to all config files:

  • prometheus_backup_use_api: True - Enable Prometheus HTTP API-based collection (default: True)
  • prometheus_time_window_minutes_before: 10 - Minutes before test start to collect metrics (default: 10)
  • prometheus_time_window_minutes_after: 10 - Minutes after test end to collect metrics (default: 10)

Files updated:

  • config/config.yaml
  • config/config_performance.yaml
  • CI/config/common_test_config.yaml

How It Works

When used with the updated krkn-lib:

  1. Attempts Prometheus HTTP API collection first (only collects metrics for test time window + buffers)
  2. Automatically falls back to traditional filesystem backup if API is unavailable
  3. Results in 70-85% faster Prometheus collection time

Related Tickets & Documents

Dependencies:

Checklist before requesting a review

  • I have performed a self-review of my code by running krkn and specific scenario
  • If it is a core feature, I have added thorough unit tests with above 80% coverage

REQUIRED:
Description of combination of tests performed and output of run
I am working on the tests

Copilot AI review requested due to automatic review settings January 15, 2026 21:28

Copilot AI 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.

Pull request overview

This PR adds time-window support for Prometheus telemetry collection, allowing krkn to collect metrics only for the relevant time window (test duration plus configurable buffers) instead of the entire Prometheus database. This optimization significantly reduces collection time by 70-85%.

Changes:

  • Updated telemetry function calls in run_kraken.py to pass test timestamps and Prometheus API credentials to krkn-lib functions
  • Added three new configuration parameters to enable API-based collection and configure time windows
  • Applied configuration changes consistently across all config files

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
run_kraken.py Added start_time, end_time, prometheus_url, and prometheus_bearer_token parameters to telemetry collection function calls
config/config.yaml Added three new telemetry configuration options for API-based collection and time windows
config/config_performance.yaml Added the same three new telemetry configuration options
CI/config/common_test_config.yaml Added the same three new telemetry configuration options

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/config.yaml
Comment thread config/config_performance.yaml Outdated
Comment thread CI/config/common_test_config.yaml Outdated
@Sypher845

Copy link
Copy Markdown
Author

Hi, @paigerube14 @chaitanyaenr the license compliance test is failing, I can't get through it can you pls check it.
Also, I have opened the needed PR in krkn-lib PR#231

@paigerube14

Copy link
Copy Markdown
Collaborator

Hi, @paigerube14 @chaitanyaenr the license compliance test is failing, I can't get through it can you pls check it. Also, I have opened the needed PR in krkn-lib PR#231

don't need to worry about the license check, can merge without that passing

@Sypher845

Copy link
Copy Markdown
Author

@paigerube14 Hi! This PR is now ready for review. All CI checks are passing, and I’ve addressed the requirements for [Issue #881]. Could you please take a look
Also, I have opened the needed PR in krkn-lib krkn-chaos/krkn-lib#231 please take a look on this too

Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
@Sypher845
Sypher845 force-pushed the optimize-telemetry-collection-time branch from 2056060 to 3f01720 Compare January 26, 2026 20:26
@Sypher845

Copy link
Copy Markdown
Author

@paigerube14 any update ?
I have rebased it, please review.

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

Hi @Sypher845! 👋 This PR has merge conflicts with main and needs to be rebased before it can be merged.

To rebase your branch:

git fetch upstream
git rebase upstream/main
# resolve any conflicts, then:
git add .
git rebase --continue
git push --force-with-lease

Tip: --force-with-lease is safer than --force — it will fail if someone else has pushed to your branch since your last fetch.

For more details, see the Rebase with upstream guide.

The needs-rebase label and this comment will be removed automatically once conflicts are resolved.

@github-actions github-actions Bot added the needs-dco Commits are missing a Signed-off-by line label May 15, 2026
@github-actions

Copy link
Copy Markdown

Hi @Sypher845! 👋 One or more commits in this PR are missing a Signed-off-by line, which is required by our DCO policy.

Unsigned commits:

  • b9df3c0: Merge branch 'main' into optimize-telemetry-collection-time
  • e02658f: Merge branch 'main' into optimize-telemetry-collection-time

To fix, rebase and sign off all commits:

git rebase HEAD~2 --signoff
git push --force-with-lease

Or, to sign off every commit in this PR at once:

git rebase origin/main --signoff
git push --force-with-lease

Tip: Add -s to future git commit commands (e.g. git commit -s -m "...") to sign off automatically.

Note: Please make sure your PR contains only 1 commit before signing off. If you have multiple commits, squash them first:

git rebase -i origin/main   # mark all but the first as 'squash'
git commit --amend -s                 # add Signed-off-by to the squashed commit
git push --force-with-lease

The needs-dco label and this comment will be removed automatically once all commits are signed off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-dco Commits are missing a Signed-off-by line needs-rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants