Introduce error.capacity states_key for InsufficientInstanceCapacity error
We want to handle the "InsufficientInstanceCapacity" error different than other "error.unknown" errors in our monitoring/alerting system. With this change, it would produce a "error.capacity" instead of "error.unknown". Change-Id: Id3a49d4b2d4b4733f801e65df69b505e913985a7
This commit is contained in:
parent
42f9100d82
commit
aa113be19f
|
@ -1120,6 +1120,12 @@ class AwsAdapter(statemachine.Adapter):
|
||||||
# Re-raise as a quota exception so that the
|
# Re-raise as a quota exception so that the
|
||||||
# statemachine driver resets quota.
|
# statemachine driver resets quota.
|
||||||
raise exceptions.QuotaException(str(error))
|
raise exceptions.QuotaException(str(error))
|
||||||
|
if (error.response['Error']['Code'] ==
|
||||||
|
'InsufficientInstanceCapacity'):
|
||||||
|
# Re-raise as CapacityException so it would have
|
||||||
|
# "error.capacity" statsd_key, which can be handled
|
||||||
|
# differently than "error.unknown"
|
||||||
|
raise exceptions.CapacityException(str(error))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def _createInstance(self, label, image_external_id,
|
def _createInstance(self, label, image_external_id,
|
||||||
|
|
|
@ -31,6 +31,10 @@ class LaunchKeyscanException(Exception):
|
||||||
statsd_key = 'error.keyscan'
|
statsd_key = 'error.keyscan'
|
||||||
|
|
||||||
|
|
||||||
|
class CapacityException(Exception):
|
||||||
|
statsd_key = 'error.capacity'
|
||||||
|
|
||||||
|
|
||||||
class BuilderError(RuntimeError):
|
class BuilderError(RuntimeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue