Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BADGERS-307 feat(debugger): Record changes to metric values over time #324

Merged
merged 133 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
718a492
Linting on ReadyHelper
ShiningTrapez Jan 4, 2024
cf51217
What doesn't this change
ShiningTrapez Jan 9, 2024
703d56b
Remove Terser - Unused
ShiningTrapez Jan 9, 2024
1d22403
it aint much
eirikbjornr Jan 9, 2024
087c374
but it's darn honest work
eirikbjornr Jan 9, 2024
0dd7c8c
wip: add media element types
eirikbjornr Jan 15, 2024
e77b7e6
Combine Message and Metric Types
ShiningTrapez Jan 15, 2024
bed3809
[WIP] Classify Chronicle
ShiningTrapez Jan 15, 2024
956fbd7
Fix Chronicle Unit Tests
ShiningTrapez Jan 15, 2024
a3f1cc6
Fix all tests
ShiningTrapez Jan 15, 2024
990bee8
chore: change chronicle to TypeScript
eirikbjornr Jan 16, 2024
29e251d
wip: type bonanza
eirikbjornr Jan 16, 2024
d9364de
wip: metric interface
eirikbjornr Jan 16, 2024
356f6fa
Type that extracts Metric Value based on key
ShiningTrapez Jan 16, 2024
7d3f90c
Fix Types for Metric Get
ShiningTrapez Jan 16, 2024
b74c751
wip: use new api
eirikbjornr Jan 16, 2024
22dc014
WIP Message Push Functions
ShiningTrapez Jan 17, 2024
5a1aaa9
Remove API Call and Event from Trace
ShiningTrapez Jan 17, 2024
cb7f07d
Export EntryForIdentifier, instead of Message/MetricForKey/Level
ShiningTrapez Jan 17, 2024
1da1693
wip: elmo burn emoji
eirikbjornr Jan 17, 2024
ad73894
getLatestMetric
ShiningTrapez Jan 17, 2024
c590006
refine types
eirikbjornr Jan 17, 2024
5051460
chore: disable prefer-at
eirikbjornr Jan 17, 2024
48bc0ad
feat: chronicle is amazing now
eirikbjornr Jan 17, 2024
156e2b9
DebugPresenter => DebugFormatter
ShiningTrapez Jan 17, 2024
195293b
Minor linting changes
ShiningTrapez Jan 17, 2024
7495333
feat: add event trace
eirikbjornr Jan 18, 2024
a5a27ac
chore: make debugtool TypeScript
eirikbjornr Jan 18, 2024
b58a5eb
chore: make debugformatter TypeScript
eirikbjornr Jan 18, 2024
2683459
wip: im bad at splitting commits
eirikbjornr Jan 18, 2024
03ddd07
feat: statechange trace
eirikbjornr Jan 18, 2024
441d798
feat: use new chronicle
eirikbjornr Jan 18, 2024
4f7559b
fix: all the debugger tests
eirikbjornr Jan 19, 2024
3b48f72
chore: check for unused locals
eirikbjornr Jan 19, 2024
7b64d0d
Remove redundant test
ShiningTrapez Jan 19, 2024
197a72d
refactor: restructure tests
eirikbjornr Jan 22, 2024
fa5ef28
test(debugger): chronicle records an error trace
eirikbjornr Jan 22, 2024
9e20993
feat(debugger): chronicle records an error trace
eirikbjornr Jan 22, 2024
21a4f1a
test(debugger): expect error records to be traces
eirikbjornr Jan 22, 2024
b20757b
test(debugger): debugtool tests expect error to be a trace
eirikbjornr Jan 22, 2024
8199685
feat(debugger): debugview renders error traces
eirikbjornr Jan 22, 2024
10e7fc8
feat(debugger): show a subset of events to the view
eirikbjornr Jan 22, 2024
4135f81
refactor(debugger): call trace to record a trace in the chronicle
eirikbjornr Jan 22, 2024
27158e5
refactor(debugger): initialise a new view controller on teardown
eirikbjornr Jan 22, 2024
84ed34c
feat: track session start and end times
eirikbjornr Jan 23, 2024
d776e08
test: same-value metrics don't update over time
eirikbjornr Jan 23, 2024
cd07fca
Fix various compiler errors
ShiningTrapez Jan 23, 2024
b0f3526
Add buffered-audio metric
ShiningTrapez Jan 23, 2024
7f59eed
Fix Debug View Test
ShiningTrapez Jan 23, 2024
dba1862
Don't record duplicated values
ShiningTrapez Jan 23, 2024
9a90108
chore: rename pushMetric to appendMetric
eirikbjornr Jan 23, 2024
13d22ef
rework internal data structure
eirikbjornr Jan 23, 2024
aeec7de
test(debugger): fix remaining tests
eirikbjornr Jan 24, 2024
03c6306
refactor: clean up
eirikbjornr Jan 24, 2024
df64d3b
feat: don't store history for buffer length and seekable range
eirikbjornr Jan 24, 2024
c30d68f
feat: warn if metrics get many
eirikbjornr Jan 24, 2024
0cb64d1
chore: make more metrics static
eirikbjornr Jan 24, 2024
b86de85
chore: as cast
eirikbjornr Jan 24, 2024
1eda06f
feat: log gap jumps to the debugger
eirikbjornr Jan 24, 2024
7981ac9
chore: give types to mediakinds
eirikbjornr Jan 25, 2024
bf7cee9
fix: type error
eirikbjornr Jan 25, 2024
58956b1
chore: declaration files
eirikbjornr Jan 25, 2024
11104af
chore: mark dashjs external
eirikbjornr Jan 26, 2024
0259239
chore: build dist on install
eirikbjornr Jan 26, 2024
e47978b
fix: avoid Object values
eirikbjornr Jan 26, 2024
b3bee0a
fix: bitrate
eirikbjornr Jan 29, 2024
3535541
Add the skeleton Compressor
ShiningTrapez Jan 30, 2024
ce51c5d
Export Chronicle and Debug Tool on Main API
ShiningTrapez Feb 1, 2024
a1a0439
Export Default in Compressor
ShiningTrapez Feb 1, 2024
5abd54d
Don't compile tests with Typescript for Prod
ShiningTrapez Feb 3, 2024
550a92c
Add Declaration Compile
ShiningTrapez Feb 3, 2024
dfc7b24
Better Declaration Build
ShiningTrapez Feb 4, 2024
e809623
Typescriptify random stuff, start adding GZip
ShiningTrapez Feb 5, 2024
200a694
Actually commit new files
ShiningTrapez Feb 5, 2024
58810b4
Low Hanging Fruit Typescriptify
ShiningTrapez Feb 5, 2024
8aa57b2
Save TransferFormats before committing
ShiningTrapez Feb 5, 2024
b621140
Todo Tests
ShiningTrapez Feb 5, 2024
8729366
Remove FFlate
ShiningTrapez Feb 5, 2024
f3019ea
feat: create union type
eirikbjornr Feb 5, 2024
d7cc08c
wip: dist output?
eirikbjornr Feb 6, 2024
a116318
fix: use if instead of booleans
eirikbjornr Feb 6, 2024
637102a
fix: add back -f flag
eirikbjornr Feb 6, 2024
202adae
Render to debugview on interval rather than on every update
jamesbungay-bbc Feb 6, 2024
92f9410
wip: try rollup-plugin-dts
eirikbjornr Feb 6, 2024
f9fe4ec
Merge branch 'badgers-307-but-but' into badgers-307-but-compressed
eirikbjornr Feb 6, 2024
268ea2b
clean up
eirikbjornr Feb 6, 2024
a022225
chore: remove commented out lines
eirikbjornr Feb 6, 2024
5407c25
Update Package Lock
ShiningTrapez Feb 7, 2024
f271baa
`as const`
ShiningTrapez Feb 7, 2024
72ec880
Don't export Chronicle on BSP API
ShiningTrapez Feb 7, 2024
73f54b3
Don't re-export `compress` and `decompess`
ShiningTrapez Feb 7, 2024
946f0a5
Change DebugView back into a singleton
jamesbungay-bbc Feb 7, 2024
7977ddb
Make frames-dropped a static metric
jamesbungay-bbc Feb 7, 2024
c08abb6
Remove redundant code for initially setting debug-view render interval
jamesbungay-bbc Feb 7, 2024
43e6b90
Typescriptify Resizer
ShiningTrapez Feb 7, 2024
621001a
Make Compressor Committable
ShiningTrapez Feb 7, 2024
472eb23
Merge branch 'badgers-307-but-compressed' of github.com:bbc/bigscreen…
jamesbungay-bbc Feb 7, 2024
c70c63e
Named Exports in ./model, and Typescriptify ReadyHelper
ShiningTrapez Feb 7, 2024
8f7511d
Merge Master
ShiningTrapez Feb 7, 2024
e202f25
Linting
ShiningTrapez Feb 7, 2024
6c2fc10
Call showView() in DebugViewController tests to start render interval
jamesbungay-bbc Feb 7, 2024
24e1f93
Merge branch 'badgers-307-but-compressed' of github.com:bbc/bigscreen…
jamesbungay-bbc Feb 7, 2024
4ef2690
Zod Skeleton
ShiningTrapez Feb 7, 2024
83a68b1
More work on Zod Schema - Message
ShiningTrapez Feb 7, 2024
c7cb709
feat: log buffered ranges on waiting/stall event
eirikbjornr Feb 7, 2024
85464f2
TraceKinds and MetricKeys Zod
ShiningTrapez Feb 7, 2024
eacc316
\'Compression\' is `JSON.stringify` for now
ShiningTrapez Feb 8, 2024
679c410
Merge "Validation" Branch into "Compression" Branch (#321)
ShiningTrapez Feb 12, 2024
0e82adc
Typescriptify most of Utils
ShiningTrapez Feb 12, 2024
ee7ac6f
Remove Validator
ShiningTrapez Feb 12, 2024
cdef410
Export Types from Chronicle on TS Interface
ShiningTrapez Feb 12, 2024
42d7df7
Export Chronicle Enums etc.
ShiningTrapez Feb 12, 2024
ad1194b
feat: display all entries in the view when log-level is debug
eirikbjornr Feb 13, 2024
9a6c751
fix: generate working types
eirikbjornr Feb 14, 2024
2807159
fix: dev build
eirikbjornr Feb 14, 2024
79cadec
fix: replace all hyphens
eirikbjornr Feb 14, 2024
9bcacf2
Change tail to 100
ShiningTrapez Feb 22, 2024
4b92b77
Merge Quota Exceeded Changes
ShiningTrapez Feb 22, 2024
3581616
Kebab Case
ShiningTrapez Feb 22, 2024
6887ac4
Merge Quota Exceeded Fix
ShiningTrapez Feb 22, 2024
d08121c
No JSON Stringify in Compressor
ShiningTrapez Feb 28, 2024
6132900
Remove Compressor
ShiningTrapez Feb 28, 2024
f80b721
chore: sort traces first
eirikbjornr Feb 28, 2024
5b43b91
refactor: use kind as identifier for all categories
eirikbjornr Mar 1, 2024
b5665e7
fix: report correct media type with quality change
eirikbjornr Mar 1, 2024
43d7a39
chore: undo whitespace changes
eirikbjornr Mar 5, 2024
eb0a765
chore: undo whitespace changes
eirikbjornr Mar 5, 2024
173a4fa
feat: record buffers on playing event
eirikbjornr Mar 6, 2024
b781a57
style: rename wrung to inverted
eirikbjornr Mar 6, 2024
7755df8
chore: make chronicle warn -> error
eirikbjornr Mar 6, 2024
a584af2
feat: make init data a type
eirikbjornr Mar 6, 2024
457c0fe
docs: clean up type
eirikbjornr Mar 6, 2024
269e2d7
docs: update Chronicle docs
eirikbjornr Mar 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env:
es6: true
node: true

parser: "@babel/eslint-parser"
parser: "@typescript-eslint/parser"

parserOptions:
ecmaVersion: 2015
Expand All @@ -18,16 +18,16 @@ ignorePatterns:

extends:
- eslint:recommended
- plugin:import/recommended
- plugin:@typescript-eslint/recommended
- plugin:json/recommended
- plugin:sonarjs/recommended
- plugin:unicorn/recommended

plugins:
- import
- json
- sonarjs
- unicorn
- "@typescript-eslint"

rules:
# Discuss these!
Expand Down Expand Up @@ -60,8 +60,8 @@ rules:
prefer-spread: error
quote-props: [error, as-needed]
yoda: [error, never]
import/prefer-default-export: error
unicorn/no-null: off
unicorn/switch-case-braces: [error, avoid]

spaced-comment:
- error
Expand Down Expand Up @@ -111,22 +111,13 @@ rules:
no-unneeded-ternary: error
no-unreachable-loop: error
no-unused-private-class-members: error
no-unused-vars: [error, { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }]
no-useless-call: error
no-useless-constructor: error
no-useless-return: error
no-use-before-define: [error, nofunc]
no-with: error
use-isnan: error
wrap-iife: [error, any]
import/first: error
import/no-mutable-exports: error

import/no-unused-modules:
- error
- unusedExports: true
ignoreExports:
- "src/main.js"

# TV compatibility
no-prototype-builtins: off
Expand All @@ -136,16 +127,24 @@ rules:
unicorn/no-array-method-this-argument: off
unicorn/no-for-loop: off
unicorn/numeric-separators-style: off
unicorn/prefer-at: off
unicorn/prefer-array-flat: off
unicorn/prefer-includes: off
unicorn/prefer-dom-node-append: off
unicorn/prefer-number-properties: off
unicorn/prefer-math-trunc: off
unicorn/prefer-optional-catch-binding: off
unicorn/prefer-string-replace-all: off
unicorn/prefer-dom-node-remove: off

# Typescript
"@typescript-eslint/no-unused-vars": [error, { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }]
"@typescript-eslint/no-explicit-any": warn

overrides:
# General test overrides
- files:
- "**/*.test.{js,mjs}"
- "**/*.test.{js,mjs,ts}"
rules:
max-nested-callbacks: off
sonarjs/no-duplicate-string: off
Expand Down
2 changes: 1 addition & 1 deletion babel.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": [["@babel/preset-env"]]
"presets": [["@babel/preset-env"], ["@babel/preset-typescript"]]
}
2 changes: 1 addition & 1 deletion docs/tutorials/02-settings-and-overrides.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type failoverResetTime = number is FiniteNumber
Provide a sorting algorithm to reorder the available media sources after a failover.

```ts
type failoverSort = (...sources: [...string]) => [...string]
type failoverSort = (sources: string[]) => string[]
```

### `streaming.seekDurationPadding`
Expand Down
24 changes: 19 additions & 5 deletions docs/tutorials/Debugging.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
During development, `bigscreen-player` offers a form of debugging with an on-screen debugger. Using this tool, specific events can be monitored to check successful execution of the program logic. This is particularly useful where no native JS consoles are accessible on certain devices.
BigscreenPlayer offers logging through "Chronicle", our own debugging solution. This tool can be used to monitor specific events and changes in metrics over time in order to validate execution of the program logic.

## On-Screen Debugging

We offer an on-screen debugger as part of our solution. This is particularly useful where no native JavaScript consoles are natively accessible on devices.

The on-screen debugger can be shown using:
```

```js
bigscreenPlayer.toggleDebug()
```

### The Chronicle
The debug-tool latches on top of the `chronicle` which acts similarly to the plugin interface. It has a reference to all of the callbacks that need to be updated upon a debug event occurring.
### Structured Logging

Logs in the Chronicle are _structured_. What is more, logs are captured even when the on-screen debugger isn't active. You can access the complete record of the playback session using:

```js
bigscreenPlayer.getDebugLogs()
```

You can find the full structure of the data returned by this function in the source file `chronicle.ts`. In short, `getDebugLogs` returns the Chronicle record as a flat array of entries. Each entry falls into one of three (3) categories:

This could allow for a possible extension of the debugging interface *if* needed.
1. Message: Unstructured string data. Think `console` output.
2. Metrics: Values that change over time, such as dropped frames.
3. Traces: Snapshots and one-of data, such as errors and events.
3 changes: 3 additions & 0 deletions docs/tutorials/tutorials.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"cdn-failover": {
"title": "CDN Failover"
},
"debugging": {
"title": "Debugging"
},
"live-streaming": {
"title": "Live"
}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
3 changes: 0 additions & 3 deletions jest.config.js

This file was deleted.

12 changes: 12 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Config } from "jest"

const config: Config = {
testEnvironment: "jsdom",
showSeed: true,
transform: {
"\\.[j]sx?$": "babel-jest",
"\\.[t]sx?$": "ts-jest",
},
}

export default config
4 changes: 2 additions & 2 deletions jsdoc.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
},
"source": {
"include": ["src"],
"includePattern": ".js$",
"includePattern": ".(js|ts)$",
"excludePattern": "(node_modules/|docs)"
},
"sourceType": "module",
"plugins": ["plugins/markdown"],
"plugins": ["plugins/markdown", "node_modules/better-docs/typescript"],
"templates": {
"cleverLinks": false,
"monospaceLinks": true,
Expand Down
Loading
Loading