Skip to content

Commit

Permalink
Custom dataset error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
WalshKieran committed Jun 3, 2024
1 parent 7d318d3 commit 5cf7790
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@bufbuild/buf": "^1.28.1",
"@bufbuild/protobuf": "^1.5.1",
"@bufbuild/protoc-gen-es": "^1.5.1",
"@datadog/browser-logs": "^5.19.0",
"@fortawesome/fontawesome-free": "^6.5.1",
"@melloware/coloris": "^0.23.1",
"@square/svelte-store": "^1.0.17",
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/lib/components/customview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import { asCSV } from '../stores/custom'
import { findMatchesSorted } from "../utils/hdf5";
import {count, mean, sd} from '../utils/math'
import { datadogLogs } from '@datadog/browser-logs';
export let customModal;
const { row, data, customs } = getContext('core');
Expand Down Expand Up @@ -116,7 +117,7 @@
const matrixName = 'Custom'
const {order, sampleNames, expressionGetter, columnGetter} = $metadataProcessed.result
const {index, zScores } = $metadataProcessed.result.$dataProcessed.result
return ({
let ret = ({
[name]: {
name,
index,
Expand All @@ -130,6 +131,8 @@
})
}
});
datadogLogs.logger.info('Adding custom dataset', {name: name, data: ret});
return ret;
}
Expand Down Expand Up @@ -162,7 +165,7 @@
</Label>
<div class='flex flex-col items-center'>
<Button type='submit' disabled={!$metadataProcessed?.result} on:click={() => {customs.set({...$customs, ...finaliseDataset($metadataProcessed, nameInputValue || $placeholderName)}); customModal.set('')}} color='light'>Add<i class='mx-2 fas fa-plus'/></Button>
<Button type='submit' disabled={!$metadataProcessed?.result} on:click={() => {datadogLogs.logger.info('Clicking add custom dataset', {}); customs.set({...$customs, ...finaliseDataset($metadataProcessed, nameInputValue || $placeholderName)}); customModal.set('')}} color='light'>Add<i class='mx-2 fas fa-plus'/></Button>
</div>
</form>
</div>
2 changes: 2 additions & 0 deletions frontend/src/lib/stores/metadata.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { derived } from 'svelte/store';
import { datadogLogs } from '@datadog/browser-logs';

function createMetadataStore(core) {
return derived([core.data, core.customs], ([$data, $customs]) => {
datadogLogs.logger.info('Updating metadata store', {data: $customs});
const metadataColumnReaders = {};
for(const h of $data.value.get('metadata').keys) {
metadataColumnReaders[h] = {
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
import { primary, paletteColors, gradientColors } from '../lib/utils/colors'
import './../../node_modules/@fortawesome/fontawesome-free/css/all.min.css';
import '../app.css';
import { datadogLogs } from '@datadog/browser-logs';
datadogLogs.init({
clientToken: 'pubb5838d5b6b4df7acca79de020e4b7dc2',
site: 'ap1.datadoghq.com',
forwardErrorsToLogs: true,
forwardConsoleLogs: "all",
sessionSampleRate: 100
});
const url = `${base}/metadata.json`/*'http://localhost:5501/metadata.json'*/;
setContext('core', createCore(url));
Expand Down

0 comments on commit 5cf7790

Please sign in to comment.