-
Notifications
You must be signed in to change notification settings - Fork 847
[OTLP] Refactor OpenTelemetry Collector integration tests and log HTTP response when export fails #6564
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
base: main
Are you sure you want to change the base?
Conversation
- Refactor tests to use `[MemberData]` to avoid duplication. - Fix code analysis suggestions. - Log event level.
Verify that there are no warnings or errors during the integration tests.
Refactor tests to de-duplicate assertion code.
- Add a gauge and a histogram to the metrics test. - Rename variable. - Refactor use of `Assert.Single()`.
Log the HTTP response body, if available. Resolves open-telemetry#6454.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6564 +/- ##
==========================================
- Coverage 86.67% 86.64% -0.03%
==========================================
Files 258 258
Lines 11895 11909 +14
==========================================
+ Hits 10310 10319 +9
- Misses 1585 1590 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the OpenTelemetry Collector integration tests to improve error detection and debugging while adding response body logging when HTTP exports fail. The changes enhance test reliability by verifying no warnings or errors occur during tests and provide better debugging information when issues arise.
- Refactored integration tests to use MemberData instead of InlineData for better maintainability
- Added verification that no warnings or errors occur during integration tests
- Enhanced HTTP export error logging to include response body content for better debugging
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
IntegrationTests.cs | Refactored test cases to use MemberData, added error/warning validation, and improved test structure |
OpenTelemetryProtocolExporterEventSource.cs | Updated HttpRequestFailed method to include response body parameter |
OtlpHttpExportClient.cs | Added response body retrieval when HTTP export fails |
OtlpGrpcExportClient.cs | Added response body retrieval and proper resource disposal for gRPC exports |
OtlpExportClient.cs | Added helper method to safely extract response body content |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpExportClient.cs
Show resolved
Hide resolved
...Telemetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/OtlpGrpcExportClient.cs
Show resolved
Hide resolved
@alanwest, @rajkumar-rangaraj - there should be no performance impact in the standard cases. It is reading body response only when exception occured. |
Verified the test improvements by changing this line of code to use v0.133.0 of the collector (see #6565):
opentelemetry-dotnet/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/docker-compose.yml
Line 22 in 6a70665
With that change, the metrics tests in this PR fail due to the error event being detected, with a message like the below printed in the test output:
Making the same change to use v0.133.0 in main, the tests do not fail.
Changes
Merge requirement checklist
AppropriateCHANGELOG.md
files updated for non-trivial changesChanges in public API reviewed (if applicable)