Skip to content

Commit 0ce1b45

Browse files
authored
Merge pull request #347 from iteratec/feature/peformanceLogsIndentationDepth
Changed type of the logged indentation depth to an enum type
2 parents b220f90 + 0c6787c commit 0ce1b45

31 files changed

+226
-203
lines changed

grails-app/controllers/de/iteratec/osm/api/CsiApiController.groovy

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import de.iteratec.osm.measurement.schedule.JobGroup
1313
import de.iteratec.osm.result.MvQueryParams
1414
import de.iteratec.osm.util.ControllerUtils
1515
import de.iteratec.osm.util.PerformanceLoggingService
16+
import de.iteratec.osm.util.PerformanceLoggingService.LogLevel
17+
import de.iteratec.osm.util.PerformanceLoggingService.IndentationDepth
1618
import io.swagger.annotations.*
1719
import org.joda.time.DateTime
1820
import org.joda.time.Duration
@@ -269,7 +271,7 @@ class CsiApiController {
269271

270272
MvQueryParams queryParams = null;
271273
try {
272-
performanceLoggingService.logExecutionTimeSilently(PerformanceLoggingService.LogLevel.DEBUG, "construct query params", 1) {
274+
performanceLoggingService.logExecutionTimeSilently(LogLevel.DEBUG, "construct query params", IndentationDepth.ONE) {
273275
queryParams = cmd.createMvQueryParams(browserService)
274276
}
275277
} catch (NoResultException nre) {
@@ -283,7 +285,7 @@ class CsiApiController {
283285
CsiByEventResultsDto csiDtoToReturn
284286
try {
285287
if (cmd.system && cmd.page) {
286-
performanceLoggingService.logExecutionTimeSilently(PerformanceLoggingService.LogLevel.DEBUG, "calculate page csi", 1) {
288+
performanceLoggingService.logExecutionTimeSilently(LogLevel.DEBUG, "calculate page csi", IndentationDepth.ONE) {
287289
csiDtoToReturn = csiByEventResultsService.retrieveCsi(
288290
startDateTimeInclusive,
289291
endDateTimeInclusive,
@@ -292,7 +294,7 @@ class CsiApiController {
292294
)
293295
}
294296
} else if (cmd.system) {
295-
performanceLoggingService.logExecutionTimeSilently(PerformanceLoggingService.LogLevel.DEBUG, "calculate shop csi", 1) {
297+
performanceLoggingService.logExecutionTimeSilently(LogLevel.DEBUG, "calculate shop csi", IndentationDepth.ONE) {
296298
csiDtoToReturn = csiByEventResultsService.retrieveCsi(
297299
startDateTimeInclusive,
298300
endDateTimeInclusive,
@@ -305,7 +307,7 @@ class CsiApiController {
305307
ControllerUtils.sendSimpleResponseAsStream(response, HttpStatus.NOT_FOUND, e.getMessage())
306308
return
307309
}
308-
log.debug("performance logdata getResults:\n" + performanceLoggingService.getExecutionTimeLoggingSessionData(PerformanceLoggingService.LogLevel.DEBUG))
310+
log.debug("performance logdata getResults:\n" + performanceLoggingService.getExecutionTimeLoggingSessionData(LogLevel.DEBUG))
309311
return ControllerUtils.sendObjectAsJSON(response, [target: csiDtoToReturn], params.pretty && params.pretty == 'true')
310312

311313
}
@@ -316,7 +318,7 @@ class CsiApiController {
316318
DateTime endDateTimeInclusive = API_DATE_FORMAT.parseDateTime(cmd.timestampTo)
317319

318320
performanceLoggingService.resetExecutionTimeLoggingSession()
319-
performanceLoggingService.logExecutionTimeSilently(PerformanceLoggingService.LogLevel.DEBUG, "cmd validation", 1) {
321+
performanceLoggingService.logExecutionTimeSilently(LogLevel.DEBUG, "cmd validation", IndentationDepth.ONE) {
320322

321323
if (endDateTimeInclusive.isBefore(startDateTimeInclusive)) {
322324
ControllerUtils.sendSimpleResponseAsStream(response, HttpStatus.BAD_REQUEST, 'The end of requested time-frame could not be before start of time-frame.')

grails-app/controllers/de/iteratec/osm/api/RawResultsApiController.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import de.iteratec.osm.result.ThresholdService
1212
import de.iteratec.osm.result.dao.EventResultDaoService
1313
import de.iteratec.osm.util.ControllerUtils
1414
import de.iteratec.osm.util.PerformanceLoggingService
15+
import de.iteratec.osm.util.PerformanceLoggingService.LogLevel
16+
import de.iteratec.osm.util.PerformanceLoggingService.IndentationDepth
1517
import io.swagger.annotations.*
1618
import org.joda.time.DateTime
1719
import org.joda.time.Duration
@@ -225,7 +227,7 @@ class RawResultsApiController {
225227

226228
List<EventResultDto> results = new LinkedList<EventResultDto>();
227229

228-
performanceLoggingService.logExecutionTime(PerformanceLoggingService.LogLevel.INFO, 'assembling results for json', 1) {
230+
performanceLoggingService.logExecutionTime(LogLevel.INFO, 'assembling results for json', IndentationDepth.ONE) {
229231
Collection<EventResult> eventResults = eventResultDaoService.getByStartAndEndTimeAndMvQueryParams(startTimeInclusive, endTimeInclusive, cmd.getCachedViewsToReturn(), queryParams)
230232
eventResults.each { eachEventResult ->
231233
results.add(new EventResultDto(eachEventResult));

grails-app/controllers/de/iteratec/osm/csi/CsiConfigurationController.groovy

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import de.iteratec.osm.report.UserspecificDashboardService
2727
import de.iteratec.osm.util.ControllerUtils
2828
import de.iteratec.osm.util.I18nService
2929
import de.iteratec.osm.util.PerformanceLoggingService
30+
import de.iteratec.osm.util.PerformanceLoggingService.LogLevel
31+
import de.iteratec.osm.util.PerformanceLoggingService.IndentationDepth
3032
import grails.converters.JSON
3133

3234
/**
@@ -144,11 +146,7 @@ class CsiConfigurationController {
144146

145147
CsiConfiguration sourceConfig
146148

147-
performanceLoggingService.logExecutionTime(
148-
PerformanceLoggingService.LogLevel.DEBUG,
149-
"Getting source CSI Configuration",
150-
1
151-
) {
149+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, "Getting source CSI Configuration", IndentationDepth.ONE) {
152150
if (CsiConfiguration.findByLabel(params.label)) {
153151
throw new IllegalArgumentException("CsiConfiguration already exists with name " + params.label)
154152
}
@@ -161,28 +159,16 @@ class CsiConfigurationController {
161159
}
162160

163161
CsiConfiguration newCsiConfig
164-
performanceLoggingService.logExecutionTime(
165-
PerformanceLoggingService.LogLevel.DEBUG,
166-
"copy CSI Configuration",
167-
1
168-
) {
162+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, "copy CSI Configuration", IndentationDepth.ONE) {
169163
newCsiConfig = CsiConfiguration.copyConfiguration(sourceConfig)
170164
}
171165

172-
performanceLoggingService.logExecutionTime(
173-
PerformanceLoggingService.LogLevel.DEBUG,
174-
"save copied CSI Configuration",
175-
1
176-
) {
166+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, "save copied CSI Configuration", IndentationDepth.ONE) {
177167
newCsiConfig.label = params.label
178168
newCsiConfig.save(failOnError: true, flush: true)
179169
}
180170

181-
performanceLoggingService.logExecutionTime(
182-
PerformanceLoggingService.LogLevel.DEBUG,
183-
"redirect",
184-
1
185-
) {
171+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, "redirect", IndentationDepth.ONE) {
186172
List csi_configurations = []
187173
CsiConfiguration.list().each { csi_configurations << ['id': it.id, 'label': it.label] }
188174
render([
@@ -371,7 +357,7 @@ class CsiConfigurationController {
371357
"Removed ${toDelete.size()} Mappings of page ${pageToRemoveMappingFrom.name} from CsiConfiguration ${csiConfigurationToRemovePageMappingFrom.label}.",
372358
[toDelete.size(), pageToRemoveMappingFrom.name, csiConfigurationToRemovePageMappingFrom.label]
373359
)
374-
performanceLoggingService.logExecutionTime(PerformanceLoggingService.LogLevel.DEBUG, "render mappings", 1) {
360+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, "render mappings", IndentationDepth.ONE) {
375361
render successMessage
376362
}
377363

grails-app/controllers/de/iteratec/osm/csi/CsiDashboardController.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import de.iteratec.osm.result.MeasurandGroup
3333
import de.iteratec.osm.result.MeasuredEvent
3434
import de.iteratec.osm.result.MvQueryParams
3535
import de.iteratec.osm.util.*
36+
import de.iteratec.osm.util.PerformanceLoggingService.LogLevel
37+
import de.iteratec.osm.util.PerformanceLoggingService.IndentationDepth
3638
import grails.converters.JSON
3739
import grails.plugin.springsecurity.SpringSecurityService
3840
import grails.web.mapping.LinkGenerator
@@ -448,7 +450,7 @@ class CsiDashboardController {
448450
Interval fixedTimeFrame = fixTimeFrame(timeFrame, CsiAggregationInterval.HOURLY)
449451

450452
OsmRickshawChart chart
451-
performanceLoggingService.logExecutionTime(PerformanceLoggingService.LogLevel.DEBUG, 'CsiDashboardController: getHourlies', 1) {
453+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'CsiDashboardController: getHourlies', IndentationDepth.ONE) {
452454

453455
chart = customerSatisfactionHighChartService.getCalculatedHourlyEventCsiAggregationsAsHighChartMap(
454456
fixedTimeFrame.getStart().toDate(), fixedTimeFrame.getEnd().toDate(), queryParams, csiType

grails-app/controllers/de/iteratec/osm/measurement/schedule/JobController.groovy

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import de.iteratec.osm.util.ControllerUtils
2828
import de.iteratec.osm.util.I18nService
2929
import de.iteratec.osm.util.PerformanceLoggingService
3030
import de.iteratec.osm.util.PerformanceLoggingService.LogLevel
31+
import de.iteratec.osm.util.PerformanceLoggingService.IndentationDepth
3132
import grails.converters.JSON
3233
import grails.gorm.transactions.Transactional
3334
import grails.gsp.PageRenderer
@@ -71,17 +72,17 @@ class JobController {
7172
// custom sort for nextExecutionTime necessary due to it being neither persisted in the
7273
// database nor derived. Thus it cannot be passed to database layer sorting
7374
if (params.sort == 'nextExecutionTime') {
74-
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'sorting via nextExecutionTime: query jobs from db', 1) {
75+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'sorting via nextExecutionTime: query jobs from db', IndentationDepth.ONE) {
7576
jobs = jobDaoService.getAllJobs()
7677
}
77-
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'sorting via nextExecutionTime: sorting', 1) {
78+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'sorting via nextExecutionTime: sorting', IndentationDepth.ONE) {
7879
jobs.sort { if (it.active) it.getNextExecutionTime() }
7980
}
80-
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'sorting via nextExecutionTime: reversing', 1) {
81+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'sorting via nextExecutionTime: reversing', IndentationDepth.ONE) {
8182
if (params.order == 'desc') jobs.reverse(true)
8283
}
8384
} else if (params.sort || request.xhr || forceShowAllJobs) {
84-
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'NOT sorting via nextExecutionTime: query jobs from db', 1) {
85+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'NOT sorting via nextExecutionTime: query jobs from db', IndentationDepth.ONE) {
8586
jobs = jobDaoService.getJobs(params)
8687
}
8788
} else {

grails-app/controllers/de/iteratec/osm/measurement/schedule/JobGroupController.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import de.iteratec.osm.result.ResultSelectionService
1313
import de.iteratec.osm.util.ControllerUtils
1414
import de.iteratec.osm.util.I18nService
1515
import de.iteratec.osm.util.PerformanceLoggingService
16+
import de.iteratec.osm.util.PerformanceLoggingService.IndentationDepth
1617
import grails.converters.JSON
1718
import org.hibernate.sql.JoinType
1819
import org.joda.time.DateTime
@@ -268,7 +269,7 @@ class JobGroupController {
268269
sendError(command)
269270
return
270271
}
271-
def dtos = performanceLoggingService.logExecutionTime(DEBUG, "getJobGroupToPagesMap for ${command as JSON}", 0, {
272+
def dtos = performanceLoggingService.logExecutionTime(DEBUG, "getJobGroupToPagesMap for ${command as JSON}", IndentationDepth.ZERO, {
272273
def jobGroupAndPages = resultSelectionService.query(command.toResultSelectionCommand(), null, { existing ->
273274
projections {
274275
distinct(['jobGroup','page'])

grails-app/controllers/de/iteratec/osm/result/DistributionChartController.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import de.iteratec.osm.util.ControllerUtils
2222
import de.iteratec.osm.util.ExceptionHandlerController
2323
import de.iteratec.osm.util.I18nService
2424
import de.iteratec.osm.util.PerformanceLoggingService
25+
import de.iteratec.osm.util.PerformanceLoggingService.IndentationDepth
2526
import org.springframework.http.HttpStatus
2627

2728
import static de.iteratec.osm.util.PerformanceLoggingService.LogLevel.DEBUG
@@ -213,7 +214,7 @@ class DistributionChartController extends ExceptionHandlerController {
213214
.getRawData(EventResultQueryBuilder.MetaDataSet.NONE)
214215
DistributionChartDTO distributionChartDTO = new DistributionChartDTO()
215216
if(aggregations.any {it."${selectedMeasurand.getDatabaseRelevantName()}" != null}){
216-
performanceLoggingService.logExecutionTime(DEBUG, "create DTO for DistributionChart", 1) {
217+
performanceLoggingService.logExecutionTime(DEBUG, "create DTO for DistributionChart", IndentationDepth.ONE) {
217218
aggregations.each {EventResultProjection eventResultProjection ->
218219
if(eventResultProjection."${selectedMeasurand.getDatabaseRelevantName()}"){
219220
JobGroup jobGroup = allJobGroups.find{jobGroup -> jobGroup.id == eventResultProjection.jobGroupId}

grails-app/controllers/de/iteratec/osm/result/HighchartPointDetailsController.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import de.iteratec.osm.result.dao.EventResultDaoService
2525
import de.iteratec.osm.util.Constants
2626
import de.iteratec.osm.util.PerformanceLoggingService
2727
import de.iteratec.osm.util.PerformanceLoggingService.LogLevel
28+
import de.iteratec.osm.util.PerformanceLoggingService.IndentationDepth
2829
import grails.web.mapping.LinkGenerator
2930
import org.joda.time.DateTime
3031

@@ -370,7 +371,7 @@ class HighchartPointDetailsController {
370371

371372
// Load relevant data:
372373
List<EventResult> eventResults
373-
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'getting event-results - listAggregatedResultsByQueryParams - getMedianEventResultsBy', 1) {
374+
performanceLoggingService.logExecutionTime(LogLevel.DEBUG, 'getting event-results - listAggregatedResultsByQueryParams - getMedianEventResultsBy', IndentationDepth.ONE) {
374375
eventResults = eventResultDaoService.getMedianEventResultsBy(
375376
fromDate.toDate(), toDate.toDate(), relevantCachedViews, jobGroupId, measuredEventId, pageId, browserId, locationId)
376377
}

0 commit comments

Comments
 (0)