Skip to content

Commit 32e8329

Browse files
committed
Add support for additional metadata
1 parent 2bbd80c commit 32e8329

File tree

5 files changed

+297
-3
lines changed

5 files changed

+297
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "solana-accountsdb-plugin-kafka"
33
description = "Solana AccountsDb plugin for Kafka"
44
authors = ["Blockdaemon"]
5-
version = "0.1.8+solana.3.0.0"
5+
version = "0.2.0+solana.3.0.0"
66
edition = "2021"
77
license = "Apache-2.0"
88
repository = "https://github.com/Blockdaemon/solana-accountsdb-plugin-kafka"

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,89 @@ The buffer size can be controlled using `librdkafka` config options, including:
122122

123123
- `queue.buffering.max.messages`: Maximum number of messages allowed on the producer queue.
124124
- `queue.buffering.max.kbytes`: Maximum total message size sum allowed on the producer queue.
125+
126+
## Enhanced Analytics Support
127+
128+
The plugin now provides significantly richer analytics data for blockchain monitoring and analysis, enhancing all supported Solana transaction formats.
129+
130+
### Transaction Types
131+
132+
The plugin supports multiple Solana transaction formats:
133+
134+
- **Legacy Transactions**: Traditional Solana message format
135+
- **V0 Transactions**: Versioned transactions with address lookup tables (LUTs)
136+
137+
All transaction types are enhanced with comprehensive analytics metadata.
138+
139+
### Enhanced Analytics Features
140+
141+
All transactions provide additional analytics data that can be used for:
142+
143+
#### Performance Monitoring
144+
- **Compute Units**: Actual compute units consumed by transactions
145+
- **Pricing Information**: Compute unit pricing from ComputeBudget instructions
146+
- **Cost Analysis**: Transaction fees and compute costs
147+
148+
#### Error Analysis & Debugging
149+
- **Error Detection**: Reliable error status from transaction metadata
150+
- **Success Tracking**: Transaction success/failure status
151+
- **Error Details**: Structured error information without log parsing
152+
153+
#### Address Intelligence
154+
- **Address Lookup Tables**: Support for V0 LUT transactions
155+
- **Loaded Address Details**: Index and writable status for loaded addresses
156+
- **Account Metadata**: Enhanced account information and versioning
157+
158+
#### Slot & Network Analytics
159+
- **Confirmation Status**: Smart confirmation counting based on slot status
160+
- **Status Descriptions**: Human-readable slot status descriptions
161+
- **Progress Tracking**: Slot progression monitoring
162+
163+
### Message Schema Enhancements
164+
165+
The protobuf schema has been enhanced with analytics fields:
166+
167+
#### UpdateAccountEvent
168+
- `data_version`: Account data version for change tracking
169+
- `is_startup`: Whether this is a startup account update
170+
- `account_age`: Approximate account age in slots
171+
172+
#### SlotStatusEvent
173+
- `is_confirmed`: Whether slot is confirmed by supermajority
174+
- `confirmation_count`: Confirmation level (0-2 based on status)
175+
- `status_description`: Human-readable status description
176+
177+
#### TransactionEvent
178+
- `compute_units_consumed`: Actual compute units used
179+
- `compute_units_price`: Compute unit pricing in micro-lamports
180+
- `total_cost`: Total transaction cost (fee + compute)
181+
- `instruction_count`: Number of instructions in transaction
182+
- `account_count`: Number of accounts involved
183+
- `execution_time_ns`: Execution time in nanoseconds
184+
- `is_successful`: Transaction success status
185+
- `execution_logs`: Detailed execution logs
186+
- `error_details`: Detailed error information
187+
- `confirmation_count`: Number of confirmations
188+
189+
#### LoadedAddresses
190+
- `writable_info`: Detailed writable address information
191+
- `readonly_info`: Detailed readonly address information
192+
193+
### Configuration for Analytics Features
194+
195+
Analytics features are enabled by default and require no additional configuration. The plugin automatically:
196+
197+
- Detects transaction format (Legacy or V0)
198+
- Extracts available metadata fields
199+
- Provides enhanced analytics where data is available
200+
- Maintains backwards compatibility with existing consumers
201+
202+
### Use Cases
203+
204+
Analytics enhancements enable new use cases:
205+
206+
- **Performance Monitoring**: Track compute unit usage and costs
207+
- **Error Analysis**: Monitor transaction failures and success rates
208+
- **Network Analytics**: Analyze slot confirmation patterns
209+
- **Address Intelligence**: Monitor address lookup table usage
210+
- **Cost Optimization**: Analyze transaction pricing and efficiency

proto/event.proto

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ message UpdateAccountEvent {
3535

3636
// First signature of the transaction caused this account modification
3737
optional bytes txn_signature = 9;
38+
39+
// Additional analytics fields
40+
uint32 data_version = 10; // Account data version for change tracking
41+
bool is_startup = 11; // Whether this is a startup account update
42+
uint64 account_age = 12; // Account age in slots since creation
3843
}
3944

4045
message SlotStatusEvent {
@@ -43,6 +48,11 @@ message SlotStatusEvent {
4348
uint64 parent = 2;
4449

4550
SlotStatus status = 3;
51+
52+
// Additional analytics fields
53+
bool is_confirmed = 4; // Whether slot is confirmed
54+
uint32 confirmation_count = 5; // Number of confirmations
55+
string status_description = 6; // Human-readable status description
4656
}
4757

4858
enum SlotStatus {
@@ -81,6 +91,15 @@ message CompiledInstruction {
8191
message LoadedAddresses {
8292
repeated bytes writable = 1;
8393
repeated bytes readonly = 2;
94+
repeated LoadedAddressInfo writable_info = 3; // Detailed writable address information
95+
repeated LoadedAddressInfo readonly_info = 4; // Detailed readonly address information
96+
}
97+
98+
// New message for detailed loaded address information
99+
message LoadedAddressInfo {
100+
bytes address = 1; // Account address
101+
uint32 index = 2; // Index in the loaded addresses list
102+
bool is_writable = 3; // Whether account is writable
84103
}
85104

86105
message MessageAddressTableLookup {
@@ -174,6 +193,10 @@ message TransactionStatusMeta {
174193
repeated TransactionTokenBalance pre_token_balances = 8;
175194
repeated TransactionTokenBalance post_token_balances = 9;
176195
repeated Reward rewards = 10;
196+
uint32 compute_units_consumed = 11; // Compute units used by transaction
197+
uint64 compute_units_price = 12; // Compute unit price in micro-lamports
198+
repeated string error_logs = 13; // Detailed error logs for debugging
199+
bool is_successful = 14; // Transaction success status (inverse of is_status_err)
177200
}
178201

179202
// based on solana_accountsdb_plugin_interface::accountsdb_plugin_interface::ReplicaTransactionInfo
@@ -184,6 +207,18 @@ message TransactionEvent {
184207
TransactionStatusMeta transaction_status_meta = 4;
185208
uint64 slot = 5;
186209
uint64 index = 6;
210+
211+
// Enhanced analytics fields
212+
uint32 compute_units_consumed = 7; // Compute units used by transaction
213+
uint64 compute_units_price = 8; // Compute unit price in micro-lamports
214+
uint64 total_cost = 9; // Total transaction cost (fee + compute)
215+
uint32 instruction_count = 10; // Number of instructions in transaction
216+
uint32 account_count = 11; // Number of accounts involved
217+
uint64 execution_time_ns = 12; // Execution time in nanoseconds
218+
bool is_successful = 13; // Transaction success status
219+
repeated string execution_logs = 14; // Detailed execution logs
220+
repeated string error_details = 15; // Detailed error information
221+
uint32 confirmation_count = 16; // Number of confirmations
187222
}
188223

189224
message MessageWrapper {

0 commit comments

Comments
 (0)