Skip to content

Commit 19b2083

Browse files
authored
Optimise to avoid looping over the response (#24)
1 parent 68b2d75 commit 19b2083

7 files changed

+20
-22
lines changed

dist/MANIFEST.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Hash: SHA512
99
"signedByOrgName": "parseable",
1010
"plugin": "parseable-parseable-datasource",
1111
"version": "1.0.2",
12-
"time": 1678116427014,
12+
"time": 1678169515198,
1313
"keyId": "7e4d0c6a708866e7",
1414
"files": {
1515
"LICENSE": "20b067f86de375aae6db0f283ab2e65de24d537733b89bd58432c101259d84cf",
1616
"CHANGELOG.md": "ba613d6f914b27dce9ace4d8c0cb074273c9eb6c536d8e7ac24c5ce6ae941fd0",
17-
"module.js.map": "7189edd1ce6145446698271b0a58dfc3f14444d1e3ffe3ea885e07ca1620af8a",
18-
"plugin.json": "9aeb4b12dc39425b139e9818c0b9f4c30314de6387bf5c8802deb7e36eed6a57",
17+
"module.js.map": "c3eb00d2db427c37d1a8dbd72c46a1f91a16817cce31e10c8c1e0d12b06e2845",
18+
"plugin.json": "f8966d9ecd731dc904e033d179218965fea4dab8a9483a28ce33f857d89f105c",
1919
"README.md": "030a05e0d49d3746ef272d53c99936e3b98e3219a1cac96ca1df48ddee475934",
2020
"img/configuration.png": "c545a51bcc88809b2b4f87aac517a7d27ad61281344b0485c9826370b915b4d8",
2121
"img/log-view-text.png": "8c6555af9c391cb1a8368c79b9bcc7386887beeea061e3483b0e020feec9d73d",
@@ -30,18 +30,18 @@ Hash: SHA512
3030
"stories/assets/code-brackets.svg": "9ef6443ebd43351be1a6edbab492003b84f2e30c8f80207ec8c4138fa440f7f4",
3131
"stories/assets/flow.svg": "275142c67bb630246cbdfb0fc3493f17dd695544777ec8da852dbbe94976d323",
3232
"stories/assets/repo.svg": "fb4ece472009833a03b9f1fbc775f13a010d9432cae3844e8b05710ba028100d",
33-
"module.js": "08c7db3293d45747bf8aa5c99a3b6bb9e6a12d48f358b4e034c60ec3f2381f7f",
33+
"module.js": "15358a59697f68c4f7951c04b481c01c76989211702ccd762a247d6b4d7d1f56",
3434
"dashboards/log-view.json": "224d921c8a5a4c3ed426de83f8f70ddb6406690687423b15e6e5822190bcb64c"
3535
}
3636
}
3737
-----BEGIN PGP SIGNATURE-----
3838
Version: OpenPGP.js v4.10.10
3939
Comment: https://openpgpjs.org
4040

41-
wrcEARMKAAYFAmQGBksAIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq
42-
cIhm5xzGAgY8M1HwqILkK/r9A/kbQdqZUMnRwWoqmk/rF0Iy/QZBJwtOxfx/
43-
1as1g5GpBzNshpJttopD0cQuyjcu89ZFYRWIwAIFFfp1noxjDozs/Dex0yKV
44-
wiwDqSjus2rxBNm3Yw7YSqXNgLymJRC/BnG+3g0MYeK1iKccy9tWqG9iBpuw
45-
Cdjl1Uk=
46-
=aVxm
41+
wrgEARMKAAYFAmQG1asAIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq
42+
cIhm55wRAgYtpv30X4rrnRzulBUA5hUEfEFEhKDzcO1r1wDMFwcFMIouTNEY
43+
5BZN7+1rhq1kJ/9QFwD7cEV5I7w53ivWI1boLQIJAazsCIsKX0cos12s+vwy
44+
zfUAAsOiPtEhfPeKfb7mhVyUOwZ9lKGzzjxJqh7iozuWz8OgixbsE6ZZyt7d
45+
TE1nbEN/
46+
=7oRX
4747
-----END PGP SIGNATURE-----

dist/module.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/module.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{"name": "Log Dashboard", "path": "img/log-visualisation.png"}
2727
],
2828
"version": "1.0.2",
29-
"updated": "2023-03-06"
29+
"updated": "2023-03-07"
3030
},
3131
"routes": [
3232
{
-36 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
514ca07b4f149d8579525ee4d91aa90f261e6d12
1+
a6e1060ede387382a511f3cf28e387c841884977

src/datasource.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,14 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
9191

9292
if (array.length > 0) {
9393
const fields = Object.keys(array[0]).map(field => {
94-
return { name: field, type: guessFieldTypeFromValue(array[0][field]) };
95-
});
96-
for (const field of fields) {
94+
let fieldType = guessFieldTypeFromValue(array[0][field])
9795
// p_timestamp is always a time field present in the log
98-
// stream as server adds it to the log
99-
if (field.name.toLowerCase() === 'p_timestamp') {
100-
field.type = FieldType.time;
101-
break;
96+
// stream as parseable adds it to the log event
97+
if (field.toLowerCase() === 'p_timestamp') {
98+
fieldType = FieldType.time;
10299
}
103-
}
100+
return { name: field, type: fieldType};
101+
});
104102
dataFrame = new MutableDataFrame({ fields });
105103
}
106104

0 commit comments

Comments
 (0)