-
Notifications
You must be signed in to change notification settings - Fork 718
feat(confluent-kafka): Add instrumentation to consume method #1786
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
edb9ccc
feat(confluent-kafka): Add instrumentation to consume method
javferrod f6e5f98
feat(confluent-kafka): Add instrumentation to consume method
javferrod 9f4b4ee
Changed email
javferrod fbfc055
chore(changelog): Added pull request link
javferrod f042dea
fix(confluent-kafka): Fix wrong partition and offset if
javferrod 7e25294
chore(confluent-kafka): Add test for poll and consume
javferrod 2d11cb4
Merge branch 'main' into issue-1747
javferrod 3a31f6b
chore(confluent-kafka): Removed unused import
javferrod 49b65c5
fix(confluent-kafka): Removed non relevant argument in poll
javferrod b0d3ac1
Merge branch 'main' into issue-1747
javferrod e31e21c
fix(confluent-kafka): Fixed identation
javferrod b7d08dc
Merge branch 'issue-1747' of https://github.com/javferrod/opentelemet…
javferrod 7a86555
fix(confluent-kafka): Removed unused pylint directive
javferrod 4c9cce6
fix(confluent-kafka): Fixed some lint errors
javferrod 2138a8f
Merge branch 'main' into issue-1747
ocelotl ac9ec26
fix(confluent-kafka): Fixed lint errors
javferrod 8a1cf98
Merge branch 'issue-1747' of https://github.com/javferrod/opentelemet…
javferrod 8959aae
Merge branch 'main' into issue-1747
ocelotl 6ce77cf
Merge branch 'main' into issue-1747
ocelotl a552778
fix((confluent-kafka): Removed unused span_list
javferrod 8a76540
Merge branch 'issue-1747' of https://github.com/javferrod/opentelemet…
javferrod 1815057
fix((confluent-kafka): Extracted some shared logic between poll and c…
javferrod 51167dd
fix(confluent-kafka): changed function order
javferrod 296be7f
Merge branch 'main' into issue-1747
javferrod e275ec2
Merge branch 'main' into issue-1747
ocelotl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
39 changes: 39 additions & 0 deletions
39
instrumentation/opentelemetry-instrumentation-confluent-kafka/tests/utils.py
This file contains hidden or 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,39 @@ | ||
from confluent_kafka import Consumer | ||
|
||
|
||
class MockConsumer(Consumer): | ||
|
||
def __init__(self, queue, config): | ||
self._queue = queue | ||
super().__init__(config) | ||
|
||
def consume(self, num_messages=1, *args, **kwargs): | ||
messages = self._queue[:num_messages] | ||
self._queue = self._queue[num_messages:] | ||
return messages | ||
|
||
def poll(self, timeout=None): | ||
if len(self._queue) > 0: | ||
return self._queue.pop(0) | ||
else: | ||
return None | ||
|
||
|
||
class MockedMessage: | ||
def __init__(self, topic: str, partition: int, offset: int, headers): | ||
self._topic = topic | ||
self._partition = partition | ||
self._offset = offset | ||
self._headers = headers | ||
|
||
def topic(self): | ||
return self._topic | ||
|
||
def partition(self): | ||
return self._partition | ||
|
||
def offset(self): | ||
return self._offset | ||
|
||
def headers(self): | ||
return self._headers |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.