Skip to content

header_rewrite: count operators and conditions run#13286

Open
moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:header-rewrite-work-metrics
Open

header_rewrite: count operators and conditions run#13286
moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:header-rewrite-work-metrics

Conversation

@moonchen

Copy link
Copy Markdown
Contributor

Add proxy.process.plugin.header_rewrite.{operators,conditions} to track how much work header_rewrite does. These increment each time an operator or condition is executed.

The per-hook invocation count cannot tell a small ruleset from a large one,
so it does not reflect how much work header_rewrite does per transaction.
Add proxy.process.plugin.header_rewrite.{operators,conditions}, incremented
in the inline Operator::do_exec and Condition::do_eval chain walkers, to make
that workload visible.  do_eval short-circuits, so only conditions actually
evaluated are counted.  The counters are created once, from both TSPluginInit
and TSRemapInit.
@moonchen moonchen added this to the 11.0.0 milestone Jun 16, 2026
@moonchen moonchen self-assigned this Jun 16, 2026
Copilot AI review requested due to automatic review settings June 16, 2026 21:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 process metrics to quantify how much work the header_rewrite plugin performs by counting how many operators are executed and conditions are evaluated. It also extends the AuTest replay harness to validate these metrics in gold tests.

Changes:

  • Add proxy.process.plugin.header_rewrite.{operators,conditions} stats and increment them on each operator/condition execution.
  • Initialize the stats from both global plugin init (TSPluginInit) and remap init (TSRemapInit).
  • Extend ATSReplayTest to support metric checks with a minimum threshold and add a gold test that asserts the new metrics are non-zero.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/gold_tests/pluginTest/header_rewrite/header_rewrite_bundle.replay.yaml Adds metric checks ensuring the new header_rewrite counters are incrementing.
tests/gold_tests/autest-site/ats_replay.test.ext Extends metric check handling to support min thresholds (but currently contains an awk field bug).
plugins/header_rewrite/statement.h Declares global stat IDs and an initialization helper for work stats.
plugins/header_rewrite/statement.cc Defines the stat IDs and creates the new stats.
plugins/header_rewrite/operator.h Increments the operator-executed metric per operator execution.
plugins/header_rewrite/condition.h Increments the condition-evaluated metric per condition evaluation.
plugins/header_rewrite/header_rewrite.cc Calls stats initialization during plugin init and remap init.

Comment thread tests/gold_tests/autest-site/ats_replay.test.ext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants