-
Notifications
You must be signed in to change notification settings - Fork 397
Telemetry-safe error reporting for native extensions #5076
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
Open
marcotc
wants to merge
116
commits into
master
Choose a base branch
from
marcotc/error-logs-remediation-custom-profiler-code
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
116 commits
Select commit
Hold shift + click to select a range
8e2bf94
Implement custom exception approach for errors from C code
bouwkast 27067c0
Update to support constant_exception_message and ProfilingError
bouwkast 3d908d7
Implement two-tier exception strategy for profiler errors
bouwkast b9bb905
Fix compilation errors by adding missing ruby_helpers.h includes
bouwkast 032adc0
Fix header ordering in private_vm_api_access.c
bouwkast 3f01db9
Fix: Declare exception classes locally in private_vm_api_access.c
bouwkast abe3f0d
Update RBS signature for renamed method constant_exception_message
bouwkast f04f01d
Fix: Move error method before private keyword
bouwkast 9e8e039
Fix serialize! to raise ProfilingInternalError
bouwkast c31665f
Add compile-time safe macros for profiler exception raising
bouwkast 6a292a4
Merge branch 'master' into steven/error-logs-remediation-custom-profi…
marcotc b5480a1
Working
marcotc 807af7b
First try
marcotc d740503
Second
marcotc f14ee3a
wip
marcotc f4234c6
wip
marcotc b99a2cc
wip
marcotc c83b723
wip
marcotc 90327d1
wip
marcotc d7f0dc3
wip
marcotc c191889
wip
marcotc 639ee6e
wip
marcotc ef6b441
wip
marcotc 5e6fc62
wip
marcotc 19db45e
wip
marcotc 962845d
wip
marcotc 6c77ebc
Revert whitespace-only changes (blank lines)
marcotc b7edd96
Revert line wrapping and whitespace changes in libdatadog_api files
marcotc 1192a01
Merge branch 'master' into marcotc/error-logs-remediation-custom-prof…
marcotc c1cb858
Rename prefix
marcotc 2b260e6
Change arg type
marcotc dd009d1
Raise argument error exception
marcotc 745a67f
Move init
marcotc fe72ab0
Add fmt string
marcotc 4a2e3be
Add telemetry str
marcotc 5432e65
Add errno telemetry
marcotc 932f498
Fix syserr and handlers
marcotc a11e10e
Add tests
marcotc 62e4e0c
Add raise_error helper function to shared datadog_ruby_common
marcotc 8a9926c
Restore crashtracker.c formatting
marcotc b285c97
add types
marcotc 773bdc3
Revert libdatadog
marcotc c2a1ba8
wip
marcotc f094962
wip
marcotc 218c27e
Fix test
marcotc 9e98720
wip
marcotc da487a8
Fix
marcotc 451877c
Fix all libdatadog
marcotc 03c1438
sync files
marcotc 6b57cc5
Revert gemfiles
marcotc f3e80c2
Fix whitespace
marcotc bd95c25
Fix
marcotc de944a7
wip
marcotc 7678942
wip
marcotc c58f6c6
wip
marcotc 44685f3
wip
marcotc 36fc144
fix
marcotc 80e181f
wip
marcotc 6877e18
wip
marcotc 88be38c
wip
marcotc 4260424
wip
marcotc 60298b3
wip
marcotc 05b342d
wip
marcotc 51bfbcb
wip
marcotc 49c70f9
wip
marcotc 5966f08
Update spec/datadog/core/telemetry/logging_spec.rb
marcotc 4104a72
Remove unused arg
marcotc dbb0328
Check Ruby types
marcotc 039ea35
Revert testing check
marcotc cfed18e
Move to signal
marcotc fc6efa4
Remove check for internal method
marcotc cb79e28
Remove unnecessary check
marcotc 796b14d
Typo
marcotc ef78dea
Signal handler
marcotc c6ff87f
Consolidate gvl raisers
marcotc 94cce77
Improve tests
marcotc bced5eb
Add docs
marcotc d92f1a3
Remove telemetry tests spread out
marcotc 498e1c8
Remove helper
marcotc 1176586
Move files
marcotc 642591c
Dont call Ruby on raise
marcotc 58cf67e
Suggested fix
marcotc 0eff380
Call all inits in one plac
marcotc f92ebb4
Revert whitespace changes
marcotc 31d3b8d
Type check
marcotc 4f100c3
Use allow_exception
marcotc 5646e0d
Document unsafe for exceptions
marcotc 3865128
Apply suggestions from code review
marcotc 13611d0
Restore legacy install_sigprof_signal_handler signature
marcotc cc58a17
Remove debug prints from gvl sampling helper
marcotc c27ef2e
Rename native error globals and simplify telemetry handling
marcotc ad9efba
Simplify signal handler error paths without telemetry helpers
marcotc 1cb3343
Restore signals
marcotc 03ecfa6
Fix sig errors
marcotc 4cb395a
Remove unused syserr_raise_args struct
marcotc d2ac473
Remove rb_class2name
marcotc 5981b7c
Add better init comments
marcotc b210b40
Remove inline
marcotc a041560
Sync files
marcotc e0064a3
Add test
marcotc 6183bb7
Merge remote-tracking branch 'refs/remotes/origin/marcotc/error-logs-…
marcotc 7a99d1e
Merge branch 'master' into marcotc/error-logs-remediation-custom-prof…
marcotc 115adc1
Merge branch 'master' into marcotc/error-logs-remediation-custom-prof…
marcotc 9afc7c4
Remove custom classes
marcotc 9f7516d
Modify FeatureFlags
marcotc 3b36017
wip
marcotc 065f694
wip
marcotc 1db9222
wip
marcotc 883eff3
wip
marcotc 7c42a29
wip
marcotc 6a6bdfb
wip
marcotc d19db29
wip
marcotc 092d8cd
Fix compiliation warning
marcotc f99ff3d
Fix rbs
marcotc 824a340
Remove unsued
marcotc 976a297
Merge branch 'master' into marcotc/error-logs-remediation-custom-prof…
marcotc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| #include "datadog_ruby_common.h" | ||
| #include <stdarg.h> | ||
|
|
||
| // IMPORTANT: Currently this file is copy-pasted between extensions. Make sure to update all versions when doing any change! | ||
|
|
||
| void raise_unexpected_type(VALUE value, const char *value_name, const char *type_name, const char *file, int line, const char* function_name) { | ||
|
|
||
|
|
||
| void raise_unexpected_type(VALUE value, const char *value_name, const char *type_name, const char *file, int line, const char *function_name) { | ||
| rb_exc_raise( | ||
| rb_exc_new_str( | ||
| rb_eTypeError, | ||
|
|
@@ -18,6 +21,14 @@ void raise_unexpected_type(VALUE value, const char *value_name, const char *type | |
| ); | ||
| } | ||
|
|
||
| void raise_error(VALUE error_class, const char *fmt, ...) { | ||
| va_list args; | ||
| va_start(args, fmt); | ||
| VALUE message = rb_vsprintf(fmt, args); | ||
| va_end(args); | ||
| rb_raise(error_class, "%"PRIsVALUE, message); | ||
| } | ||
|
|
||
| VALUE datadog_gem_version(void) { | ||
| VALUE ddtrace_module = rb_const_get(rb_cObject, rb_intern("Datadog")); | ||
| ENFORCE_TYPE(ddtrace_module, T_MODULE); | ||
|
|
@@ -78,3 +89,8 @@ ddog_Vec_Tag convert_tags(VALUE tags_as_array) { | |
|
|
||
| return tags; | ||
| } | ||
|
|
||
| void datadog_ruby_common_init(VALUE datadog_module) { | ||
| // No longer needed - using Ruby's built-in exception classes | ||
| (void)datadog_module; | ||
| } | ||
|
Comment on lines
+93
to
+96
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest removing this + its callsites; it's a bit of complexity (including comments in "profiling.c" saying this needs to be called first) and I'm not sure it's worth leaving around. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Wait, I'm confused by this... Is this a leftover from an earlier version?
That is, I thought the correct version of
raise_errorwas the#define raise_errorwe have inruby_helpers.c(the one that grabs the format string separately, etc); this one seems to just be a weird direct passthrough torb_raise.Am I missing something? 🤔 👀