Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(metrics) space as metadata separator in metric name #618

Closed
wants to merge 2 commits into from

Conversation

casimiro
Copy link
Contributor

@casimiro casimiro commented Oct 28, 2024

WasmX metrics defined in Proxy-Wasm filters have their names prefixed by pw.{a_filter} where {a_filter} is the name of the filter where the metric was defined, e.g. pw.a_filter.a_counter.

When the Gateway serializes a WasmX metric defined in a Proxy-Wasm filter it needs to extract the filter name from the metric name. The filter name is used to load potential label patterns associated with the filter which are then used to extract potential labels from the metric name.

This PR proposes changing the separator in metric names from the dot to the space (e.g. pw a_filter a_counter) and forbidding space-like characters in WASM modules names; which simplifies the task of extracting the filter name from a metric name.

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.82880%. Comparing base (bee8b84) to head (b079790).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##                main        #618         +/-   ##
===================================================
- Coverage   90.84256%   90.82880%   -0.01377%     
===================================================
  Files             52          52                 
  Lines          11204       11209          +5     
===================================================
+ Hits           10178       10181          +3     
- Misses          1026        1028          +2     
Files with missing lines Coverage Δ
src/common/proxy_wasm/ngx_proxy_wasm_host.c 93.91206% <100.00000%> (ø)
src/wasm/ngx_wasm_directives.c 96.60194% <100.00000%> (+0.08453%) ⬆️

... and 2 files with indirect coverage changes

Flag Coverage Δ
unit 90.58560% <100.00000%> (+0.00382%) ⬆️
valgrind 82.39561% <66.66667%> (-0.12866%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@casimiro casimiro added the pr/work-in-progress PR: Work in progress label Oct 28, 2024
WasmX metrics defined in Proxy-Wasm filters are prefixed with `pw`
and the name of the filter in which they were defined, e.g.
`pw a_filter a_metric`.

Guaranteeing that WASM module names don't contain tabs or spaces makes
extraction of filter name from metric names simpler.
@casimiro casimiro force-pushed the misc/metrics-name-separator branch from d821308 to b079790 Compare October 28, 2024 16:42
@casimiro casimiro removed the pr/work-in-progress PR: Work in progress label Oct 28, 2024
always prefixed with: `pw.{filter_name}.{metric_name}`. This means that a metric
named `a_counter` inserted by `a_filter` will have its name stored as:
`pw.a_filter.a_counter`.
always prefixed with space-separated metadata: `pw {filter_name} `. This means
Copy link
Member

Choose a reason for hiding this comment

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

Reading this I realized space might not be the ideal character; it's easy to miss the trailing space in docs describing pw {filter_name} . Would it be fine if we used colons like pw:{filter_name}:? I opened #619 for merge if that's alright.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, colons are more easily spotted than spaces.

@thibaultcha thibaultcha deleted the misc/metrics-name-separator branch October 29, 2024 16:14
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.

2 participants