[Profiling] Fix decoding of long sequences (#144979)

We store stack frame types with a run-length encoding in Elasticsearch
and decode the raw data in Kibana. The current implementation was
working fine when the frame type did not change often but failed for
long sequences of unique frame types. With this commit we make sure that
these longer sequences can also properly decoded.

Co-authored-by: Tim Rühsen <tim.ruhsen@elastic.co>
This commit is contained in:
Daniel Mitterdorfer 2022-11-10 14:50:22 +01:00 committed by GitHub
parent 773d696bec
commit 614daf0b15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -113,6 +113,10 @@ describe('Run-length encoding operations', () => {
data: 'CQM',
expected: [3, 3, 3, 3, 3, 3, 3, 3, 3],
},
{
data: 'AQkBCAEHAQYBBQEEAQMBAgEBAQA',
expected: [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],
},
{
data: 'EgMHBA',
expected: Array(18).fill(3).concat(Array(7).fill(4)),

View file

@ -122,7 +122,7 @@ export function runLengthDecodeBase64Url(input: string, size: number, capacity:
let i = 0;
let j = 0;
for (i = 0; i < multipleOf8; i += 8) {
for (i = 0; i < multipleOf8 * 8; i += 8) {
n =
(charCodeAt(input, i) << 26) |
(charCodeAt(input, i + 1) << 20) |