Skip to content

Conversation

@aseemxs
Copy link
Contributor

@aseemxs aseemxs commented Nov 20, 2025

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Description

Address PR #6098 review feedback to avoid duplicating OTelService.kt across version directories.

Changes:

  • Move OTelService.kt to common src/ directory (shared by all IDE versions)
  • Create version-specific HttpPostCompat.kt helper files (18-19 lines each)
  • Eliminates 137 lines of duplicated code

Technical Details:
The httpPost API changed between IDE versions 2024.2-2025.2 and 2025.3+:

  • Old: httpPost(url, contentLength, contentType) { body }
  • New: httpPost(url, contentType, body = bytes)

Follows existing codebase patterns (PythonModuleUtil, JavascriptLanguage) for handling compile-time API incompatibilities with minimal duplication.

Related: #6098

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

…re file

Address PR review feedback to avoid copying entire OTelService.kt for version compatibility.

Changes:
- Move OTelService.kt to common src/ directory (168 lines, shared by all versions)
- Create small version-specific HttpPostCompat.kt files (18-19 lines each)
- Eliminates 137 lines of code duplication
- Main logic now maintained in single location

The httpPost API changed between IDE versions 2024.2-2025.2 and 2025.3+:
- Old API uses contentLength parameter with streaming body
- New API uses body parameter with byte array

Follows existing codebase pattern (see PythonModuleUtil.kt, JavascriptLanguage.kt)
for handling compile-time API incompatibilities with minimal duplication.
@aseemxs aseemxs marked this pull request as ready for review November 20, 2025 06:43
@aseemxs aseemxs requested a review from a team as a code owner November 20, 2025 06:43
Address PR review feedback - use Apache HttpClient instead of platform httpPost API.

Changes:
- Replace IntelliJ Platform httpPost with Apache HttpClient
- Works consistently across all IDE versions (2024.2 - 2025.3+)
- Matches existing pattern used in SigV4OtlpSpanProcessor
- No version-specific compatibility wrappers needed
- Single OTelService.kt in common src/ directory

This approach:
- Uses same HTTP library as CawsEnvironmentClient and SigV4OtlpSpanProcessor
- Avoids platform API incompatibilities between IDE versions
- Follows established codebase patterns for HTTP operations

httpPost(traceUrl, contentLength = item.binarySerializedSize.toLong(), contentType = ContentType.XProtobuf) {
item.writeBinaryTo(this)
HttpClients.createDefault().use { client ->
Copy link
Contributor

Choose a reason for hiding this comment

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

does not respect IDE proxy settings nor uses our custom user agent. see HttpUtils/HttpRequests

Use IntelliJ's HttpRequests API instead of Apache HttpClient to respect IDE proxy settings and use AWS Toolkit user agent.
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