-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Karafka integration #4147
base: master
Are you sure you want to change the base?
Add Karafka integration #4147
Conversation
595ea74
to
dd02868
Compare
Created a Jira card for Docs Team editorial review. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4147 +/- ##
==========================================
- Coverage 97.78% 97.75% -0.03%
==========================================
Files 1353 1358 +5
Lines 81817 81920 +103
Branches 4145 4150 +5
==========================================
+ Hits 80001 80081 +80
- Misses 1816 1839 +23 ☔ View full report in Codecov by Sentry. |
FYI feel free to ping me once remarks are done. I will be happy to help and maybe in the future retire my own instrumentation in favour of the DD one ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of very small suggestions from Docs and approved the PR.
Use Tracing.trace wrapper to add consumer trace Use Instrumentation::Monitor to instrument and have a proper trace wrapper
Sorry, the pull request is currently blocked and I am working on
|
👋 @marco I have prepared a branch Basically, rebase Currently, the unit tests are failing because of the minimum version defined subject to test. Static analysis is failing with I did cherrypicked the changes containing autogenerated gemfiles and lockfiles. You might do the same in order to change your dependencies for testing. |
Hi - is there an ETA when this feature could be released? this is something we are really waiting for :-) |
* master: (209 commits) Fix method override warning in profiler (DataDog#4549) Fix warnings in DI and tracing generated with -w (DataDog#4547) Add telemetry to tracking middleware patcher Improve devise instrumentation Add signature for devise tracking middleware Fix gateway push of identity.set_user Add prefix in ID extraction for Hash-like objects Push AppSec identity event into gateway Add debug logging into patches and middleware Switch into update system-tests Change login success/failure by set usr.login Add multi-user support in signin/signup tracking Add libddwaf into user tracking Adjust AppSec::Anonymizer interface Refactor Devise patches and middleware Add Devise::DataExtractor to extract id and login Update auto_user_instrumentation configuration Set AppSec collection mode tag in identity kit Add tests for SDK and automated instrumentation Add authenticated user tracking implementation ...
def patch | ||
require_relative 'monitor' | ||
|
||
::Karafka::App.config.monitor = Monitor.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be replacing another monitor added by the application?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/karafka/karafka/wiki/Monitoring-and-logging appears to suggest a different pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p-datadog not really: https://karafka.io/docs/Monitoring-and-Logging/#monitor-wrapping-and-replacement
both are supported and in this case there has to be a custom monitor to handle the tracing as far as I understand (karafka author here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mensfeld Thank you for the response. Can you clarify what happens when the monitor is replaced - is the original monitor going to continue receiving events?
I made a small change that patches the Karafka Monitor to invoke dd-trace-rb instrumentation which should work with any installed monitor. What is your opininion of this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p-datadog when monitor is replaced it is replaced. You can use a monitor that wraps a different one and document it. 98-99% of people stick with the default one so it is in my opinion an edge case.
karafka 2.0.41 (min version we are testing) uses Concurrent::Array without declaring a dependency on or requiring concurrent-ruby, which karafka-core 2.3.0 (that is being used currently by CI) does also not use in any way. I think the solution here is to pin to and older karafka-core version for karafka 2.0.41. |
2.0.41 is totally EOL and making any decisions based on it does not make any sense: https://karafka.io/docs/Versions-Lifecycle-and-EOL/#karafka-components-support this dependency reference was fixed later on. Concurrent ruby was completely removed in 2.3. |
What minimum karafka version would you suggest we support? 2.3? |
Yes. 2.3 is already EOL but it has all the dependency issues solved and a stable API. |
What does this PR do?
Fixed #1660
In this PR, we introduce the Kafka integration for the Karafka gem. Which includes:
Motivation:
We’re integrating Karafka to implement proper distributed tracing in our system with Datadog, as it lacks an official integration. This integration will also enable distributed tracing if the message headers include distributed tracing data.
Distributed tracing will help us create a proper service map, connecting Kafka producers and consumers.
Change log entry
Yes. Add Karafka integration for distributed tracing.
(Added by @ivoanjo)
Additional Notes:
How to test the change?