forked from getlago/lago-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(events): Stream events to kafka (getlago#1411)
* feat(events): Stream events to kafka * fix pronto
- Loading branch information
Showing
5 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
class KarafkaApp < Karafka::App | ||
setup do |config| | ||
config.kafka = { 'bootstrap.servers': ENV['LAGO_KAFKA_BOOTSTRAP_SERVERS'] } | ||
config.client_id = 'Lago' | ||
# Recreate consumers with each batch. This will allow Rails code reload to work in the | ||
# development mode. Otherwise Karafka process would not be aware of code changes | ||
config.consumer_persistence = !Rails.env.development? | ||
end | ||
|
||
# Comment out this part if you are not using instrumentation and/or you are not | ||
# interested in logging events for certain environments. Since instrumentation | ||
# notifications add extra boilerplate, if you want to achieve max performance, | ||
# listen to only what you really need for given environment. | ||
Karafka.monitor.subscribe(Karafka::Instrumentation::LoggerListener.new) | ||
# Karafka.monitor.subscribe(Karafka::Instrumentation::ProctitleListener.new) | ||
|
||
# This logger prints the producer development info using the Karafka logger. | ||
# It is similar to the consumer logger listener but producer oriented. | ||
Karafka.producer.monitor.subscribe( | ||
WaterDrop::Instrumentation::LoggerListener.new( | ||
# Log producer operations using the Karafka logger | ||
Karafka.logger, | ||
# If you set this to true, logs will contain each message details | ||
# Please note, that this can be extensive | ||
log_messages: false, | ||
), | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters