Skip to content

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?

optional avgProcessingRate: 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

typescript
const stats = channel.getStats()
if (stats.bufferSize > 1000) {
  await channel.send(value)  // Wait
} else {
  channel.send(value)  // Continue
}

Inherited from

ChannelStats.bufferSize


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

ChannelStats.currentPosition


extra?

optional extra: 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

ChannelStats.extra


implementation

implementation: string

Defined in: types/ChannelStats.d.ts:67

Channel implementation type.

Useful for:

  • Runtime type checking
  • Metrics tagging
  • Debugging

Inherited from

ChannelStats.implementation


isClosed

isClosed: boolean

Defined in: types/ChannelStats.d.ts:58

Whether the channel is closed.

Inherited from

ChannelStats.isClosed


memoryUsageEstimate?

optional memoryUsageEstimate: number

Defined in: types/ChannelStats.d.ts:126

Memory usage estimate (bytes).


slowestSubscriber?

optional slowestSubscriber: 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

typescript
const stats = channel.getStats()
console.log(`${stats.subscriberCount} active consumers`)

Inherited from

ChannelStats.subscriberCount


subscribers

subscribers: SubscriberStats[]

Defined in: types/ChannelStats.d.ts:114

Per-subscriber statistics.

Licensed under BUSL-1.1