Skip to content

Add per-plugin workload counters#13278

Open
moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:per-plugin-cpu-metrics
Open

Add per-plugin workload counters#13278
moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:per-plugin-cpu-metrics

Conversation

@moonchen

Copy link
Copy Markdown
Contributor

Add per-plugin metrics that allow us to track how much work each plugin is doing by counting their invocations, intercept bytes, and intercept transfers.

Add proxy.process.plugin..{invocations,bytes, transfers}, keyed by the plugin DSO basename and bounded by the number of loaded plugins.

Global plugins load via raw dlopen and previously carried no identity, so they are given a PluginThreadContext around TSPluginInit; the continuations they create then carry plugin identity the same way remap plugins already do.

Copilot AI review requested due to automatic review settings June 15, 2026 21:28
@moonchen moonchen self-assigned this Jun 15, 2026

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 per-plugin workload metrics to Apache Traffic Server so operators can attribute plugin activity to specific plugin DSOs (by basename), covering callback invocations as well as PluginVC intercept transport bytes/transfers. It also adds a gold test to validate that the new counters increment for both global and remap plugins.

Changes:

  • Add proxy.process.plugin.<name>.{invocations,bytes,transfers} counters and increment them from key dispatch / transport paths.
  • Introduce a PluginThreadContext wrapper for global plugins so continuations they create carry plugin identity (similar to remap plugins).
  • Add a gold test that drives traffic through a global plugin, a remap plugin, and a PluginVC intercept plugin and asserts the counters are non-zero.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/gold_tests/pluginTest/per_plugin_metrics/rules/global.conf Adds a header_rewrite rule to ensure global-plugin continuation dispatch occurs per transaction.
tests/gold_tests/pluginTest/per_plugin_metrics/per_plugin_metrics.test.py New gold test validating per-plugin invocation/bytes/transfers metrics via traffic_ctl metric get.
src/proxy/PluginVC.cc Increments per-plugin bytes/transfers counters for PluginVC intercept data movement and captures counters at core allocation time.
include/proxy/PluginVC.h Stores per-plugin counter pointers in PluginVCCore for intercept accounting.
src/proxy/Plugin.cc Wraps global plugin initialization in a PluginThreadContext so created continuations carry plugin identity.
src/proxy/http/remap/RemapPlugins.cc Counts remap plugin invocations at the remap dispatch site.
include/proxy/http/remap/PluginDso.h Adds metric registration/increment helpers and per-plugin counter pointers to PluginThreadContext.
src/proxy/http/remap/PluginDso.cc Implements metric-name tokenization and registers per-plugin counters on successful plugin load.
src/api/InkContInternal.cc Counts per-plugin invocations for TSCont (continuation) callback dispatches.

Comment thread src/proxy/http/remap/PluginDso.cc Outdated
Comment thread src/api/InkContInternal.cc Outdated
@moonchen moonchen added this to the 10.2.0 milestone Jun 15, 2026
Add per-plugin metrics that allow us to track how much work each plugin is doing
by counting their invocations, intercept bytes, and intercept transfers.

Add proxy.process.plugin.<name>.{invocations,bytes, transfers}, keyed by the
plugin DSO basename and bounded by the number of loaded plugins.

Global plugins load via raw dlopen and previously carried no identity, so they
are given a PluginThreadContext around TSPluginInit; the continuations they
create then carry plugin identity the same way remap plugins already do.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@moonchen moonchen force-pushed the per-plugin-cpu-metrics branch from 2d9c816 to a36b73c Compare June 15, 2026 21:52
@cmcfarlen cmcfarlen modified the milestones: 10.2.0, 11.0.0 Jun 15, 2026
@cmcfarlen cmcfarlen requested a review from bneradt June 15, 2026 22:08
@moonchen

Copy link
Copy Markdown
Contributor Author

[approve ci]

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants