Skip to content

fix(appolly): preserve other selector criteria with pid matches#1911

Merged
mmat11 merged 1 commit into
open-telemetry:mainfrom
MrAlias:fix/pid-match-short-circuits-other-selector-criteria
Apr 24, 2026
Merged

fix(appolly): preserve other selector criteria with pid matches#1911
mmat11 merged 1 commit into
open-telemetry:mainfrom
MrAlias:fix/pid-match-short-circuits-other-selector-criteria

Conversation

@MrAlias
Copy link
Copy Markdown
Contributor

@MrAlias MrAlias commented Apr 23, 2026

Summary

  • keep PID selectors as a narrowing criterion instead of letting them bypass the rest of the selector
  • add regression coverage to ensure PID matches still require the other configured criteria to match

Why

Process matching returned early when a selector included target_pids, which let a PID hit short-circuit the rest of the selector criteria. That made mixed selectors behave too broadly whenever a matching PID was present.

This behavior also conflicted with the documented selector semantics. The generated OBI config reference describes target_pids as additive: the PID must match "in addition to any path/port criteria". The published OBI service discovery docs also state that when multiple selectors are configured in the same instrument entry, the process must match all selector properties.

Impact

This keeps selector evaluation consistent with the documented configuration model: a configured PID list can narrow matching, but it no longer overrides other path, language, command-argument, container, or metadata criteria.

Validation

  • go test ./pkg/appolly/discover

@MrAlias MrAlias added the bug Something isn't working label Apr 23, 2026
@MrAlias MrAlias added this to the v0.9.0 milestone Apr 23, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.23%. Comparing base (81871be) to head (31d19f7).
⚠️ Report is 13 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (81871be) and HEAD (31d19f7). Click for more details.

HEAD has 8 uploads less than BASE
Flag BASE (81871be) HEAD (31d19f7)
integration-test-vm-x86_64-6.10.6 4 0
integration-test-vm-x86_64-5.15.152 4 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1911      +/-   ##
==========================================
- Coverage   78.23%   69.23%   -9.00%     
==========================================
  Files         278      279       +1     
  Lines       34240    34283      +43     
==========================================
- Hits        26786    23735    -3051     
- Misses       6205     9279    +3074     
- Partials     1249     1269      +20     
Flag Coverage Δ
integration-test 56.09% <33.33%> (+0.70%) ⬆️
integration-test-arm 28.51% <33.33%> (-1.66%) ⬇️
integration-test-vm-x86_64-5.15.152 ?
integration-test-vm-x86_64-6.10.6 ?
k8s-integration-test 42.34% <33.33%> (-0.12%) ⬇️
oats-test 38.84% <33.33%> (+1.18%) ⬆️
unittests 58.68% <100.00%> (+0.36%) ⬆️

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MrAlias MrAlias marked this pull request as ready for review April 23, 2026 21:17
@MrAlias MrAlias requested a review from a team as a code owner April 23, 2026 21:17
Copilot AI review requested due to automatic review settings April 23, 2026 21:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts AppO11y process discovery selector semantics so target_pids narrows matches rather than short-circuiting other selector criteria, aligning runtime behavior with documented configuration expectations.

Changes:

  • Update Matcher.matchProcess to treat PID lists as a required filter (fail fast on PID mismatch) while still evaluating other selector criteria.
  • Add a regression test ensuring PID matches do not bypass other configured criteria (e.g., exe_path).

Reviewed changes

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

File Description
pkg/appolly/discover/matcher.go Changes PID handling from early-return “match-by-PID only” to “PID must match, then evaluate remaining criteria”.
pkg/appolly/discover/matcher_test.go Adds regression coverage verifying PID hits still require other selector properties (e.g., path) to match.

@mmat11 mmat11 merged commit a2bc1da into open-telemetry:main Apr 24, 2026
74 checks passed
@MrAlias MrAlias deleted the fix/pid-match-short-circuits-other-selector-criteria branch April 24, 2026 14:09
@damemi
Copy link
Copy Markdown
Member

damemi commented Apr 24, 2026

sorry about the confusion, I looked back and we did this purposefully because PID seemed pretty explicit: #1321 (comment) but I agree with the revert to match the documentation and other behavior

@MrAlias MrAlias mentioned this pull request May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants