Skip to content

Add ability for stats over http to run as a remap plugin#12316

Closed
ezelkow1 wants to merge 2 commits intoapache:masterfrom
ezelkow1:soh-remap
Closed

Add ability for stats over http to run as a remap plugin#12316
ezelkow1 wants to merge 2 commits intoapache:masterfrom
ezelkow1:soh-remap

Conversation

@ezelkow1
Copy link
Copy Markdown
Member

Tested as global and remap, with path as param as well as config file

@ezelkow1 ezelkow1 requested review from bneradt and zwoop June 25, 2025 03:27
@ezelkow1 ezelkow1 self-assigned this Jun 25, 2025
@ezelkow1
Copy link
Copy Markdown
Member Author

I suppose this should also have a docs change, which I can add tomorrow, but any feedback appreciated since I whipped this up pretty quick from what I vaguely remember doing before for this

@bryancall bryancall added this to the 10.2.0 milestone Jun 30, 2025
@bryancall bryancall requested a review from cmcfarlen June 30, 2025 22:18
@bryancall
Copy link
Copy Markdown
Contributor

[approve ci autest]


This plugin can also run as a remap plugin with an optional stats over http config file as a parameter::

map / http://target @plugin=stats_over_http.so @pparam=config.file
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.

Nitpicky, but this seems like a dangerous example :). Shouldn't we use a more specific path here, like

map /_stats_over_http ...

or maybe even more specific (since the above captures the path for all hosts)?

Also, maybe mention that the "target" doesn't imply / mean anything, and can be whatever ?

#include <zlib.h>

#include <ts/remap.h>
#include <ts/remap_version.h>
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.

Separate issue, but seeing this, makes me thing we ought to add the define from this file into ts/remap.h.

}

TSRemapStatus
TSRemapDoRemap(void *id, TSHttpTxn rh, TSRemapRequestInfo * /* ATS_UNUSED */)
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.

Why id ? Typically we call this ih

(config_holder->config_path == nullptr)) {
config_holder->config->stats_path = argv[2] + ('/' == argv[2][0] ? 1 : 0);
} else if ((config_holder->config != nullptr) && (config_holder->config->stats_path.empty())) {
config_holder->config->stats_path = DEFAULT_URL_PATH;
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.

Maybe I'm not reading this right, but shouldn't the default path here be the "from_url" path in the RRI (the remap.config "from URL") ?

It kinda feels weird that you can override the path with the pparam or config file. What would happen if I do

map http://localhost/_stats_over_http http://default @plugin=stats_over_http.so @pparam=/bar

How could that ever match on the path now ?

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.

@github-actions github-actions Bot added the Stale label Sep 30, 2025
@github-actions github-actions Bot closed this Oct 7, 2025
@zwoop zwoop removed this from the 10.2.0 milestone Mar 18, 2026
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.

3 participants