Remove unused duplicate code and improve build configuration #79
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.
This PR removes unused code from the ApplicationInsights-Java repository, specifically addressing duplicate code that was marked with a TODO comment for removal.
Changes Made
1. Removed Duplicate Sampling Logic
agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/SecondEntryPoint.javaRuntimeConfigurator.updateSampling()The
RuntimeConfigurator.updateSampling()method is called later in the initialization flow and properly handles setting the sampling percentage, making this duplication unnecessary.2. Improved Build Configuration
.gitignore/buildSrc/.kotlin/to prevent Kotlin build artifacts from being committedbuildSrc/.kotlin/errors/errors-1752940067370.log)Validation
RuntimeConfigurator.updateSampling()Analysis
After comprehensive analysis of the codebase, this duplicate sampling percentage logic was the clear case of unused code that could be safely eliminated. Other potential candidates (like ETW test applications, @SuppressWarnings classes, etc.) represent legitimate architectural decisions rather than genuinely unused code.
Fixes #78.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.