Skip to content

declarative config filtering resource attributes should include by default.#8177

Merged
jack-berg merged 5 commits intoopen-telemetry:mainfrom
SylvainJuge:include-exclude-include-by-default
Mar 12, 2026
Merged

declarative config filtering resource attributes should include by default.#8177
jack-berg merged 5 commits intoopen-telemetry:mainfrom
SylvainJuge:include-exclude-include-by-default

Conversation

@SylvainJuge
Copy link
Copy Markdown
Contributor

@SylvainJuge SylvainJuge commented Mar 11, 2026

When using declarative configuration for resource attribute detectors, we get a surprising behavior when trying to only exclude attributes without explicitly including.

For example with the following configuration will make all the detected attributes ignored:

  detection/development:
    detectors:
      process:
      # ... other resource detectors ...

    attributes:
      excluded:
        - process.command_args

In order to work-around this, we have to explicitly include everything with:

    attributes:
      included:
        - '*'
      excluded:
        - process.command_args

This PR:

  • removes the need to add an explicit included: ['*']
  • adds tests for declarative configuration
  • add test for the corner-case to exclude everything with an empty include, even if it's equivalent to an "exclude all", for example this is is used for metric views where all attributes need to be removed.

As an alternative, we could also probably make this change generic in all the places where IncludeExcludePredicate is used to ensure this is applied everywhere, however this would require to make the callers deal with the corner case of "include none" to be replaced with "ignore all".

@SylvainJuge SylvainJuge requested a review from a team as a code owner March 11, 2026 14:14
@SylvainJuge
Copy link
Copy Markdown
Contributor Author

Also, it would be convenient if anyone with the permissions could assign this PR to me as I don't have the reviewer/triager role in this repository (only in instrumentation)

@SylvainJuge SylvainJuge marked this pull request as draft March 11, 2026 15:04
@SylvainJuge SylvainJuge changed the title fix IncludeExcludePredicate with empty include declarative config filtering resource attributes should include by default. Mar 11, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.29%. Comparing base (839f235) to head (4972a83).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8177   +/-   ##
=========================================
  Coverage     90.29%   90.29%           
- Complexity     7650     7652    +2     
=========================================
  Files           843      843           
  Lines         23059    23061    +2     
  Branches       2309     2310    +1     
=========================================
+ Hits          20822    20824    +2     
  Misses         1519     1519           
  Partials        718      718           

☔ 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.

@SylvainJuge SylvainJuge marked this pull request as ready for review March 11, 2026 16:07
Copy link
Copy Markdown
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

This corrects a bug and reflects the current language of the IncludeExclude type. Specifically, excluded description says:

Configure list of value patterns to exclude. Applies after .included (i.e. excluded has higher priority than included).

And .included default and null behavior says:

If omitted, all values are included.

This PR corrects the java implementation to treat omitting null as include *.

@jack-berg
Copy link
Copy Markdown
Member

Also, it would be convenient if anyone with the permissions could assign this PR to me as I don't have the reviewer/triager role in this repository (only in instrumentation)

@SylvainJuge Assignment doesn't really have any meaning in this repo (to my knowledge). What were you hoping to achieve by being assigned?

@jack-berg jack-berg merged commit 923098b into open-telemetry:main Mar 12, 2026
27 checks passed
@SylvainJuge SylvainJuge deleted the include-exclude-include-by-default branch March 12, 2026 15:37
@SylvainJuge
Copy link
Copy Markdown
Contributor Author

@SylvainJuge Assignment doesn't really have any meaning in this repo (to my knowledge). What were you hoping to achieve by being assigned?

@jack-berg this is how I track the things I work on, however this is not very practical for repositories where I can't self-assign.

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