change(tracker): configure automatic headers, compress anything bigger than 24k, add third party lib to list
This commit is contained in:
parent
4f7112baab
commit
08a6705508
3 changed files with 14 additions and 12 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
## Licenses (as of March 24, 2023)
|
## Licenses (as of April 7, 2023), 2023)
|
||||||
|
|
||||||
Below is the list of dependencies used in OpenReplay software. Licenses may change between versions, so please keep this up to date with every new library you use.
|
Below is the list of dependencies used in OpenReplay software. Licenses may change between versions, so please keep this up to date with every new library you use.
|
||||||
|
|
||||||
|
|
@ -117,3 +117,4 @@ Below is the list of dependencies used in OpenReplay software. Licenses may chan
|
||||||
| html2canvas | MIT | JavaScript |
|
| html2canvas | MIT | JavaScript |
|
||||||
| eget | MIT | Infrastructure |
|
| eget | MIT | Infrastructure |
|
||||||
| @medv/finder | MIT | JavaScript |
|
| @medv/finder | MIT | JavaScript |
|
||||||
|
| fflate | MIT | JavaScript |
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ export default class App {
|
||||||
this.worker.onmessage = ({ data }: MessageEvent<FromWorkerData>) => {
|
this.worker.onmessage = ({ data }: MessageEvent<FromWorkerData>) => {
|
||||||
if (data === 'restart') {
|
if (data === 'restart') {
|
||||||
this.stop(false)
|
this.stop(false)
|
||||||
this.start({}, true)
|
void this.start({}, true)
|
||||||
} else if (data === 'not_init') {
|
} else if (data === 'not_init') {
|
||||||
console.warn('WebWorker: writer not initialised. Restarting tracker')
|
console.warn('WebWorker: writer not initialised. Restarting tracker')
|
||||||
} else if (data.type === 'failure') {
|
} else if (data.type === 'failure') {
|
||||||
|
|
@ -182,9 +182,7 @@ export default class App {
|
||||||
} else if (data.type === 'compress') {
|
} else if (data.type === 'compress') {
|
||||||
const batch = data.batch
|
const batch = data.batch
|
||||||
const batchSize = batch.byteLength
|
const batchSize = batch.byteLength
|
||||||
console.log(batchSize)
|
if (batchSize > 1000 * 25) {
|
||||||
// 1000 * 10
|
|
||||||
if (batchSize > 1) {
|
|
||||||
gzip(data.batch, { mtime: 0 }, (err, result) => {
|
gzip(data.batch, { mtime: 0 }, (err, result) => {
|
||||||
if (err) console.error(err)
|
if (err) console.error(err)
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
@ -217,6 +215,7 @@ export default class App {
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
context,
|
context,
|
||||||
|
// @ts-ignore
|
||||||
error: `${e}`,
|
error: `${e}`,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -59,16 +59,18 @@ export default class QueueSender {
|
||||||
private sendBatch(batch: Uint8Array, isCompressed?: boolean): void {
|
private sendBatch(batch: Uint8Array, isCompressed?: boolean): void {
|
||||||
this.busy = true
|
this.busy = true
|
||||||
|
|
||||||
// @ts-ignore
|
const headers = {
|
||||||
|
Authorization: `Bearer ${this.token as string}`,
|
||||||
|
} as Record<string, string>
|
||||||
|
|
||||||
|
if (isCompressed) {
|
||||||
|
headers['Content-Encoding'] = 'gzip'
|
||||||
|
}
|
||||||
|
|
||||||
fetch(this.ingestURL, {
|
fetch(this.ingestURL, {
|
||||||
body: batch,
|
body: batch,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
// @ts-ignore
|
headers,
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${this.token as string}`,
|
|
||||||
//"Content-Type": "",
|
|
||||||
'Content-Encoding': isCompressed ? 'gzip' : undefined,
|
|
||||||
},
|
|
||||||
keepalive: batch.length < KEEPALIVE_SIZE_LIMIT,
|
keepalive: batch.length < KEEPALIVE_SIZE_LIMIT,
|
||||||
})
|
})
|
||||||
.then((r: Record<string, any>) => {
|
.then((r: Record<string, any>) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue