Skip to content

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

Draft
parametalol wants to merge 1 commit intomasterfrom
michael/ROX-33893-header-name-glob
Draft

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

Conversation

@parametalol
Copy link
Copy Markdown
Contributor

Description

This PR enhances telemetry header matching by allowing glob patterns in header names, not just header values. Previously, telemetry campaigns could only match exact header names with pattern values. Now both header names and values can use glob patterns.

Key changes:

  • Changed APICallCampaignCriterion.Headers from map[string]glob.Pattern to map[glob.Pattern]glob.Pattern
  • Added HeadersFilter function to RequestParams for pattern-based header filtering
  • Implemented Headers.GetAll method that matches both header names and values using globs
  • Refactored ServiceNow integration to use "Rh-*" pattern instead of hardcoded "Rh-ServiceNow-Integration"

Motivation:
The ServiceNow integration sets headers with a common prefix, but the exact header name may vary. Using glob patterns for header names allows tracking multiple 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

  • Added comprehensive unit tests in headers_multimap_test.go covering various glob pattern scenarios
  • Updated existing tests in interceptors_test.go, campaign_test.go, and request_params_test.go to use the new pattern-based header matching
  • Verified that the ServiceNow integration test properly matches the "Rh-*" pattern
  • Tests validate both successful matches and error cases (invalid glob patterns)

🤖 Generated with Claude Code

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

Images are ready for the commit at 628b5f8.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-464-g628b5f88ec.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 75.43860% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.38%. Comparing base (54d515d) to head (628b5f8).
⚠️ Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
central/telemetry/centralclient/interceptors.go 55.55% 5 Missing and 3 partials ⚠️
pkg/telemetry/phonehome/request_params.go 25.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #19687    +/-   ##
========================================
  Coverage   49.37%   49.38%            
========================================
  Files        2742     2743     +1     
  Lines      206953   207074   +121     
========================================
+ Hits       102187   102263    +76     
- Misses      97182    97227    +45     
  Partials     7584     7584            
Flag Coverage Δ
go-unit-tests 49.38% <75.43%> (+<0.01%) ⬆️

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.

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