Skip to content

ability to disable grpc and/or event consumer for event history service - #3279

Open
maki5 wants to merge 6 commits into
mainfrom
feat/eventhistory_event_handler_on_demand
Open

ability to disable grpc and/or event consumer for event history service#3279
maki5 wants to merge 6 commits into
mainfrom
feat/eventhistory_event_handler_on_demand

Conversation

@maki5

@maki5 maki5 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

for event history service now it's possible to enable/disable from config

  • grpc server
  • events consumer

@codacy-production

codacy-production Bot commented Aug 10, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 18 complexity · 7 duplication

Metric Results
Complexity 18
Duplication 7

View in Codacy

🟢 Coverage 1.60% diff coverage · -0.02% coverage variation

Metric Results
Coverage variation -0.02% coverage variation (-1.00%)
Diff coverage 1.60% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (1fa8950) 84104 19334 22.99%
Head commit (1d55c4d) 84151 (+47) 19326 (-8) 22.97% (-0.02%)

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 (#3279) 125 2 1.60%

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.

}

{
if !cfg.Debug.Disabled {

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.

Hm, while we could make the debug endpoint optional, I would leave that out for now. If we want to change how we expose metrics, allow readyniess checks etc. we should track that in a separate issue. It would totally make sense to reduce the number of debug servers we run, especially because we run them in a single binary anyway. However we would need to look into metrics collection and how we can expose the metrics of all services and the readyness / healthyness in a common debug server.

For now, do not make this configurable.

// this need to be discussed, I put it here for now because I belive we need to ensure that the service is doing
// at least something, if we have events and grpc disabled that means that the service is doing actually nothing
// which can be a siletlly ignorred and cause issues in the future
if cfg.Events.Disabled && cfg.GRPC.Disabled {

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.

makes sense!

if err != nil {
return err
}
} else {

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.

This only sets up the nats consumer. Unfortunately, the actual events.ConsumeAll(...) call still lives in the NewEventHistoryService. You will have te extract that into a separate module, like in https://github.com/opencloud-eu/opencloud/pull/3241/changes#diff-654db365a382a61398b04610d91188cc8b6d777398bd1b7a25793977e33231e0 ... although I still need to fix the failing tests it shows the different services that are started by the server command.

Comment on lines +38 to +44
ch, err := events.ConsumeAll(consumer, "evhistory")
if err != nil {
return nil, err
}

eh := &EventHistoryService{ch: ch, store: store, cfg: cfg, log: log}
go eh.StoreEvents()
eh.ch = ch
go eh.StoreEvents()

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.

This consumer will never be started if grpc has been disabled

@maki5
maki5 requested a review from butonic August 14, 2026 10:55
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.

2 participants