Skip to content

Add support for LogStruct#69

Open
ndbroadbent wants to merge 2 commits intosilva96:mainfrom
DocSpring:docspring/logstruct
Open

Add support for LogStruct#69
ndbroadbent wants to merge 2 commits intosilva96:mainfrom
DocSpring:docspring/logstruct

Conversation

@ndbroadbent
Copy link

Adds support for LogStruct:

Also with some compatibility for SemanticLogger PR #66. Shared patterns (both PRs use):

  1. VALID_LOGGER_TYPES array - each PR adds their own type to this array
  2. configure_logger_automatically - renamed from configure_lograge_automatically (with backward-compat alias)
  3. logger_type configuration option with getter/setter
  4. CLI --logger_type=TYPE flag
  5. Conditional validation based on logger_type
  6. Helper methods like lograge?, logstruct? (PR Add SemanticLogger support #66 adds semantic_logger?)

@silva96
Copy link
Owner

silva96 commented Jan 22, 2026

Hey @ndbroadbent thanks for the quick PR !

Since this is a more structural PR than a simple feature, and as I did with the semantic logger PR, I would want to do an extra check using the test app, can you create a branch (and a PR from it) in the test app repo that configures logstruct and makes sure all log lines are displayed in the tui?

Here's some instructions => open in new tab, the internal navigation in github is broken for comments I just realized

https://github.com/silva96/log_bench/pull/66#issuecomment-3678737178

@ndbroadbent
Copy link
Author

I got some stuff working:

image

I also discovered quite a few issues in logstruct that I was able to fix, so this was a really helpful exercise. And I'll probably be using log bench quite a lot, this is really cool! will open a PR for the test app

@silva96
Copy link
Owner

silva96 commented Jan 26, 2026

Just make sure the final output looks like this

image

@ndbroadbent
Copy link
Author

Hmm how are you linking the actual job executions to a request ID? I think that is a bit out of scope for LogStruct (ensuring a request ID is passed with each job invocation and tying all the logs together), so I'm wondering how you've done that for log_bench?

@silva96
Copy link
Owner

silva96 commented Jan 28, 2026

@ndbroadbent certainly is not the job of LogStruct or Lograge, it's LogBench ... But since you are adding logstruct as an alternative, you need to make sure you can configure logbench to keep the same functionality it does with Lograge.

Check https://github.com/silva96/log_bench/blob/main/lib/log_bench/railtie.rb and https://github.com/silva96/log_bench/blob/main/lib/log_bench/json_formatter.rb

@ndbroadbent
Copy link
Author

OH awesome, that makes a lot of sense! I didn't fully understand what LogBench was doing before. Got it. I'll try to find some time to update the PR to show actual job executions as well

Add support for LogStruct job execution events:
- JobStartEntry for evt:start with src:job
- JobFinishEntry for evt:finish with src:job

These entries are linked to requests via the job_id → request_id mapping,
allowing the full job lifecycle (enqueue → start → finish) to be tracked
and grouped with the originating HTTP request.

Also adds evt:enqueue detection for immediate job enqueues (in addition
to existing evt:schedule for delayed jobs).
@silva96
Copy link
Owner

silva96 commented Feb 3, 2026

@ndbroadbent I will have a look tomorrow, sorry for the delay.

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.

3 participants