Skip to content

ROX-33893: Support glob patterns in telemetry header names#19687

Closed
parametalol wants to merge 4 commits intomasterfrom
michael/ROX-33893-header-name-glob
Closed

ROX-33893: Support glob patterns in telemetry header names#19687
parametalol wants to merge 4 commits intomasterfrom
michael/ROX-33893-header-name-glob

Conversation

@parametalol
Copy link
Copy Markdown
Contributor

@parametalol parametalol commented Mar 30, 2026

Description

Support glob patterns in telemetry header names, not just values. Previously, campaigns could only match exact header names. Now both header names and values support globs (e.g., "Rh-*": NoHeaderOrAnyValue).

Additionally, refactored RequestParams to replace Headers func(string) []string field with Headers Headers field.

Key changes:

  • APICallCampaignCriterion.Headers: map[string]glob.Pattern -> map[glob.Pattern]glob.Pattern
  • RequestParams: Headers field type is now Headers
  • Headers.GetAll: matches both header names and values using globs
  • NewHeaders(metadata.MD): canonicalizes gRPC metadata lowercase keys into http.Header format
  • ServiceNow integration now uses "Rh-*" pattern instead of hardcoded header name

Motivation:
ServiceNow sets headers with a common Rh- prefix, but the exact name may vary. Glob patterns for header names allow tracking related headers without hardcoding each variant.

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

  • Unit tests cover glob matching on header names and values, including match/no-match/error cases
  • Existing campaign, interceptor, and request_params tests updated for the refactored Headers field
  • ServiceNow integration test validates "Rh-*" pattern matching
  • All tests pass: go test ./pkg/telemetry/phonehome/... ./central/telemetry/centralclient/...

Change telemetry campaign header matching from exact string keys to
glob pattern keys. This allows matching multiple headers with a single
pattern (e.g., "Rh-*" instead of hardcoding specific header names).

Changes:
- Updated APICallCampaignCriterion.Headers from map[string]glob.Pattern
  to map[glob.Pattern]glob.Pattern
- Added HeadersFilter func to RequestParams for pattern-based filtering
- Implemented Headers.GetAll method for glob-based header matching
- Updated ServiceNow integration to use "Rh-*" pattern
- Added comprehensive test coverage

This change was requested to make telemetry header tracking more flexible
for integrations that may use varying header names with common prefixes.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 30, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@rhacs-bot
Copy link
Copy Markdown
Contributor

rhacs-bot commented Mar 30, 2026

Images are ready for the commit at f52b5a2.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-467-gf52b5a2228.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 88.09524% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.66%. Comparing base (54d515d) to head (f52b5a2).
⚠️ Report is 47 commits behind head on master.

Files with missing lines Patch % Lines
central/telemetry/centralclient/interceptors.go 37.50% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19687      +/-   ##
==========================================
+ Coverage   49.37%   49.66%   +0.28%     
==========================================
  Files        2742     2747       +5     
  Lines      206953   207310     +357     
==========================================
+ Hits       102187   102959     +772     
+ Misses      97182    96697     -485     
- Partials     7584     7654      +70     
Flag Coverage Δ
go-unit-tests 49.66% <88.09%> (+0.28%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@parametalol
Copy link
Copy Markdown
Contributor Author

Split to #19722 and #19723.

@parametalol parametalol deleted the michael/ROX-33893-header-name-glob branch March 31, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants