ChainGraph API Documentation / @badaitech/chaingraph-channel / types / DetailedChannelStats
Interface: DetailedChannelStats
Defined in: types/ChannelStats.d.ts:110
Extended statistics with subscriber details.
Extends
Properties
avgProcessingRate?
optionalavgProcessingRate:number
Defined in: types/ChannelStats.d.ts:122
Average processing rate (items per second).
bufferSize
bufferSize:
number
Defined in: types/ChannelStats.d.ts:32
Number of items currently in the buffer.
For InMemoryChannel: In-memory buffer size For DBOSChannel: Number of unread items in database (estimate)
Example
const stats = channel.getStats()
if (stats.bufferSize > 1000) {
await channel.send(value) // Wait
} else {
channel.send(value) // Continue
}Inherited from
currentPosition
currentPosition:
number
Defined in: types/ChannelStats.d.ts:54
Current sequence position (next value will be at this position).
Useful for:
- Tracking total values sent
- Offset management
- Resuming from specific position
Inherited from
extra?
optionalextra:Record<string,unknown>
Defined in: types/ChannelStats.d.ts:76
Implementation-specific additional statistics.
Examples:
- InMemoryChannel: { subscriberPositions: [0, 5, 10], slowestPosition: 0 }
- DBOSChannel: { workflowId: '...', remoteOffset: 1000, lastSync: timestamp }
- TRPCChannel: { connectionState: 'connected', latency: 50 }
Inherited from
implementation
implementation:
string
Defined in: types/ChannelStats.d.ts:67
Channel implementation type.
Useful for:
- Runtime type checking
- Metrics tagging
- Debugging
Inherited from
isClosed
isClosed:
boolean
Defined in: types/ChannelStats.d.ts:58
Whether the channel is closed.
Inherited from
memoryUsageEstimate?
optionalmemoryUsageEstimate:number
Defined in: types/ChannelStats.d.ts:126
Memory usage estimate (bytes).
slowestSubscriber?
optionalslowestSubscriber:SubscriberStats
Defined in: types/ChannelStats.d.ts:118
Slowest subscriber (furthest behind).
subscriberCount
subscriberCount:
number
Defined in: types/ChannelStats.d.ts:45
Number of active subscribers currently consuming from the channel.
For InMemoryChannel: Local subscribers only For DBOSChannel: Subscribers on this server only (not global)
Example
const stats = channel.getStats()
console.log(`${stats.subscriberCount} active consumers`)Inherited from
subscribers
subscribers:
SubscriberStats[]
Defined in: types/ChannelStats.d.ts:114
Per-subscriber statistics.