Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ping_handler(event, context):
- print(url)
- failures=0
- for i in range(3):
- res = app_check(url)
- print(response)
- if "Exception:" in res
- or res.status_code > 399:
- failures+=1
- print(failures)
- if failures < 2 :
- rT = res.elapsed.total_seconds()
- metric = builder.create_metric(
- service, 'Response Time', 'url',
- url, 'Seconds', rt
- )
- builder.add_custom_metric(metric)
- else:
- if res.raise_for_status() is None:
- raise Exception("Check Failed")
- else:
- res.raise_for_status
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement