Skip to content

Commit

Permalink
fix(metrics): num resources visited, gradle config (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
emjburns authored Nov 14, 2018
1 parent 6494e86 commit 5e26d77
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ subprojects {
test {
testLogging {
exceptionFormat = "full"
events 'PASSED', 'FAILED', 'SKIPPED'
}
afterSuite { desc, result ->
if (!desc.parent) {
println "\nTest result: ${result.resultType}"
println "Test summary: ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ abstract class AbstractResourceTypeHandler<T : Resource>(

printResult(candidateCounter, totalResourcesVisitedCounter, workConfiguration, markedResources, Action.MARK)
} finally {
recordMarkMetrics(timerId, workConfiguration, violationCounter, candidateCounter)
recordMarkMetrics(timerId, workConfiguration, violationCounter, candidateCounter, totalResourcesVisitedCounter)
postMark.invoke()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ open class MetricsSupport(
protected fun recordMarkMetrics(markerTimerId: Long,
workConfiguration: WorkConfiguration,
violationCounter: AtomicInteger,
candidateCounter: AtomicInteger) {
candidateCounter: AtomicInteger,
totalResourcesVisitedCounter: AtomicInteger) {
markDurationTimer.stop(markerTimerId)
registry.gauge(
candidatesCountId.withTags(
Expand All @@ -83,6 +84,13 @@ open class MetricsSupport(
"configuration", workConfiguration.namespace,
"resourceTypeHandler", javaClass.simpleName
)).set(exclusionCounters[Action.MARK]!!.toDouble())

registry.gauge(
resourcesVisitedId.withTags(
"resourceType", workConfiguration.resourceType,
"configuration", workConfiguration.namespace,
"resourceTypeHandler", javaClass.simpleName
)).set(totalResourcesVisitedCounter.toDouble())
}

protected fun recordFailureForAction(action: Action, workConfiguration: WorkConfiguration, e: Exception) {
Expand Down

0 comments on commit 5e26d77

Please sign in to comment.