|
|
|
@ -47,15 +47,10 @@ counter_tx_events = Counter(
@@ -47,15 +47,10 @@ counter_tx_events = Counter(
|
|
|
|
|
counter_eos = Counter( |
|
|
|
|
"camtiler_client_eos", |
|
|
|
|
"Count of End of Stream occurrences") |
|
|
|
|
counter_timeout_errors = Counter( |
|
|
|
|
"camtiler_client_timeout_errors", |
|
|
|
|
"Upstream connection timeout errors") |
|
|
|
|
counter_cancelled_errors = Counter( |
|
|
|
|
"camtiler_client_cancelled_errors", |
|
|
|
|
"Upstream connection cancelled errors") |
|
|
|
|
counter_incomplete_read_errors = Counter( |
|
|
|
|
"camtiler_client_incomplete_read_errors", |
|
|
|
|
"Upstream incomplete read errors") |
|
|
|
|
counter_connection_errors = Counter( |
|
|
|
|
"camtiler_client_connection_errors", |
|
|
|
|
"Upstream connection errors", |
|
|
|
|
["error"]) |
|
|
|
|
counter_movement_frames = Counter( |
|
|
|
|
"camtiler_client_movement_frames", |
|
|
|
|
"Frames with movement detected in them") |
|
|
|
@ -147,17 +142,16 @@ async def client_connect(resp):
@@ -147,17 +142,16 @@ async def client_connect(resp):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def client(): |
|
|
|
|
print("Opening upstream connection...") |
|
|
|
|
async with aiohttp.ClientSession() as session: |
|
|
|
|
async with session.get(url) as resp: |
|
|
|
|
while True: |
|
|
|
|
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(connect=5, sock_read=2)) as session: |
|
|
|
|
print("Opening upstream connection to %s" % url) |
|
|
|
|
try: |
|
|
|
|
await client_connect(resp) |
|
|
|
|
except asyncio.TimeoutError: |
|
|
|
|
counter_timeout_errors.inc() |
|
|
|
|
except asyncio.CancelledError: |
|
|
|
|
counter_cancelled_errors.inc() |
|
|
|
|
except asyncio.IncompleteReadError: |
|
|
|
|
counter_incomplete_read_errors.inc() |
|
|
|
|
async with session.get(url) as resp: |
|
|
|
|
await client_connect(resp) |
|
|
|
|
except aiohttp.ClientConnectorError as e: |
|
|
|
|
counter_connection_errors.labels(error=e.strerror).inc() |
|
|
|
|
except asyncio.exceptions.TimeoutError: |
|
|
|
|
counter_connection_errors.labels(error="Timeout").inc() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app = Sanic("lease") |
|
|
|
|