Commit 2f0f28c
authored
fix(core): Fix/otel compat (#6119)
* refactor(otel): use compatibility helpers instead of duplicating entire 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.
* fix: remove unused NonInjectable import
* refactor(otel): use Apache HttpClient for cross-version compatibility
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
* refactor(otel): use HttpRequests for proxy and user agent support
Use IntelliJ's HttpRequests API instead of Apache HttpClient to respect IDE proxy settings and use AWS Toolkit user agent.
* Optimize telemetry export by writing directly to output stream
* perf(otel): write telemetry directly to HTTP stream
Address PR review feedback to avoid intermediate ByteArrayOutputStream.
Instead of:
1. Write to ByteArrayOutputStream
2. Convert to byte array
3. Write byte array to HTTP connection
Now:
1. Write directly to HTTP connection.outputStream
This reduces memory allocation and improves performance by streaming
data directly to the network without intermediate buffering.1 parent a60c9c1 commit 2f0f28c
File tree
2 files changed
+7
-176
lines changed- plugins/core/jetbrains-community
- src-253+/software/aws/toolkits/jetbrains/services/telemetry/otel
- src/software/aws/toolkits/jetbrains/services/telemetry/otel
2 files changed
+7
-176
lines changedLines changed: 0 additions & 171 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | 12 | | |
| 13 | + | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
0 commit comments