-
Notifications
You must be signed in to change notification settings - Fork 0
add play, sniff and --filter to consume&listen
#37
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
Changes from all commits
27ca560
4b1c8b5
f0f8901
7470ef5
2f14433
1394513
01299d8
6a90c6e
b34c9c4
18d81cf
54579a4
11356a1
143a673
be13607
9d5566d
25e60b5
62f5810
000df6d
a72ad7d
7f31937
a0f8c2d
e910159
c083469
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,64 @@ | ||
|  | ||
|
|
||
| Serialise/deserialise flatbuffers blobs from kafka. | ||
| This currently deserialises https://github.com/ess-dmsc/python-streaming-data-types, but I am working to make it agnostic. Python bindings for the respective schema will need to be generated. | ||
| ISIS-specific Kafka tools. | ||
| Deserialises [the ESS flatbuffers blobs](https://github.com/ess-dmsc/python-streaming-data-types) from Kafka. | ||
|
|
||
| Also allows replaying data in a topic. | ||
|
|
||
| # Usage | ||
|
|
||
| To run the latest version, install [uv](https://docs.astral.sh/uv/getting-started/installation/) and use `uvx saluki <args>`. | ||
|
|
||
| alternatively you can `pip install saluki` and run it from a `venv`. | ||
|
|
||
| See `saluki --help` for all options. | ||
|
|
||
| ## Listen to a topic for updates | ||
| ## `listen` - Listen to a topic for updates | ||
| `saluki listen mybroker:9092/mytopic` - This will listen for updates for `mytopic` on `mybroker`. | ||
|
|
||
| ## Consume from a topic | ||
| ### Filter to specific schemas | ||
|
|
||
| `saluki listen mybroker:9092/mytopic -f f144 -f f142` - This will listen for updates but ignore messages with schema IDs of `f142` or `f144` | ||
|
|
||
| ## `consume`- Consume from a topic | ||
| `saluki consume mybroker:9092/mytopic -p 1 -o 123456 -m 10` - This will print 9 messages before (and inclusively the offset specified) offset `123456` of `mytopic` on `mybroker`, in partition 1. | ||
|
|
||
| Use the `-g` flag to go the other way, ie. in the above example to consume the 9 messages _after_ offset 123456 | ||
|
|
||
| # Install | ||
| `pip install saluki` | ||
| You can also filter out messages to specific schema(s) with the `-f` flag, like the example above for `listen`. | ||
|
|
||
| ## `sniff` - List all topics and their high, low watermarks and number of messages | ||
| `saluki sniff mybroker:9092` | ||
rerpha marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+30
to
+31
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I intuitively typed
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nah just use grep m8
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but yeh alright i'll do it |
||
|
|
||
| Output looks as follows: | ||
|
|
||
| ``` | ||
| $ saluki sniff mybroker:9092 | ||
| INFO:saluki:Cluster ID: redpanda.0faa4595-7298-407e-9db7-7e2758d1af1f | ||
| INFO:saluki:Brokers: | ||
| INFO:saluki: 192.168.0.111:9092/1 | ||
| INFO:saluki: 192.168.0.112:9092/2 | ||
| INFO:saluki: 192.168.0.113:9092/0 | ||
| INFO:saluki:Topics: | ||
| INFO:saluki: MERLIN_events: | ||
| INFO:saluki: 0 - low:262322729, high:302663378, num_messages:40340649 | ||
| INFO:saluki: MERLIN_runInfo: | ||
| INFO:saluki: 0 - low:335, high:2516, num_messages:2181 | ||
| INFO:saluki: MERLIN_monitorHistograms: | ||
| INFO:saluki: 0 - low:7515, high:7551, num_messages:36 | ||
| ``` | ||
|
|
||
| ## `play` - Replay data from one topic to another | ||
|
|
||
| ### Between offsets | ||
|
|
||
| `saluki play mybroker:9092/source_topic mybroker:9092/dest_topic -o 123 125` - This will forward messages at offset 123, 124 and 125 in the `source_topic` to the `dest_topic` | ||
|
|
||
| ### Between timestamps | ||
|
|
||
| `saluki play mybroker:9092/source_topic mybroker:9092/dest_topic -t 1762209990 1762209992` - This will forward messages between the two given timestamps. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I think this should have worked then? |
||
|
|
||
| ## Developer setup | ||
| `pip install .[dev]` | ||
| # Developer setup | ||
| `pip install -e .[dev]` | ||
|
|
||
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.
Maybe this should also support timestamps - offsets are not very user friendly...