millicast / millicast-sdk

SDK for building a realtime broadcaster using the Millicast platform.
Other
37 stars 26 forks source link

Add history to diagnose and historySize parameter #332

Closed keon-jukes closed 2 months ago

keon-jukes commented 3 months ago

References https://jira.dolby.net/jira/browse/DIOS-4647

minLogLevelParam

historySizeUndefined

historySizeErrorHandling

Working

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 9f90e51a75dbf5611d05a739e90001aae71de013

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Santiago-Souto commented 3 months ago

Make sure to come across the reason for the failed test before merging.

vishalkharge commented 3 months ago

@keon-jukes @dubeyShivank

Suggestion for method signature instead of 'Logger.diagnose(1, undefined, 'info')'

Suggested: Logger.diagnose(statsCount, {historySize , minLogLevel})' Logger.diagnose(statsCount = MAX_STATS_HISTORY_SIZE, { historySize = MAX_HISTORY_SIZE, minLogLevel = 'TRACE'})

vishalkharge commented 3 months ago

@keon-jukes, @dubeyShivank

  1. How did we derive the MAX history size of 10 i.e const MAX_HISTORY_SIZE = 10 ?

  2. When I opened the viewer app, I saw below logs in the browser console: [PeerConnection] 2024-04-08T09:55:22.321Z - INFO - Getting RTC peer status [View] 2024-04-08T09:55:22.322Z - INFO - Broadcast status: not_established [Director] 2024-04-08T09:55:22.322Z - INFO - Getting subscriber connection data for stream name: Stream-V and account id: 4RFCzE [PeerConnection] 2024-04-08T09:55:22.969Z - INFO - Creating new RTCPeerConnection [PeerConnection] 2024-04-08T09:55:22.971Z - INFO - Getting RTC Local SDP [PeerConnection] 2024-04-08T09:55:22.973Z - INFO - Creating peer offer [Signaling] 2024-04-08T09:55:22.974Z - INFO - Connecting to Signaling Server [PeerConnection] 2024-04-08T09:55:22.975Z - INFO - Peer offer created [SdpParser] 2024-04-08T09:55:22.975Z - INFO - Replacing SDP response for support stereo [SdpParser] 2024-04-08T09:55:22.975Z - INFO - Replaced SDP response for support stereo [SdpParser] 2024-04-08T09:55:22.976Z - INFO - Setting multiopus [SdpParser] 2024-04-08T09:55:22.976Z - INFO - Multiopus offer created [SdpParser] 2024-04-08T09:55:22.977Z - INFO - Replaced SDP response for setting absolute capture time [Signaling] 2024-04-08T09:55:23.704Z - INFO - WebSocket opened [Signaling] 2024-04-08T09:55:23.704Z - INFO - Connected to server: wss://live-ams-dev.millicast.com/ws/v2/sub/99d025409bfb4db19cf1e824a1bb56b4?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3MTI1NzAxMjMsImV4cCI6MTcxMjU3MDE4MywiaWF0IjoxNzEyNTcwMTIzLCJpc3MiOiJodHRwczovL2RpcmVjdG9yLWRldi5taWxsaWNhc3QuY29tIiwiYXVkIjoiTWlsbGljYXN0RGlyZWN0b3JSZXNvdXJjZSIsIm1pbGxpY2FzdCI6eyJ0eXBlIjoiU3Vic2NyaWJlIiwic3RyZWFtQWNjb3VudElkIjoiNFJGQ3pFIiwic3RyZWFtTmFtZSI6IlN0cmVhbS1WIiwic2VydmVySWQiOiI5OWQwMjU0MDliZmI0ZGIxOWNmMWU4MjRhMWJiNTZiNCIsImN1c3RvbURhdGEiOnsiaXNEaXJlY3RvciI6dHJ1ZSwicmVxdWVzdElkIjoiZDMwOTliYTEtMjMyZi00ZDkxLTkzMjAtZTkzYjAxMDZiMGNiIn19fQ.-AUYGT-po7_mGZq7zDhs68mw6uIjksy0aPhqNCUcnDc [Signaling] 2024-04-08T09:55:23.705Z - INFO - Starting subscription to streamName: Stream-V [Signaling] 2024-04-08T09:55:23.705Z - INFO - Connecting to Signaling Server [Signaling] 2024-04-08T09:55:23.705Z - INFO - Connected to server: wss://live-ams-dev.millicast.com/ws/v2/sub/99d025409bfb4db19cf1e824a1bb56b4?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3MTI1NzAxMjMsImV4cCI6MTcxMjU3MDE4MywiaWF0IjoxNzEyNTcwMTIzLCJpc3MiOiJodHRwczovL2RpcmVjdG9yLWRldi5taWxsaWNhc3QuY29tIiwiYXVkIjoiTWlsbGljYXN0RGlyZWN0b3JSZXNvdXJjZSIsIm1pbGxpY2FzdCI6eyJ0eXBlIjoiU3Vic2NyaWJlIiwic3RyZWFtQWNjb3VudElkIjoiNFJGQ3pFIiwic3RyZWFtTmFtZSI6IlN0cmVhbS1WIiwic2VydmVySWQiOiI5OWQwMjU0MDliZmI0ZGIxOWNmMWU4MjRhMWJiNTZiNCIsImN1c3RvbURhdGEiOnsiaXNEaXJlY3RvciI6dHJ1ZSwicmVxdWVzdElkIjoiZDMwOTliYTEtMjMyZi00ZDkxLTkzMjAtZTkzYjAxMDZiMGNiIn19fQ.-AUYGT-po7_mGZq7zDhs68mw6uIjksy0aPhqNCUcnDc [Signaling] 2024-04-08T09:55:23.707Z - INFO - Sending view command [Signaling] 2024-04-08T09:55:23.862Z - INFO - Command sent, subscriberId: 99d025409bfb4db19cf1e824a1bb56b4 [PeerConnection] 2024-04-08T09:55:23.863Z - INFO - Setting RTC Remote SDP [PeerConnection] 2024-04-08T09:55:23.866Z - INFO - New track from peer. [PeerConnection] 2024-04-08T09:55:23.867Z - INFO - New track from peer. [PeerConnection] 2024-04-08T09:55:23.868Z - INFO - RTC Remote SDP was set successfully. [View] 2024-04-08T09:55:23.868Z - INFO - Connected to streamName: Stream-V [PeerConnectionStats] 2024-04-08T09:55:23.868Z - INFO - Initializing peer connection stats [PeerConnection] 2024-04-08T09:55:23.877Z - INFO - Peer connection state change: connecting [PeerConnection] 2024-04-08T09:55:24.293Z - INFO - Peer connection state change: connected

But in the Logger.diagnose() I can only see the below log events i.e last 10 logs, I think with the last 10 log messages are we able to debug the viewer playback issues ? We should include all the message from where the session was initiated

{ "version": "0.1.44", "timestamp": 1712570133472, "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36", "accountId": "4RFCzE", "streamName": "Stream-V", "subscriberId": "99d025409bfb4db19cf1e824a1bb56b4", "connection": "connected", "history": [ "[PeerConnection] 2024-04-08T09:55:23.866Z - INFO - New track from peer.", "[PeerConnection] 2024-04-08T09:55:23.866Z - DEBUG - Track event value: {\"isTrusted\":true}", "[PeerConnection] 2024-04-08T09:55:23.867Z - INFO - New track from peer.", "[PeerConnection] 2024-04-08T09:55:23.867Z - DEBUG - Track event value: {\"isTrusted\":true}", "[PeerConnection] 2024-04-08T09:55:23.868Z - INFO - RTC Remote SDP was set successfully.", "[PeerConnection] 2024-04-08T09:55:23.868Z - DEBUG - RTC Remote SDP new value: ......", "[View] 2024-04-08T09:55:23.868Z - INFO - Connected to streamName: Stream-V", "[PeerConnectionStats] 2024-04-08T09:55:23.868Z - INFO - Initializing peer connection stats", "[PeerConnection] 2024-04-08T09:55:23.877Z - INFO - Peer connection state change: connecting", "[PeerConnection] 2024-04-08T09:55:24.293Z - INFO - Peer connection state change: connected" ],

Which history logs should be shown in the diagnosis?

vishalkharge commented 3 months ago

@keon-jukes , @dubeyShivank

When the history size is set to -1, 0, or null, 20, it always displays the history with size 10.

dubeyShivank commented 3 months ago

@keon-jukes , @dubeyShivank

When the history size is set to -1, 0, or null, 20, it always displays the history with size 10.

Needs some degree of validation -

it has to be a +ve integer - otherwise throw an exception ("Invalid Argument exception : historySize must be a positive integer")

keon-jukes commented 3 months ago

errorHandling Here is the update with error handling.

Santiago-Souto commented 2 months ago

@keon-jukes for the unit tests to pass you may need to update either adding a default value for historySize or passing in the tests a value for the exception to not be thrown. Also, you may need to add history as an attribute to check those tests.