Skip to content

Commit e29991b

Browse files
committed
Issue #309: Update README with common filter gotchas
1 parent cf7e10e commit e29991b

File tree

1 file changed

+154
-4
lines changed

1 file changed

+154
-4
lines changed

README.md

Lines changed: 154 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22

33
Kafka publisher for use with Solana's [plugin framework](https://docs.solana.com/developing/plugins/geyser-plugins).
44

5+
## Quick Start
6+
7+
**Want to see data flowing immediately?** Use this minimal config:
8+
9+
```json
10+
{
11+
"libpath": "target/release/libsolana_accountsdb_plugin_kafka.so",
12+
"kafka": {
13+
"bootstrap.servers": "localhost:9092"
14+
},
15+
"filters": [{
16+
"update_account_topic": "solana.testnet.account_updates",
17+
"slot_status_topic": "solana.testnet.slot_status",
18+
"transaction_topic": "solana.testnet.transactions",
19+
"publish_all_accounts": true
20+
}]
21+
}
22+
```
23+
24+
This will publish **all** account updates, transactions, and slot status to Kafka. Perfect for testing and development.
25+
526
## Installation
627

728
### Binary releases
@@ -40,6 +61,10 @@ Config is specified via the plugin's JSON config file.
4061

4162
### Example Config
4263

64+
**⚠️ WARNING: This example config will NOT publish most data by default!**
65+
66+
The following config is a minimal example that demonstrates the structure, but with `publish_all_accounts: false` and no `program_filters`, you'll only see slot status updates. For testing, consider using the scenarios below.
67+
4368
```json
4469
{
4570
"libpath": "target/release/libsolana_accountsdb_plugin_kafka.so",
@@ -66,10 +91,29 @@ Config is specified via the plugin's JSON config file.
6691
}
6792
```
6893

94+
**For Testing/Development (Recommended):**
95+
```json
96+
{
97+
"libpath": "target/release/libsolana_accountsdb_plugin_kafka.so",
98+
"kafka": {
99+
"bootstrap.servers": "localhost:9092"
100+
},
101+
"filters": [{
102+
"update_account_topic": "solana.testnet.account_updates",
103+
"slot_status_topic": "solana.testnet.slot_status",
104+
"transaction_topic": "solana.testnet.transactions",
105+
"publish_all_accounts": true
106+
}]
107+
}
108+
```
109+
69110
### Reference
70111

71112
- `libpath`: Path to Kafka plugin
72-
- `kafka`: [`librdkafka` config options](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md).
113+
- `kafka`: [`librdkafka` config options](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). Common options include:
114+
- `statistics.interval.ms`: Enables Prometheus metrics collection (set to 1000ms or higher)
115+
- `queue.buffering.max.messages`: Controls producer buffer size
116+
- `queue.buffering.max.kbytes`: Controls producer buffer size in KB
73117
- `shutdown_timeout_ms`: Time the plugin is given to flush out all messages to Kafka upon exit request.
74118
- `prometheus`: Optional port to provide metrics in Prometheus format.
75119
- `filters`: Vec of filters with next fields:
@@ -94,9 +138,57 @@ The message types are keyed as follows:
94138

95139
### Filtering
96140

97-
If `program_ignores` are specified, then these addresses will be filtered out of the account updates
98-
and transaction notifications. More specifically, account update messages for these accounts will not be emitted,
99-
and transaction notifications for any transaction involving these accounts will not be emitted.
141+
**⚠️ IMPORTANT: Understanding how filtering works is crucial for getting data flowing to Kafka!**
142+
143+
The plugin uses a **whitelist approach** for filtering. By default, most events are filtered out unless you explicitly configure what you want to see.
144+
145+
#### How Filtering Works
146+
147+
1. **Account Updates**: Only published if the account's owner program is in `program_filters` OR the account address is in `account_filters`
148+
2. **Transactions**: Only published if they involve accounts from programs in `program_filters` OR specific accounts in `account_filters`
149+
3. **Slot Status**: Always published (not affected by filters)
150+
4. **Program Ignores**: Blacklist of programs/accounts to exclude (applied after whitelist filtering)
151+
152+
#### Common Filtering Scenarios
153+
154+
**Scenario 1: See Everything (Recommended for testing)**
155+
```json
156+
{
157+
"publish_all_accounts": true,
158+
"program_filters": [],
159+
"account_filters": []
160+
}
161+
```
162+
163+
**Scenario 2: See Specific Programs Only**
164+
```json
165+
{
166+
"publish_all_accounts": false,
167+
"program_filters": [
168+
"11111111111111111111111111111111", // System Program
169+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" // Token Program
170+
]
171+
}
172+
```
173+
174+
**Scenario 3: See Specific Accounts Only**
175+
```json
176+
{
177+
"publish_all_accounts": false,
178+
"account_filters": [
179+
"YourAccountAddressHere111111111111111111111111"
180+
]
181+
}
182+
```
183+
184+
#### Troubleshooting: No Data in Kafka?
185+
186+
If you're not seeing messages in Kafka despite successful slot processing:
187+
188+
1. **Check your filters**: Make sure you have either `publish_all_accounts: true` or specific `program_filters`/`account_filters`
189+
2. **Verify topics**: Ensure your topic names are correct and Kafka is running
190+
3. **Check program ignores**: Make sure you're not accidentally filtering out everything with overly restrictive `program_ignores`
191+
4. **Test with minimal config**: Start with `publish_all_accounts: true` to verify the plugin is working
100192

101193
### Message Wrapping
102194

@@ -208,3 +300,61 @@ Analytics enhancements enable new use cases:
208300
- **Network Analytics**: Analyze slot confirmation patterns
209301
- **Address Intelligence**: Monitor address lookup table usage
210302
- **Cost Optimization**: Analyze transaction pricing and efficiency
303+
304+
## Troubleshooting
305+
306+
### Common Issues
307+
308+
#### 1. No Data in Kafka Topics
309+
310+
**Symptoms**: Solana validator shows slot processing but no messages appear in Kafka topics.
311+
312+
**Causes & Solutions**:
313+
- **Filtering too restrictive**: Set `publish_all_accounts: true` or add specific `program_filters`
314+
- **Wrong topic names**: Verify your topic names match exactly
315+
- **Kafka connection issues**: Check if Kafka is running and accessible
316+
- **Plugin not loaded**: Verify the plugin path in `libpath` is correct
317+
318+
**Quick Test**: Use the Quick Start config above to verify the plugin works.
319+
320+
#### 2. Only Slot Status Messages Appear
321+
322+
**Cause**: This is expected behavior with the default example config! Slot status is always published, but account updates and transactions require explicit filter configuration.
323+
324+
**Solution**: Add `publish_all_accounts: true` or configure `program_filters`.
325+
326+
#### 3. Plugin Fails to Load
327+
328+
**Common Causes**:
329+
- **Version mismatch**: Ensure Solana and plugin are built with identical Rust/Solana versions
330+
- **Library path**: Check `libpath` points to the correct `.so` or `.dylib` file
331+
- **Permissions**: Ensure the plugin file is readable by the Solana process
332+
333+
#### 4. High Memory Usage
334+
335+
**Cause**: Large Kafka producer buffers can consume significant memory.
336+
337+
**Solution**: Adjust buffer settings:
338+
```json
339+
{
340+
"kafka": {
341+
"queue.buffering.max.messages": "10000",
342+
"queue.buffering.max.kbytes": "1048576"
343+
}
344+
}
345+
```
346+
347+
### Debugging Tips
348+
349+
1. **Start Simple**: Begin with `publish_all_accounts: true` to verify basic functionality
350+
2. **Check Topics**: Use Kafdrop or `kafka-console-consumer` to verify topics exist
351+
3. **Monitor Metrics**: Enable Prometheus metrics to see message counts and errors
352+
4. **Verify Filters**: Double-check your filter configuration matches your expectations
353+
354+
### Getting Help
355+
356+
If you're still having issues:
357+
1. Check this troubleshooting section
358+
2. Review the filtering documentation above
359+
3. Try the Quick Start configuration
360+
4. Open an issue with your config and error details

0 commit comments

Comments
 (0)