-
Notifications
You must be signed in to change notification settings - Fork 69
fix(geneva uploader): Replace unwrap/expect with graceful error handling #485
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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #485 +/- ##
=======================================
- Coverage 53.8% 53.8% -0.1%
=======================================
Files 71 71
Lines 11687 11707 +20
=======================================
+ Hits 6299 6304 +5
- Misses 5388 5403 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
opentelemetry-exporter-geneva/geneva-uploader/src/payload_encoder/otlp_encoder.rs
Outdated
Show resolved
Hide resolved
opentelemetry-exporter-geneva/geneva-uploader/src/payload_encoder/otlp_encoder.rs
Outdated
Show resolved
Hide resolved
opentelemetry-exporter-geneva/geneva-uploader/src/payload_encoder/otlp_encoder.rs
Outdated
Show resolved
Hide resolved
opentelemetry-exporter-geneva/geneva-uploader/src/config_service/client.rs
Outdated
Show resolved
Hide resolved
opentelemetry-exporter-geneva/geneva-uploader/src/config_service/client.rs
Outdated
Show resolved
Hide resolved
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 improves error handling by replacing .unwrap() calls with more graceful error handling strategies throughout the encoder and config client code. The changes add proper error logging using the tracing::error! macro and provide fallback values to prevent panics in production.
- Replaced
.unwrap()calls with.unwrap_or_else()orif let Err()patterns - Added structured error logging with contextual information for debugging
- Provided sensible fallback values for error cases (empty strings, zeros, epoch timestamps, static headers)
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| otlp_encoder.rs | Replaced unwrap calls with error logging and fallbacks for string formatting, UTF-8 conversion, hex encoding, and timestamp conversion |
| client.rs | Added error handling for User-Agent header creation with fallback to static header |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
opentelemetry-exporter-geneva/geneva-uploader/src/payload_encoder/otlp_encoder.rs
Outdated
Show resolved
Hide resolved
opentelemetry-exporter-geneva/geneva-uploader/src/payload_encoder/otlp_encoder.rs
Outdated
Show resolved
Hide resolved
opentelemetry-exporter-geneva/geneva-uploader/src/payload_encoder/otlp_encoder.rs
Outdated
Show resolved
Hide resolved
opentelemetry-exporter-geneva/geneva-uploader/src/payload_encoder/otlp_encoder.rs
Outdated
Show resolved
Hide resolved
opentelemetry-exporter-geneva/geneva-uploader/src/payload_encoder/otlp_encoder.rs
Outdated
Show resolved
Hide resolved
opentelemetry-exporter-geneva/geneva-uploader/src/config_service/client.rs
Outdated
Show resolved
Hide resolved
…ce/client.rs Co-authored-by: Utkarsh Umesan Pillai <[email protected]>
Fixes #471
Changes
User-Agent header creation
"(Unknown) RustGenevaClient/0.1"if formatting failserror!MD5 hash formatting
Hex encoding
error!and return zeros on buffer mismatchUTF-8 conversion (
otlp_encoder.rs:573, 587, 610, 668, 682)error!and return empty string for trace/span IDsTimestamp conversion (
otlp_encoder.rs:787-806)error!and fallback to Unix epochMerge requirement checklist
CHANGELOG.mdfiles updated for non-trivial, user-facing changes