Skip to content

ability to disable http and/or event consumer for user log service - #3285

Merged
butonic merged 7 commits into
mainfrom
feat/userlog_event_handler_on_demand
Nov 9, 2026
Merged

butonic merged 7 commits into
mainfrom
feat/userlog_event_handler_on_demand

Conversation

@maki5

@maki5 maki5 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

for user log service it's possible now to disable/enable from config

  • events listener(consumer)
  • http server

@codacy-production

codacy-production Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 155 complexity

Metric Results
Complexity 155

View in Codacy

🟢 Coverage 40.59% diff coverage · -0.01% coverage variation

Metric Results
Coverage variation ✅ -0.01% coverage variation (-1.00%)
Diff coverage ✅ 40.59% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (14b9622) 93482 26805 28.67%
Head commit (9f6df0c) 93579 (+97) 26827 (+22) 28.67% (-0.01%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3285) 372 151 40.59%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Comment thread services/userlog/pkg/config/config.go Resolved
Comment thread services/userlog/pkg/command/server.go Resolved
Comment thread pkg/shared/errors.go Resolved

@butonic butonic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the pkg/service package now implements both:

  1. service.go contains event processing that stores events in nats + publishes sse events
  2. http.go implements the http handler that reads from nats.

In the activitylog PR I extracted an activitylog service that wraps the nats kv store with the business logic to add and remove events. It is injected into the http service and the events service (but I like your name 'consumer' better).

I know this is more work, but I think we should seperate the implementation aspects. AFAICT the http service then does not need the event stream at all, so we only need to initiate it for the consumer (hm, it also publishes sse events, so maybe events is a better name in this case).

@maki5

maki5 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

the pkg/service package now implements both:

  1. service.go contains event processing that stores events in nats + publishes sse events
  2. http.go implements the http handler that reads from nats.

In the activitylog PR I extracted an activitylog service that wraps the nats kv store with the business logic to add and remove events. It is injected into the http service and the events service (but I like your name 'consumer' better).

I know this is more work, but I think we should seperate the implementation aspects. AFAICT the http service then does not need the event stream at all, so we only need to initiate it for the consumer (hm, it also publishes sse events, so maybe events is a better name in this case).

I refactored the code to follow the format from activitylog PR

@maki5
maki5 requested a review from butonic August 24, 2026 11:34
@butonic

butonic commented Sep 7, 2026

Copy link
Copy Markdown
Member

@maki5 can you rebase?

@maki5
maki5 force-pushed the feat/userlog_event_handler_on_demand branch from 69dbad6 to b964da7 Compare September 7, 2026 14:58
@maki5

maki5 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@maki5 can you rebase?

@butonic sure, rebased

@maki5
maki5 force-pushed the feat/userlog_event_handler_on_demand branch from b964da7 to a8ae053 Compare September 17, 2026 12:21
  * rename additional calls to AllComponentsDisabledError to
    AllApiHandlersDisabledError after refactoring in
    66ec376, found in
    services/eventhistory and services/graph
Comment thread services/userlog/pkg/command/server.go Resolved
Comment thread services/userlog/pkg/config/config.go Resolved
Comment thread services/userlog/pkg/config/config.go Resolved
…nal/eventstest

 * instead of defining our own testBus struct in services/userlog, use
   the one that was recently put into internal/eventstest with
   e8cf677 for exactly such purposes, just to reduce code
   duplication
@pbleser-oc
pbleser-oc force-pushed the feat/userlog_event_handler_on_demand branch from ee3b7b2 to 7f0e453 Compare September 18, 2026 07:49
Keep main's shared.AllComponentsDisabledError name and use it in
userlog and eventhistory as well.

Assisted-by: Claude Opus 5.5
@butonic
butonic merged commit a7970e7 into main Nov 9, 2026
61 checks passed
@butonic
butonic deleted the feat/userlog_event_handler_on_demand branch November 9, 2026 15:44
@openclouders openclouders mentioned this pull request Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants