[code-simplifier] Simplify instrumentation builder methods - #45
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[code-simplifier] Simplify instrumentation builder methods#45github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Remove redundant null-check branches in WithAspNetCoreInstrumentation and WithHttpClientInstrumentation methods. The OpenTelemetry SDK methods accept nullable configure delegates, so we can pass the parameter directly instead of branching on null. - Reduces complexity by eliminating if-else blocks - Makes intent clearer: these are simple pass-throughs - Maintains identical behavior (all tests pass) - Reduces lines of code by ~10 per method Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code Simplification - 2026-09-03
This PR simplifies recently added builder extension methods to improve clarity and reduce unnecessary branching while preserving all functionality.
Files Simplified
src/WitnessSharp/WitnessBuilderExtensions.cs- Eliminated redundant null-check branches in two instrumentation methodsImprovements Made
Reduced Complexity
WithAspNetCoreInstrumentation()andWithHttpClientInstrumentation()methodsconfiguredelegates, making the branching unnecessaryEnhanced Clarity
Applied Project Standards
Changes Based On
Initial commit of WitnessSharp repository (commit
de160c1- "Reduce bloat in README Recipes section #44")Testing
Review Focus
Please verify: