Skip to content

Commit

Permalink
feat(pagerduty): Distinguish logging between throttled and non-throttled
Browse files Browse the repository at this point in the history
For no other reason than to cut down on a bit of noise in the logs.
  • Loading branch information
ajordens committed Sep 9, 2020
1 parent ce931c1 commit 4958c00
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RestController
import retrofit.RetrofitError

import java.util.concurrent.atomic.AtomicReference

@CompileStatic
Expand Down Expand Up @@ -79,15 +80,23 @@ class PagerDutyController {
log.info("Fetched {} PagerDuty services", services?.size())
pagerDutyServicesCache.set(services)
} catch (e) {
log.error("Unable to refresh PagerDuty service list", e)
if (e instanceof RetrofitError && e.response?.status == 429) {
log.warn("Unable to refresh PagerDuty service list (throttled!)")
} else {
log.error("Unable to refresh PagerDuty service list", e)
}
}

try {
List<Map> onCalls = fetchAllOnCalls()
log.info("Fetched {} PagerDuty onCall", onCalls?.size())
pagerDutyOnCallCache.set(onCalls)
} catch (e) {
log.error("Unable to refresh PagerDuty onCall list", e)
if (e instanceof RetrofitError && e.response?.status == 429) {
log.warn("Unable to refresh PagerDuty onCall list (throttled!)")
} else {
log.error("Unable to refresh PagerDuty onCall list", e)
}
}
}

Expand Down

0 comments on commit 4958c00

Please sign in to comment.