Skip to content

Commit

Permalink
Add debug logs for data loading and processing steps
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeknovy committed Dec 10, 2024
1 parent e914265 commit f462016
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/server/controllers/item/shared/item-data-processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,40 @@ export const itemDataProcessing = async ({ projectName, scenarioName, itemId })
let rawDataArray = null

try {
logger.debug("Loading overview aggregation")

Check warning on line 49 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L49

Added line #L49 was not covered by tests
const aggOverview = await db.one(aggOverviewQuery(itemId))
logger.debug("Loading label aggregation")

Check warning on line 51 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L51

Added line #L51 was not covered by tests
const aggLabel = await db.many(aggLabelQuery(itemId))
logger.debug("Loading status code distribution")

Check warning on line 53 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L53

Added line #L53 was not covered by tests
const statusCodeDistribution = await db.manyOrNone(responseCodeDistribution(itemId))
logger.debug("Loading response time per label distribution")

Check warning on line 55 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L55

Added line #L55 was not covered by tests
const responseTimePerLabelDistribution = await db.manyOrNone(responseTimePerLabelHistogram(itemId))
logger.debug("Loading response failures")

Check warning on line 57 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L57

Added line #L57 was not covered by tests
const responseFailures = await db.manyOrNone(responseMessageFailures(itemId))
logger.debug("Loading scenario settings")

Check warning on line 59 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L59

Added line #L59 was not covered by tests
const scenarioSettings = await db.one(getScenarioSettings(projectName, scenarioName))

logger.debug("Loading raw downsampled data")

Check warning on line 61 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L61

Added line #L61 was not covered by tests
let rawDownsampledData = await db.manyOrNone(getDownsampledRawData(itemId, MAX_SCATTER_CHART_POINTS))
rawDataArray = rawDownsampledData?.map(row => [row.timestamp, row.value])
rawDownsampledData = null

logger.debug("Loading grouped errors")

Check warning on line 66 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L66

Added line #L66 was not covered by tests
const groupedErrors = await db.manyOrNone(findGroupedErrors(itemId))
logger.debug("Loading top 5 errors by label")

Check warning on line 68 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L68

Added line #L68 was not covered by tests
const top5ErrorsByLabel = await db.manyOrNone(findTop5ErrorsByLabel(itemId))

if (aggOverview.number_of_sut_hostnames > 1) {
logger.debug("Loading SUT overview")

Check warning on line 72 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L72

Added line #L72 was not covered by tests
sutMetrics = await db.many(sutOverviewQuery(itemId))
}

if (scenarioSettings.apdexSettings.enabled) {
const { satisfyingThreshold, toleratingThreshold } = scenarioSettings.apdexSettings
logger.debug("Calculating apdex")

Check warning on line 78 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L78

Added line #L78 was not covered by tests
apdex = await db.many(calculateApdexValues(itemId,
satisfyingThreshold,
toleratingThreshold))
logger.debug("Updating apdex settings")

Check warning on line 82 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L82

Added line #L82 was not covered by tests
await db.none(updateItemApdexSettings(itemId, {
satisfyingThreshold,
toleratingThreshold,
Expand All @@ -92,13 +103,18 @@ export const itemDataProcessing = async ({ projectName, scenarioName, itemId })

// distributed mode
if (aggOverview?.number_of_hostnames > 1) {
logger.debug("Loading distributed threads")

Check warning on line 106 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L106

Added line #L106 was not covered by tests
distributedThreads = await db.manyOrNone(distributedThreadsQuery(interval, itemId))
}


logger.debug("Loading label chart")

Check warning on line 111 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L111

Added line #L111 was not covered by tests
const labelChart = await db.many(charLabelQuery(interval, itemId))
logger.debug("Loading overview chart")

Check warning on line 113 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L113

Added line #L113 was not covered by tests
const overviewChart = await db.many(chartOverviewQuery(interval, itemId))
logger.debug("Loading status code chart")

Check warning on line 115 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L115

Added line #L115 was not covered by tests
const statusCodeChart = await db.many(chartOverviewStatusCodesQuery(interval, itemId))
logger.debug("Loading threads per group")

Check warning on line 117 in src/server/controllers/item/shared/item-data-processing.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/item/shared/item-data-processing.ts#L117

Added line #L117 was not covered by tests
const threadsPerGroup = await db.manyOrNone(threadsPerThreadGroup(interval, itemId))
if (parseInt(index, 10) === 0) { // default interval
chartData = prepareChartDataForSaving(
Expand Down

0 comments on commit f462016

Please sign in to comment.