-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat(error): show internal correlation id in error messages #411
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #411 +/- ##
==========================================
+ Coverage 80.41% 80.43% +0.02%
==========================================
Files 32 32
Lines 5750 5756 +6
==========================================
+ Hits 4624 4630 +6
Misses 718 718
Partials 408 408 ☔ View full report in Codecov by Sentry. |
hcloud/client.go
Outdated
// InternalCorrelationID returns the unique ID of the request as set by the API. This ID can help with support requests, | ||
// as it allows the people working on identify this request in particular. | ||
func (r *Response) InternalCorrelationID() string { | ||
return r.Header.Get(headerCorrelationID) | ||
} | ||
|
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.
I am not sure if we should add this to our public interface. There is no guarantee that this header will always be exposed in the API. I am fine with removing this from the public interface.
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.
I'd keep it private for now, until we have a better vision on how we want to do tracing in our integrations.
I am not sure if we have plans for extending the reach of our tracing capabilities, but I think it would be awesome to not stop tracing at the boundaries of the public API, but try to push it all the way in our integrations' logic.
Maybe we are allowed to generate this correlation ID, and let the API reuse it or wrap it. I'd love to have the traces that start from a hccm call and come all the way back :).
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.
I also think keeping it private is better. If someone needed the correlation ID, it would be accessible over the Headers
field anyway.
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.
Changed to internalCorrelationID
(private)
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.
I think it's a great addition! I'll implement it in python once we agree on how we should handle this!
hcloud/client.go
Outdated
// InternalCorrelationID returns the unique ID of the request as set by the API. This ID can help with support requests, | ||
// as it allows the people working on identify this request in particular. | ||
func (r *Response) InternalCorrelationID() string { | ||
return r.Header.Get(headerCorrelationID) | ||
} | ||
|
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.
I'd keep it private for now, until we have a better vision on how we want to do tracing in our integrations.
I am not sure if we have plans for extending the reach of our tracing capabilities, but I think it would be awesome to not stop tracing at the boundaries of the public API, but try to push it all the way in our integrations' logic.
Maybe we are allowed to generate this correlation ID, and let the API reuse it or wrap it. I'd love to have the traces that start from a hccm call and come all the way back :).
This commit changes the way error responses from the API are formatted for display to users. When available, it adds the Correlation (Trace) ID header to the error string. We often have users that post the error string, but rarely do users have debug logging active. By adding the correlation ID to error messages, we can more quickly investigate why something went wrong using the Hetzner internal tracing system. This is common practice in Web Apps, they usually show a request/trace ID or an encrypted blob in case of an internal server errror.
2fdef2a
to
12af0ca
Compare
This commit changes the way error responses from the API are formatted for display to users. When available, it adds the Correlation (Trace) ID header to the error string. We often have users that post the error string, but rarely do users have debug logging active. By adding the correlation ID to error messages, we can more quickly investigate why something went wrong using the Hetzner internal tracing system. This is common practice in Web Apps, they usually show a request/trace ID or an encrypted blob in case of an internal server error. (cherry picked from commit 6c96d19)
This commit changes the way error responses from the API are formatted for display to users. When available, it adds the Correlation (Trace) ID header to the error string. We often have users that post the error string, but rarely do users have debug logging active. By adding the correlation ID to error messages, we can more quickly investigate why something went wrong using the Hetzner internal tracing system. This is common practice in Web Apps, they usually show a request/trace ID or an encrypted blob in case of an internal server error. Backport 6c96d19 from #411. Co-authored-by: Julian Tölle <julian.toelle@hetzner-cloud.de>
🤖 I have created a release *beep* *boop* --- ## [2.8.0](v2.7.2...v2.8.0) (2024-05-06) ### Features * **error:** show internal correlation id in error messages ([#411](#411)) ([6c96d19](6c96d19)) * implement actions waiter ([#407](#407)) ([1e3fa70](1e3fa70)) * require Go >= 1.21 ([#424](#424)) ([d4f4000](d4f4000)) ### Bug Fixes * improve error message format with correlation id ([#430](#430)) ([013477f](013477f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit changes the way error responses from the API are formatted for display to users. When available, it adds the Correlation (Trace) ID header to the error string.
We often have users that post the error string, but rarely do users have debug logging active. By adding the correlation ID to error messages, we can more quickly investigate why something went wrong using the Hetzner internal tracing system.
This is common practice in Web Apps, they usually show a request/trace ID or an encrypted blob in case of an internal server error.