Commit 1f8e4c4
feat: structured logging (#1271)
* add sentry logs option
* add sentry logs option to example
* feat(logs): add sentry log API + send first logs (#1272)
* add sentry log API + send first logs
* fix log_level_as_string
* attach attributes to logs
* attach formatted message + args
* add to example
* add more attributes
* cleanup
* windows warning-as-error
* windows warning-as-error v2
* windows warning-as-error v2 (final)
* add unit tests for initial logs
* memleak attempted fix
* memleak attempted fix 2
* cleanup
* use `sentry_level_t` instead of new log level enum
* add SENTRY_LEVEL_TRACE to sentry_logger
* quick anti-brownout fix
- see #1274
* fix missing SENTRY_LEVEL_INFO string return
* fix logger level check + add test
* cleanup logs parameter extraction
* warn-as-error fix
* const char* fix
* static function
* feat(logs): add (u)int64 sentry_value_t type (#1301)
* add (u)int64 sentry_value_t type
* add value_to_msgpack missing switch cases
* remove undefined behavior test (C99 6.3.1.4)
* avoid Windows sized integer name collision
* cleanup & apply code review feedback
* more cleanup & remove type coercion
* update logs param conversion
* own uint64 string
* apply suggestions from code review
* fixed log parameter conversion
* update example to avoid warning-as-error
* feat(logs): batching (#1338)
* initial queue attempt
* add timer
* prototype double buffer approach
* update logs unit tests for batching
* replace timer with bgworker
* add first integration tests
* update example.c with correct log thread amounts
* cleanup
* add wait for 'adding' logs in flush logic
* go back to single queue for performance testing
* add time checks
* add ToDos + cleanup sentry_value_t cloning
* initial attempt
* cond_wait for timer + 'adding' spinlock
* add sleep for tests
* add sleep for tests
* force flush before attempting timer_worker shutdown
* add proper cond_wait for 'adding' counter
* revert to manual flush on shutdown instead of timer thread flush
* add separate timer_stop atomic
* cleanup + replace 'adding' cond_wait by pure spinlock
* change bgworker for simpler thread implementation
* cleanup
* fix memleak
* fixes
* cleanup
* cleanup
* windows fixes
* update shutdown order
* fixes
* explicit check to stop timer task
* windows cleanup
* loosen threaded test assertion for CI
- too much variability in thread scheduling, so we can expect pretty much anything
* add continue for unexpected logs flush trigger instead of attempting flush
* Windows re-add condition variable trigger case
* feat(logs): add `before_send_log` (#1355)
* add `before_send_log` callback
* add `before_send_log` callback tests
* (temporary) add debug for calling sentry_options_free
* remove early return
* add late return
* cleanup
* fix ownership issues in single buffer batching (#1362)
* let the producer thread sleep for 1ms between logs
* fix two missing NULL checks in the json serializer
* clean up logging and early exits in `enqueue_log_single()`
* clean up ownerships in logs
* eliminate clones (we expect that everything outlives the logs being sent except local construction)
* use incref everywhere where we ref global state. this was the cause of the UAF, partially solved with the clones but a few were missing. no reason to clone if we do not want to disconnect for a particular object graph
* clarify that add_attribute expects ownership
* minimize scope_mut by moving os_context out
* raise that log output in throughput tests add to variability (stdout logging should be turned off when running a limit)
* log error in case we weren't able to start the log batching worker
* fix clang-cl warning
* ci: fix failing mingw build (#1361)
* ci: fix failing mingw build
* split `ASM_MASM_COMPILER` and `_FLAGS`
* add `ASM_MASM_FLAGS` in `mingw` install step
* specify the `CMAKE_ASM_MASM_COMPILER` as a `FILEPATH`
* clean up CMAKE_DEFINES construction so it is easier to diff in the future
* fix `LLVM_MINGW_INSTALL_PATH` to be referenced locally rather than $env
(cherry picked from commit 519554f)
* use UNREACHABLE macro to fix anal warnings
* batching double buffered (#1365)
* first attempt at double buffered
* remove the sleep from the windows thread func
* clean up thread waiting in the example
* adapt the double buffer to use retries, fix remaining issues, clean up and write inline docs
* return early in example on sentry_init error.
* fix formatting via shorter name for thread gate atomic
* improve inline docs of log_buffer_t members
* fetch os_context from scope
* move scope/options data retrieval into separate function + add expected keys to test
* update logs API to return status code
* cleanup
* add log-event trace connection test
* remove duplicate test
* specify macOS SDKROOT
---------
Co-authored-by: JoshuaMoelans <[email protected]>
* add flush retry for missed flush requests
* move flush retry into flush function
* add docs
---------
Co-authored-by: Mischan Toosarani-Hausberger <[email protected]>
* update CHANGELOG.md
* use `trace_id` from scoped spans for logs
* fix copy-paste leftover + docs
* add log_sleep for thread test + variable NUM_LOGS
* no `usleep` on windows :(
* fix seconds->milliseconds
* cleanup
* test(logs): add 32-bit vargs test (#1370)
* add vargs conversion test
* add ifdef for 32-bit systems
* Update tests/unit/test_logs.c
Co-authored-by: Mischan Toosarani-Hausberger <[email protected]>
* add comment
* fix comment
---------
Co-authored-by: Mischan Toosarani-Hausberger <[email protected]>
* Apply suggestions from code review
Co-authored-by: Mischan Toosarani-Hausberger <[email protected]>
* post-merge cleanup
* pin ruamel version
* let's unpin ruamel.yaml.clib to get 0.2.14
which seemingly fixes the missing header:
https://sourceforge.net/p/ruamel-yaml-clib/tickets/47/#de77
* add empty payload check
* log output of logger tests if we fail to find the pre-crash marker
* fix: move `is_tsan` marker into the `has_crashpad` condition...
...so we can ignore in which module a `crashpad` test runs.
* fix: update `has_crashpad` condition comment
* really only move `is_tsan`, but keep the module level `pytestmark`
* CHANGELOG.md update
* CHANGELOG.md update
* CHANGELOG.md update
---------
Co-authored-by: Mischan Toosarani-Hausberger <[email protected]>1 parent d56701c commit 1f8e4c4
File tree
26 files changed
+1640
-14
lines changed- examples
- include
- src
- tests
- unit
26 files changed
+1640
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
3 | 9 | | |
4 | 10 | | |
5 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
161 | 189 | | |
162 | 190 | | |
163 | 191 | | |
| |||
291 | 319 | | |
292 | 320 | | |
293 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
294 | 358 | | |
295 | 359 | | |
296 | 360 | | |
| |||
364 | 428 | | |
365 | 429 | | |
366 | 430 | | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
367 | 441 | | |
368 | 442 | | |
369 | 443 | | |
| |||
416 | 490 | | |
417 | 491 | | |
418 | 492 | | |
419 | | - | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
420 | 500 | | |
421 | 501 | | |
422 | 502 | | |
423 | 503 | | |
424 | 504 | | |
425 | 505 | | |
426 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
427 | 546 | | |
428 | 547 | | |
429 | 548 | | |
| |||
670 | 789 | | |
671 | 790 | | |
672 | 791 | | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
673 | 795 | | |
674 | 796 | | |
675 | 797 | | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
676 | 801 | | |
677 | 802 | | |
678 | 803 | | |
| |||
689 | 814 | | |
690 | 815 | | |
691 | 816 | | |
| 817 | + | |
| 818 | + | |
692 | 819 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
| 445 | + | |
445 | 446 | | |
446 | 447 | | |
447 | 448 | | |
| |||
1889 | 1890 | | |
1890 | 1891 | | |
1891 | 1892 | | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
1892 | 1970 | | |
1893 | 1971 | | |
1894 | 1972 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| 169 | + | |
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
| |||
287 | 289 | | |
288 | 290 | | |
289 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
290 | 296 | | |
291 | 297 | | |
292 | 298 | | |
| |||
313 | 319 | | |
314 | 320 | | |
315 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
316 | 331 | | |
317 | 332 | | |
318 | 333 | | |
| |||
0 commit comments