nodejs getStats() api

164 views
Skip to first unread message

gaurav mishra

unread,
Sep 17, 2015, 7:39:53 AM9/17/15
to kur...@googlegroups.com
Hi,
I am trying to write equivalent of following in node. 

specifically crunchWebRtcEndpoint() method.

but when i do webRtcEndpoint.getStats() i dont get a dictionary as mentioned in java code.  all i get is a two key dictionary with "_id" and "subscribers" . how to get the RTCInboundRTPStreamStats and RTCOutboundRTPStreamStats from webrtc endpoint using node.

Thanks.


Ivan Gracia

unread,
Sep 18, 2015, 7:22:37 AM9/18/15
to Kurento Public
Hi,

Could you check in the KMS logs what the response is to that call? This is in order to know if it's arriving there, and what you should be seeing in your client. Perhaps there's something wrong in the JS API.

Also, have you checked using the original code?

Cheers,

Ivan Gracia



--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gaurav mishra

unread,
Sep 21, 2015, 8:03:16 AM9/21/15
to kur...@googlegroups.com

My nodejs code is very simple it looks like this - 

var pStats = presenter.webRtcEndpoint.getStats();

console.log(JSON.stringify(pStats));

which prints -       {"_id":376,"_subscribers":[]} .


 i can see some stats in KMS logs along with one error message . following log is generated everytime i hit getStats --- 

2015-09-21 11:59:08,836001 00000x35da [0x00007f0c895d0700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:482 processMessage()  Message: >{"id":42,"jsonrpc":"2.0","method":"describe","params":{"object":424,"sessionId":"72502d57-1430-4bc4-852a-85783e6c483f"}}

<

2015-09-21 11:59:08,836331 00000x35da [0x00007f0c895d0700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:484 processMessage()  Response: >{"error":{"code":40101,"data":{"type":"MEDIA_OBJECT_NOT_FOUND"},"message":"Object '424' not found"},"id":42,"jsonrpc":"2.0"}

<

2015-09-21 11:59:08,836749 00000x35da [0x00007f0c8add3700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:482 processMessage()  Message: >{"id":43,"jsonrpc":"2.0","method":"invoke","params":{"object":"6434cc40-e02d-40a1-b6db-959b4556c8c9_kurento.MediaPipeline/98eb45cb-21e4-40ba-b186-2fa4ea306520_kurento.WebRtcEndpoint","operation":"getStats","operationParams":{},"sessionId":"72502d57-1430-4bc4-852a-85783e6c483f"}}

<

2015-09-21 11:59:08,837505 00000x35da [0x00007f0c8add3700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:484 processMessage()  Response: >{"id":43,"jsonrpc":"2.0","result":{"sessionId":"72502d57-1430-4bc4-852a-85783e6c483f","value":{"2eede59c-ed0d-4b22-a782-c2f8669efafa":{"__module__":"kurento","__type__":"RTCInboundRTPStreamStats","associateStatsId":"","bytesReceived":459142,"codecId":"","firCount":2,"fractionLost":7,"id":"2eede59c-ed0d-4b22-a782-c2f8669efafa","isRemote":false,"jitter":0.0012499999720603228,"mediaTrackId":"","nackCount":0,"packetsLost":14,"packetsReceived":6116,"pliCount":0,"remb":0,"sliCount":0,"ssrc":"1421753785","timestamp":1442836748,"transportId":"","type":"inboundrtp"},"39e3de95-aa41-4d22-9057-7ae6e643921b":{"__module__":"kurento","__type__":"RTCOutboundRTPStreamStats","associateStatsId":"","bytesSent":0,"codecId":"","firCount":0,"fractionLost":0,"id":"39e3de95-aa41-4d22-9057-7ae6e643921b","isRemote":false,"mediaTrackId":"","nackCount":0,"packetsLost":0,"packetsSent":0,"pliCount":0,"remb":0,"roundTripTime":0,"sliCount":0,"ssrc":"4189893692","targetBitrate":0,"timestamp":1442836748,"transportId":"","type":"outboundrtp"},"46353d85-5d88-42c6-af19-e7693d19df7e":{"__module__":"kurento","__type__":"RTCOutboundRTPStreamStats","associateStatsId":"","bytesSent":0,"codecId":"","firCount":0,"fractionLost":0,"id":"46353d85-5d88-42c6-af19-e7693d19df7e","isRemote":false,"mediaTrackId":"","nackCount":0,"packetsLost":0,"packetsSent":0,"pliCount":0,"remb":0,"roundTripTime":0,"sliCount":0,"ssrc":"3856857332","targetBitrate":0,"timestamp":1442836748,"transportId":"","type":"outboundrtp"},"49c1f589-89a2-4746-b71c-b6362955fd43":{"__module__":"kurento","__type__":"RTCInboundRTPStreamStats","associateStatsId":"","bytesReceived":7187552,"codecId":"","firCount":5,"fractionLost":0,"id":"49c1f589-89a2-4746-b71c-b6362955fd43","isRemote":false,"jitter":0.0081666670739650726,"mediaTrackId":"","nackCount":50,"packetsLost":0,"packetsReceived":7045,"pliCount":0,"remb":500000,"sliCount":0,"ssrc":"4133229785","timestamp":1442836748,"transportId":"","type":"inboundrtp"}}}}

<

2015-09-21 11:59:08,837869 00000x35da [0x00007f0c8add3700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:482 processMessage()  Message: >{"id":44,"jsonrpc":"2.0","method":"invoke","params":{"object":"6434cc40-e02d-40a1-b6db-959b4556c8c9_kurento.MediaPipeline/98eb45cb-21e4-40ba-b186-2fa4ea306520_kurento.WebRtcEndpoint","operation":"getStats","operationParams":{},"sessionId":"72502d57-1430-4bc4-852a-85783e6c483f"}}

<

2015-09-21 11:59:08,838616 00000x35da [0x00007f0c8add3700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:484 processMessage()  Response: >{"id":44,"jsonrpc":"2.0","result":{"sessionId":"72502d57-1430-4bc4-852a-85783e6c483f","value":{"2eede59c-ed0d-4b22-a782-c2f8669efafa":{"__module__":"kurento","__type__":"RTCInboundRTPStreamStats","associateStatsId":"","bytesReceived":459142,"codecId":"","firCount":2,"fractionLost":7,"id":"2eede59c-ed0d-4b22-a782-c2f8669efafa","isRemote":false,"jitter":0.0012499999720603228,"mediaTrackId":"","nackCount":0,"packetsLost":14,"packetsReceived":6116,"pliCount":0,"remb":0,"sliCount":0,"ssrc":"1421753785","timestamp":1442836748,"transportId":"","type":"inboundrtp"},"39e3de95-aa41-4d22-9057-7ae6e643921b":{"__module__":"kurento","__type__":"RTCOutboundRTPStreamStats","associateStatsId":"","bytesSent":0,"codecId":"","firCount":0,"fractionLost":0,"id":"39e3de95-aa41-4d22-9057-7ae6e643921b","isRemote":false,"mediaTrackId":"","nackCount":0,"packetsLost":0,"packetsSent":0,"pliCount":0,"remb":0,"roundTripTime":0,"sliCount":0,"ssrc":"4189893692","targetBitrate":0,"timestamp":1442836748,"transportId":"","type":"outboundrtp"},"46353d85-5d88-42c6-af19-e7693d19df7e":{"__module__":"kurento","__type__":"RTCOutboundRTPStreamStats","associateStatsId":"","bytesSent":0,"codecId":"","firCount":0,"fractionLost":0,"id":"46353d85-5d88-42c6-af19-e7693d19df7e","isRemote":false,"mediaTrackId":"","nackCount":0,"packetsLost":0,"packetsSent":0,"pliCount":0,"remb":0,"roundTripTime":0,"sliCount":0,"ssrc":"3856857332","targetBitrate":0,"timestamp":1442836748,"transportId":"","type":"outboundrtp"},"49c1f589-89a2-4746-b71c-b6362955fd43":{"__module__":"kurento","__type__":"RTCInboundRTPStreamStats","associateStatsId":"","bytesReceived":7187552,"codecId":"","firCount":5,"fractionLost":0,"id":"49c1f589-89a2-4746-b71c-b6362955fd43","isRemote":false,"jitter":0.0081666670739650726,"mediaTrackId":"","nackCount":50,"packetsLost":0,"packetsReceived":7045,"pliCount":0,"remb":500000,"sliCount":0,"ssrc":"4133229785","timestamp":1442836748,"transportId":"","type":"inboundrtp"}}}}





Ivan Gracia

unread,
Sep 21, 2015, 8:33:46 AM9/21/15
to Kurento Public
Ok, so the stats are being generated correctly, but somehow the response doesn't arrive to the client. Could you please check what is your client receiving? 

I see that you have a MEDIA_OBJECT_NOT_FOUND error. Is that something you are causing or is that from the library?

Ivan Gracia


Ivan Gracia

unread,
Sep 21, 2015, 8:37:28 AM9/21/15
to Ivan Gracia, Kurento Public
By what is your client receiving, I meant not in the callback from the function, but in the entrails. Try to find out what is arriving there.

If you could provide a project which we could use to test, this could really help us a lot, as we are using that and it's not failing. It will make it easier to reproduce the error.

Ivan Gracia


gaurav mishra

unread,
Sep 21, 2015, 8:53:48 AM9/21/15
to kur...@googlegroups.com, Ivan Gracia
"I meant not in the callback from the function" thanks to this statement i found my mistake :P.
i was calling the function getStats() in a synchronous way . 
stats = webrtcpoint.getStats() -- wrong

correct way is  to pass callback:
webrtcpoint.getStats(error,callback);  

doing this my callback function recieves the stats data.

Ivan Gracia

unread,
Sep 21, 2015, 10:25:00 AM9/21/15
to gaurav mishra, Kurento Public, Ivan Gracia
Geeee how come nobody spotted that before? 😂 Thanks for the info!

Ivan Gracia


Thabungba Meetei

unread,
Nov 18, 2015, 8:26:25 AM11/18/15
to kurento, gauravmis...@gmail.com, igr...@kurento.org
Hi,


What am I doing wrong here?

endpoint.getStats(function (err, stats) {
            console.log(" ERROR" + err);
            console.log(" STAT" + stats);
            console.log(stats);}
);

Both err and stats are null, what am I missing?

Ivan Gracia

unread,
Nov 18, 2015, 8:28:44 AM11/18/15
to Thabungba Meetei, kurento, gauravmis...@gmail.com, Ivan Gracia
You are probably using the wrong version. There was a bug that got corrected in the development version of the library.

Ivan Gracia


Thabungba Meetei

unread,
Nov 18, 2015, 8:37:11 AM11/18/15
to kurento, thab...@gmail.com, gauravmis...@gmail.com, igr...@kurento.org
Hi Ivan,

Appreciate your quick reply.
I am using the following version.

Module: 'core' version '6.1.2'
Module: 'elements' version '6.1.1'
Module: 'filters' version '6.1.1'

BTW, I am getting this in the KMS-log 

2015-11-18 13:29:00,849379 4753 [0x00007ff687fff700]   debug KurentoWebSocketTransport WebSocketTransport.cpp:484 processMessage()  Message: >{"id":136,"jsonrpc":"2.0","method":"invoke","params":{"object":"e41b891a-1cf3-48ba-878a-ad234f12204e_kurento.MediaPipeline/804887cf-246d-4e8b-91d8-f255e81b84ce_kurento.WebRtcEndpoint","operation":"getStats","operationParams":{},"sessionId":"94639390-e4f9-4038-8e24-ec6cc226b2d2"}}

Ivan Gracia

unread,
Nov 18, 2015, 8:41:19 AM11/18/15
to Thabungba Meetei, kurento, gauravmis...@gmail.com, Ivan Gracia
Check with the development version. getStats broke some time ago, and it's not working there. You can see this post also.

Ivan Gracia


Thabungba Meetei

unread,
Nov 19, 2015, 8:58:40 AM11/19/15
to Ivan Gracia, kurento, gauravmis...@gmail.com
Hi Ivan,

It worked! I have upgraded Kurento & again Thanks a lot!

Thanks and regards,
Thabungba M
Reply all
Reply to author
Forward
0 new messages