Skip to content

Conversation

JoshuaMoelans
Copy link
Member

@JoshuaMoelans JoshuaMoelans commented Aug 8, 2025

superseded by #1338 and #1365


VERY WORK-IN-PROGRESS

to be merged into #1271

ToDo

  • implement batching logic, which flushes a logs queue every 100 logs / every 5 seconds
  • ensure that this implementation is thread-safe, and blocks as little as possible
  • adapt existing tests & add integration test checking log envelope contents

Progress

  • initial implementation is just a single logs buffer/queue that fills up, flushes when it reaches 100, and spawns a thread with a 5s timer.

    • Makes use of atomic fetching of counter values to avoid collision.
  • double buffer approach (like in .NET) seems more promising

#skip-changelog

* 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
# Conflicts:
#	examples/example.c
#	src/sentry_envelope.c
#	src/sentry_envelope.h
#	tests/unit/tests.inc
# Conflicts:
#	include/sentry.h
#	src/sentry_json.c
#	src/sentry_value.c
#	tests/unit/test_value.c
#	tests/unit/tests.inc
@JoshuaMoelans JoshuaMoelans mentioned this pull request Aug 8, 2025
21 tasks
@JoshuaMoelans JoshuaMoelans changed the title feat(logs): add batching support WIP - feat(logs): add batching support Aug 8, 2025
@JoshuaMoelans JoshuaMoelans changed the title WIP - feat(logs): add batching support (outdated) logs - initial batching prototype Sep 11, 2025
Base automatically changed from joshua/feat/logs to master September 23, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant