Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and Update Telemetry Properties and Tests #456

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

armando-rodriguez-cko
Copy link
Contributor

@armando-rodriguez-cko armando-rodriguez-cko commented Dec 16, 2024

Description:

This PR significantly refactors telemetry data management in the SDK and enhances tests to ensure more efficient and reliable tracking of HTTP request metrics.


Key Changes:

Telemetry Refactor:

  • Replaced ThreadLocal<Map<String, Object>> with ThreadLocal<RequestMetrics> for a more structured telemetry data management.
  • Introduced the RequestMetrics class with dedicated methods for generating and formatting telemetry headers.
  • Simplified exception handling in ApacheHttpClientTransport with a centralised handleException method.

Telemetry API Enhancements:

  • Telemetry headers now include:
    • prev_request_id: ID of the previous request.
    • request_id: Unique ID of the current request.
    • prev_request_duration: Duration of the previous request in milliseconds.
  • Telemetry data is now formatted as clean JSON using the toTelemetryHeader method in RequestMetrics.

Extended Tests:

  • Telemetry Integration Tests:
    • Validate telemetry headers for individual and concurrent requests.
    • Ensure unique headers in high-concurrency scenarios.
  • Load Testing:
    • Simulated 1000 concurrent requests to evaluate the system's robustness under heavy load.

Fixes:

  • Resolved code duplication in HTTP client setup.
  • Removed redundant dependencies and simplified header handling.

Impact:

  • Performance: Reduced memory usage by consolidating telemetry handling into a specific class.
  • Maintainability: Cleaner and modular code, facilitating future enhancements.
  • Reliability: Enhanced tests ensure consistent behavior under varying conditions.

Additional Notes:

  • Changes require reviewing external dependencies interacting with ApacheHttpClientTransport.
  • Some tests marked as @Disabled are available for manual testing under specific scenarios.

@armando-rodriguez-cko armando-rodriguez-cko requested a review from a team December 16, 2024 17:21
@armando-rodriguez-cko armando-rodriguez-cko merged commit f8dc5a2 into master Dec 16, 2024
4 checks passed
@armando-rodriguez-cko armando-rodriguez-cko deleted the bugfix/change-telemetry-to-snake-case branch December 16, 2024 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants