...
Since build 5.2.1896 it is possible to collect a certain stream metrics data
Field | Type | Description |
---|
timestamp | UInt64 | Time stamp |
ip | IPv4 | Server address |
mediaSessionId | String | Media session Id |
streamName | String | Stream name |
videoProfileId | UInt32 | Video profile Id |
videoWidth | UInt32 | Pictiure height |
videoHeight | UInt32 | Picture width |
videoFrameRate | UInt32 | Video frame rate per second |
videoKframes | UInt64 | Key frames number (I-frame) |
videoPframes | UInt64 | P-frames number |
videoBframes | UInt64 | B-frames number |
videoRate | UInt64 | Video bitrate, bps |
audioRate | UInt64 | Audio bitrate, bps |
videoSyncTime | UInt64 | Video synchronization value |
audioSyncTime | UInt64 | Audio synchronization value |
videoTimestamp | UInt64 | Video packet timestamp |
audioTimestamp | UInt64 | Audio packet timestamp |
lastKeyFrameSyncTime | UInt64 | Video synchronization value from the last key frame |
sendNACK | UInt64 | NACK sent count |
recvNACK | UInt64 | NACK received count |
videoFramesLost | UInt64 | Lost video frames count |
audioPacketsLost | UInt64 | Lost audio frames count |
audioPlaybackSpeed | Float32 | Audio publishing/playback speed |
videoPlaybackSpeed | Float32 | Video publishing/playback speed |
HLS stream data (table HlsStreamEvents)
Since build 5.2.1917 it is possible to collect a certain HLS stream events data
Field | Type | Description |
---|
timestamp | UInt64 | Time stamp |
ip | IPv4 | Server address |
severity | UInt8 | Event severity level: INFO, WARNING, ERROR |
messageType | UInt16 | Event type |
streamId | String | HLS stream Id |
variantName | String | Quality variant name |
segmentId | String | HLS segment Id |
message | String | Logged event description |
HLS segments data (table HlsSegmenterEvents)
Since build 5.2.1917 it is possible to collect a certain HLS stream segments data
Field | Type | Description |
---|
timestamp | UInt64 | Time stamp |
ip | IPv4 | Server address |
streamId | String | HLS stream Id |
variantName | String | Quality variant name |
segmentId | String | Segment Id |
segmentStartPts | UInt64 | Segment start PTS |
videoStartPts | UInt64 | Video start PTS |
audioStartPts | UInt64 | Audio start PTS |
videoWidth | UInt32 | Picture width |
videoHeight | UInt32 | Picture height |
videoFrameCount | UInt32 | Video frames count |
audioPacketCount | UInt32 | Audio packets count |
segmentDuration | UInt64 | Segment duration, ms |
independent | Bool | Independent segment |
gap | Bool | GAP segment |
discontinuity | Bool | DISCONTINUTY segment |
segmentInterval | UInt64 | Segments interval, ms |
partial | Bool | Partial segment |
playbackSpeed | Float32 | Playback speed |
HLS subscribers data (table HlsClientEvents)
Since build 5.2.1929 it is possible to collect a certain HLS stream subscribers data
Field | Type | Description |
---|
creationTime | UInt64 | Subscriber creation time (a first request) |
responseTime | UInt64 | Subscriber response time |
streamId | String | HLS stream Id |
variantName | String | Quality variant name |
uri | String | Playlist URI |
localIp | IPv4 | Server address |
remoteIp | IPv4 | Client address |
remotePort | UInt32 | Client port |
userAgent | String | User-Agent data |
httpStatus | UInt32 | Response status |
clientId | UInt64 | Client session Id |
Mixer metrics data (table MixerEvent)
Since build 5.2.1923 it is possible to collect a certain mixer metrics data
Field | Type | Description |
---|
timestamp | UInt64 | Time stamp |
mixerMediaSessionId | String | Mixer media session Id |
mixerStreamName | String | Mixer output stream name |
mediaSessionId | String | Incoming stream media session Id |
streamName | String | Incoming stream name |
mixerAverageTickTimeInMs | Int64 | Mixer tick average duration, ms |
audioMixerSync | Int64 | Mixer output stream audio synchronization value |
videoMixerSync | Int64 | Mixer output stream audio synchronization value |
nextAudioDataTime | Int64 | Next audio packet time |
nextVideoDataTime | Int64 | Next video packet time |
audioBuffered | Int64 | Incoming stream audio packets buffered count |
videoBuffered | Int64 | Incoming stream video packets buffered count |
audioDropsCounter | Int64 | Incoming stream audio packets dropped count |
audioDropsSizeInBytes | Int64 | Incoming stream audio dropped data in bytes |
videoDropsCounter | Int64 | Incoming stream video packets dropped count |
videoDropsSizeInBytes | Int64 | Incoming stream video dropped data in bytes |
videoFps | Int64 | Mixer output stream framerate per second |
audioRate | DOUBLE | Mixer output stream audio bitrate, bps |
videoRate | DOUBLE | Mixer output stream audio bitrate, bps |
eventType | UInt32 | Mixer event type |
eventPayload | String | Event description |
Incoming audio recovery data (table AudioRecoveryEvent)
Since build 5.2.1969 it is possible to collect a certain stream audio recovery data
Field | Type | Description |
---|
timestamp | UInt64 | Time stamp |
mediaSessionId | String | Media session Id |
type | UInt32 | Event type |
rtpTimestamp | UInt64 | RTP stream timestamp |
RTMP incoming streams buffer metrics data (table RtmpInBufferEvent)
Since build 5.2.1978 it is possible to collect a certain incoming RTMP stream buffer metrics data
Field | Type | Description |
---|
timestamp | UInt64 | Time stamp |
streamClockTime | UInt64 | Stream clock time |
mediaSessionId | String | Media session Id |
streamName | String | Stream name |
nextAudioDataTime | Int64 | Next audio data packet time |
nextVideoDataTime | Int64 | Next video data packet time |
audioBuffered | Int64 | Audio packets buffered count |
videoBuffered | Int64 | Video packets buffered count |
maximumAllowedBuffer | Int64 | Maximum packet allowed in the buffer |
bufferingCounter | Int64 | Bufferings counter |
lastAudioDataTime | Int64 | Last audio data packet time |
lastVideoDataTime | Int64 | Last video data packet time |
bufferState | UInt32 | Buffer state |
Configuration
ClickHouse installation and setup
...
CONNECTION, STREAM, CDN, MEDIA_SESSION, HLS_SEGMENTER, HLS_STREAM, HLS_CLIENT, MIXER, AUDIO_RECOVERY, RTMP_IN_BUFFER
Type | Description |
---|
CONNECTION | Client session events |
STREAM | Stream events |
CDN | CDN events |
MEDIA_SESSION | Stream metrics |
HLS_SEGMENTER | HLS stream segment metrics |
HLS_STREAM | HLS stream events |
HLS_CLIENT | HLS clients statistics |
MIXER | Mixer events and metrics |
AUDIO_RECOVERY | Audio packets recovery events |
RTMP_IN_BUFFER | RTMP incoming streams buffer metrics |
ClickHouse server, database address and protocol are set by the following parameters
...
Code Block |
---|
|
reload node-settings |
Data collection management using REST API
The data of CONNECTION, STREAM, CDN, HLS_STREAM types are always collected, for all the client sessions and all the streams. All the other types are collected on demand only because a data amount may be too big.
The data collection for a certain stream is enabled by REST API.
A REST-query should be HTTP/HTTPS POST request as follows:
- HTTP: http://streaming.flashphoner.com:8081/rest-api/rels/startup
- HTTPS: https://streaming.flashphoner.com:8444/rest-api/rels/startup
Здесь:
- streaming.flashphoner.com - WCS server address
- 8081 - the standard REST / HTTP port of the WCS server
- 8444 - the standard HTTPS port
- rest-api - the required part of the URL
- /rels/startup - REST-method to use
REST methods and responses
/rels/startup
Start data collectio of a certain type for the certain streams
Request example
Code Block |
---|
|
POST /rest-api/rels/startup HTTP/1.1
Host: localhost:8081
Content-Type: application/json
{
"mediaSession": {
"frequency":100,
"ids": [
"d7d6b6e4-b137-461a-8a32-d6abf2b8666e",
"39cbf770-128a-11ef-b839-d1a1f53f8bd2"
]
}
} |
Response example
Code Block |
---|
|
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json |
Return codes
Code | Reason |
---|
200 | OK |
400 | Bad request |
404 | Not found |
500 | Internal server error |
/rels/find_all
Get the sent data statistics
Request example
Code Block |
---|
|
POST /rest-api/rels/find_all HTTP/1.1
Host: localhost:8081
Content-Type: application/json |
Response example
Code Block |
---|
|
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
[
{
"type": "CONNECTION",
"sentBytes": 1989,
"bitrateKbps": 0,
"sentEvents": 6,
"queueEvents": 0
},
{
"type": "STREAM",
"sentBytes": 70766,
"bitrateKbps": 0,
"sentEvents": 73,
"queueEvents": 1
},
{
"type": "CDN",
"sentBytes": 0,
"bitrateKbps": 0,
"sentEvents": 0,
"queueEvents": 0
},
{
"type": "MEDIA_SESSION",
"ids": [
"d7d6b6e4-b137-461a-8a32-d6abf2b8666e",
"39cbf770-128a-11ef-b839-d1a1f53f8bd2"
],
"sentBytes": 205794,
"bitrateKbps": 143,
"sentEvents": 999,
"queueEvents": 119
}
] |
Return codes
Code | Reason |
---|
200 | OK |
404 | Not found |
500 | Internal server error |
/rels/terminate
Stop data collection of the certain type for the certain streams
Request example
Code Block |
---|
|
POST /rest-api/rels/terminate HTTP/1.1
Host: localhost:8081
Content-Type: application/json
{
"mediaSession": {
"ids": [
"d7d6b6e4-b137-461a-8a32-d6abf2b8666e"
]
}
} |
Response example
Code Block |
---|
|
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json |
Return codes
Code | Reason |
---|
200 | OK |
400 | Bad request |
404 | Not found |
500 | Internal server error |
/rels/terminate_all
Stop the certain types data collection for all the streams
Request example
Code Block |
---|
|
POST /rest-api/rels/terminate_all HTTP/1.1
Host: localhost:8081
Content-Type: application/json
{
"types": [
"MEDIA_SESSION"
]
} |
Response example
Code Block |
---|
|
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
{
"MEDIA_SESSION": [
"39cbf770-128a-11ef-b839-d1a1f53f8bd2"
]
} |
Return codes
Code | Reason |
---|
200 | OK |
400 | Bad request |
404 | Not found |
500 | Internal server error |
Parameters
Parameter | Description | Example |
---|
mediaSession | MEDIA_SESSION data collection descriptor object | "mediaSession": {"frequency":100, "ids":["12345678-0000-1111"]} |
frequency | data collection frequency in ms | 100 |
ids | Medissesson identifiers list for the streams which data should be collected | ["12345678-0000-1111","12345678-3333-4444"] |
hlsSegmenter | HLS_SEGMENTER data collection descriptor object | "hlsSegmenter": {"ids":["stream1"]} |
hlsClient | HLS_CLIENT data collection descriptor object | "hlsClient": {"ids":["stream1"]} |
mixer | MIXER data collection descriptor object | "mixer": {"ids":["12345678-5555-6666"] } |
audioRecovery | AUDIO_RECOVERY data collection descriptor object | "audioRecovery": {"ids":["12345678-7777-8888"] } |
rtmpInBuffer | RTMP_IN_BUFFER data collection descriptor object | "rtmpInBuffer": {"ids":["12345678-9999-AAAA"] } |
Data retrieving from DB
Logging data can be retrieved usin SQL queries in CliskHouse client
...