Skip to content

Commit 5aac189

Browse files
committed
Improve debug logging
- more consistent prefixes in waits - log dynamic config when it's written - log when waits complete, not just when they start
1 parent 890746b commit 5aac189

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

jupyterhub_traefik_proxy/fileprovider.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def _persist_dynamic_config(self):
9292
http.pop(key)
9393
if not http:
9494
dynamic_config.pop("http")
95+
self.log.debug("Writing dynamic config %s", dynamic_config)
9596
self.dynamic_config_handler.atomic_dump(dynamic_config)
9697

9798
async def _setup_traefik_dynamic_config(self):

jupyterhub_traefik_proxy/proxy.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def __init__(self, **kwargs):
139139
dynamic_config = Dict()
140140

141141
traefik_providers_throttle_duration = Unicode(
142-
"0s",
142+
"0.1s",
143143
config=True,
144144
help="""
145145
throttle traefik reloads of configuration.
@@ -300,7 +300,9 @@ async def _check_for_traefik_service(self, routespec, kind):
300300
json.loads(resp.body)
301301
except HTTPClientError as e:
302302
if e.code == 404:
303-
self.log.debug(f"traefik {expected} not yet in {kind}")
303+
self.log.debug(
304+
"Traefik route for %s: %s not yet in %s", routespec, expected, kind
305+
)
304306
return False
305307
self.log.exception(f"Error checking traefik api for {kind} {routespec}")
306308
return False
@@ -312,7 +314,7 @@ async def _check_for_traefik_service(self, routespec, kind):
312314
return True
313315

314316
async def _wait_for_route(self, routespec):
315-
self.log.debug("Waiting for %s to register with traefik", routespec)
317+
self.log.debug("Traefik route for %s: waiting to register", routespec)
316318

317319
async def _check_traefik_dynamic_conf_ready():
318320
"""Check if traefik loaded its dynamic configuration yet"""
@@ -325,10 +327,11 @@ async def _check_traefik_dynamic_conf_ready():
325327

326328
await exponential_backoff(
327329
_check_traefik_dynamic_conf_ready,
328-
f"Traefik route for {routespec} configuration not available",
330+
f"Traefik route for {routespec}: not ready",
329331
scale_factor=1.2,
330332
timeout=self.check_route_timeout,
331333
)
334+
self.log.debug("Treafik route for %s: registered", routespec)
332335

333336
async def _traefik_api_request(self, path):
334337
"""Make an API request to traefik"""
@@ -494,7 +497,6 @@ async def _setup_traefik_dynamic_config(self):
494497
"middlewares": {},
495498
}
496499
}
497-
dynamic_config["http"]
498500
routers = dynamic_config["http"]["routers"]
499501
middlewares = dynamic_config["http"]["middlewares"]
500502
routers["route_api"] = {

0 commit comments

Comments
 (0)