Skip to content

sdk/metric: ignore nil ExemplarFilter in WithExemplarFilter#8279

Open
kushalShukla-web wants to merge 3 commits into
open-telemetry:mainfrom
kushalShukla-web:feature/nil_filter
Open

sdk/metric: ignore nil ExemplarFilter in WithExemplarFilter#8279
kushalShukla-web wants to merge 3 commits into
open-telemetry:mainfrom
kushalShukla-web:feature/nil_filter

Conversation

@kushalShukla-web
Copy link
Copy Markdown

@kushalShukla-web kushalShukla-web commented Apr 29, 2026

fixes : #8240

Hi @dashpole , could you please take a look when you have time?

@kushalShukla-web kushalShukla-web changed the title Signed-off-by: Kushal Shukla <kushalshukla110@gmail.com> sdk/metric: ignore nil ExemplarFilter in WithExemplarFilter Apr 29, 2026
@kushalShukla-web kushalShukla-web marked this pull request as draft April 29, 2026 18:48
@kushalShukla-web kushalShukla-web marked this pull request as ready for review May 1, 2026 15:59
@dashpole
Copy link
Copy Markdown
Collaborator

dashpole commented May 1, 2026

I don't think we've made a decision on the issue, which lists two possible resolutions.

Copy link
Copy Markdown
Contributor

@Dipanshusinghh Dipanshusinghh left a comment

Choose a reason for hiding this comment

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

I think this approach makes sense if the decision is to ignore nil filters instead of panicing.

The added nil check looks straightforward, and the extra test cases help cover both the direct nil case and the case where nil is passed after an existing valid filter.

Especially liked the second test since it confirms the previous config isnt getting overwritten accidentally.

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.

Decide how to handle metric.WithExemplarFilter(nil)

3 participants