Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions frontend/src/components/print/metricConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const NUM_PRINT_CONFIG_ITEMS_USED = 'numPrintConfigItems'
16 changes: 14 additions & 2 deletions frontend/src/components/print/print-client/generatePdfMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { saveAs } from 'file-saver'
import slugify from 'slugify'
import * as Sentry from '@sentry/browser'
import { generatePdf } from './generatePdf.js'
import { NUM_PRINT_CONFIG_ITEMS_USED } from '@/components/print/metricConstants.js'

const RENDER_IN_WORKER = true

Expand All @@ -23,10 +24,21 @@ export const generatePdfMixin = {
return
}

const config = this.config
Sentry.startSpan(
{
attributes: {
'print.clientPrintUsed': '1',
[`print.${NUM_PRINT_CONFIG_ITEMS_USED}`]: config?.contents?.length,
},
},
() => {}
)

this.loading = true

const { blob, error } = await generatePdf({
config: { ...this.config, apiGet: this.api.get.bind(this) },
config: { ...config, apiGet: this.api.get.bind(this) },
storeData: this.$store.state,
translationData: this.$i18n.messages,
renderInWorker: RENDER_IN_WORKER,
Expand All @@ -41,7 +53,7 @@ export const generatePdfMixin = {

saveAs(
blob,
slugify(this.config.documentName, {
slugify(config.documentName, {
locale: this.$store.state.lang.language.substring(0, 2),
}) + '.pdf'
)
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/components/print/print-nuxt/generatePdfMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { cloneDeep } from 'lodash-es'
import axios from 'axios'
import { getEnv } from '@/environment.js'
import * as Sentry from '@sentry/browser'
import { NUM_PRINT_CONFIG_ITEMS_USED } from '@/components/print/metricConstants.js'

const PRINT_URL = getEnv().PRINT_URL

Expand All @@ -26,6 +27,16 @@ export const generatePdfMixin = {
}

const config = cloneDeep(this.config)
Sentry.startSpan(
{
attributes: {
'print.nuxtPrintUsed': 1,
[`print.${NUM_PRINT_CONFIG_ITEMS_USED}`]: config?.contents?.length,
},
},
() => {}
)

config.documentName = slugify(config.documentName, {
locale: this.$store.state.lang.language.substring(0, 2),
})
Expand Down
Loading