Skip to content

Commit f3e1c1d

Browse files
author
Marko Petzold
committed
refactor: Remove redundant logging statements in RouterClusterMonitor, WebClusterMonitor, PendingAuthCryptosign, and RouterController
1 parent c1ba624 commit f3e1c1d

File tree

4 files changed

+8
-68
lines changed

4 files changed

+8
-68
lines changed

crossbar/master/cluster/routercluster.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -522,14 +522,6 @@ def _update_workergroup_transports(self):
522522
desired_principals.update(rlink_principals)
523523
desired_principals.update(proxy_principals)
524524

525-
self.log.info(
526-
'{func} Preparing hot-reload for transport {transport_id}: rlinks={rlink_authids}, proxies={proxy_authids}, total={total_authids}',
527-
func=hltype(self._update_workergroup_transports),
528-
transport_id=hlid(transport_id),
529-
rlink_authids=list(rlink_principals.keys()),
530-
proxy_authids=list(proxy_principals.keys()),
531-
total_authids=list(desired_principals.keys()))
532-
533525
# Hot-reload principals without restarting transport
534526
# This avoids dropping connections and changing the port
535527
# With hot-reload, we can just push the desired state directly
@@ -542,24 +534,15 @@ def _update_workergroup_transports(self):
542534
continue
543535

544536
try:
545-
self.log.info(
546-
'{func} Calling update_router_transport_principals for {transport_id} with {count} principals',
547-
func=hltype(self._update_workergroup_transports),
548-
transport_id=hlid(transport_id),
549-
count=len(desired_principals))
550-
551-
result = yield self._manager._session.call(
537+
yield self._manager._session.call(
552538
'crossbarfabriccenter.remote.router.update_router_transport_principals',
553539
str(node_oid), worker_name, transport_id, desired_principals)
554540

555541
self.log.info(
556-
'{func} Successfully hot-updated transport {transport_id} principals on worker {worker_name}: '
557-
'methods={auth_methods}, count={count}',
542+
'{func} Successfully hot-updated transport {transport_id} principals: {principal_authids}',
558543
func=hltype(self._update_workergroup_transports),
559544
transport_id=hlid(transport_id),
560-
worker_name=hlid(worker_name),
561-
auth_methods=result.get('auth_methods_updated', result.get('authenticators_updated', [])),
562-
count=hlval(result.get('principal_count', 0), color='green'))
545+
principal_authids=list(desired_principals.keys()))
563546
except Exception as e:
564547
self.log.error(
565548
'{func} Failed to hot-update transport {transport_id} principals: {error}',

crossbar/master/cluster/webcluster.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def _check_and_apply(self):
204204
worker_options)
205205
worker = yield self._manager._session.call(
206206
'crossbarfabriccenter.remote.node.get_worker', node_oid, worker_id)
207+
207208
self.log.info(
208209
'{func} Web cluster worker {worker_id} started on node {node_oid} [{worker_started}]',
209210
func=hltype(self._check_and_apply),
@@ -409,8 +410,7 @@ def _check_and_apply(self):
409410
arealm_oid=hlid(arealm_oid),
410411
workergroup_oid=hlid(arealm.workergroup_oid))
411412

412-
wk = (node_oid, worker['id'])
413-
workers[wk] = worker
413+
workers[(node_oid, worker['id'])] = worker
414414
else:
415415
self.log.warn('{func} Web cluster node {node_oid} not running [status={status}]',
416416
func=hltype(self._check_and_apply),
@@ -437,19 +437,6 @@ def _check_and_apply(self):
437437
self.log.failure()
438438

439439
self._workers = workers
440-
for node_oid, worker_id in self._workers:
441-
worker = self._workers[(node_oid, worker_id)]
442-
if worker:
443-
status = worker['status'].upper()
444-
else:
445-
status = 'MISSING'
446-
self.log.info(
447-
'{func} webcluster {webcluster_oid} worker {worker_id} on node {node_oid} has status {status}',
448-
func=hltype(self._check_and_apply),
449-
worker_id=hlid(worker_id),
450-
node_oid=hlid(node_oid),
451-
webcluster_oid=hlid(self._webcluster_oid),
452-
status=hlval(status))
453440

454441
if is_running_completely:
455442
color = 'green'

crossbar/router/auth/cryptosign.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,6 @@ def hello(self, realm: str, details: HelloDetails) -> Union[Accept, Deny, Challe
291291
with self._principals_lock:
292292
principals = self._config.get('principals', {})
293293

294-
self.log.info(
295-
'{func} Looking up authid "{authid}" in principals database with {count} entries: {available_authids}',
296-
func=hltype(self.hello),
297-
authid=hlid(self._authid),
298-
count=len(principals),
299-
available_authids=list(principals.keys()))
300-
301294
if self._authid in principals:
302295
principal = principals[self._authid]
303296
if pubkey and (pubkey not in principal['authorized_keys']):

crossbar/worker/router.py

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,12 +1109,6 @@ def update_router_transport_principals(self, transport_id, principals, details=N
11091109
:returns: Dict with update status and principal count.
11101110
:rtype: dict
11111111
"""
1112-
self.log.info(
1113-
'{method} Hot-updating principals for transport "{transport_id}" with {count} principals',
1114-
transport_id=hlid(transport_id),
1115-
count=hlval(len(principals), color='green'),
1116-
method=hltype(self.update_router_transport_principals))
1117-
11181112
if transport_id not in self.transports:
11191113
emsg = 'Cannot update transport principals: no transport with ID "{}"'.format(transport_id)
11201114
self.log.error(emsg)
@@ -1139,44 +1133,27 @@ def update_router_transport_principals(self, transport_id, principals, details=N
11391133
# Update the principals in the transport factory's auth config
11401134
# This config is what gets passed to PendingAuthCryptosign instances
11411135
if 'auth' not in factory._config:
1142-
self.log.warn(
1143-
'{method} Transport "{transport_id}" has no auth configuration in factory._config. Factory config keys: {config_keys}',
1144-
transport_id=hlid(transport_id),
1145-
config_keys=list(factory._config.keys()) if isinstance(factory._config, dict) else type(factory._config),
1146-
method=hltype(self.update_router_transport_principals))
11471136
emsg = 'Transport "{}" has no auth configuration'.format(transport_id)
1137+
self.log.error(emsg)
11481138
raise ApplicationError('crossbar.error.invalid_configuration', emsg)
11491139

11501140
auth_config = factory._config['auth']
11511141

1152-
self.log.info(
1153-
'{method} Transport "{transport_id}" auth config has methods: {auth_methods}',
1154-
transport_id=hlid(transport_id),
1155-
auth_methods=list(auth_config.keys()) if isinstance(auth_config, dict) else type(auth_config),
1156-
method=hltype(self.update_router_transport_principals))
1157-
11581142
updated_count = 0
11591143
updated_methods = []
11601144

11611145
# Update principals for all cryptosign-* auth methods
11621146
for authmethod in ['cryptosign-proxy']:
11631147
if authmethod in auth_config:
1164-
old_principals = auth_config[authmethod].get('principals', {})
1165-
self.log.info(
1166-
'{method} Updating "{authmethod}" - before: {old_authids}, after: {new_authids}',
1167-
authmethod=hlid(authmethod),
1168-
old_authids=list(old_principals.keys()) if isinstance(old_principals, dict) else 'N/A',
1169-
new_authids=list(principals.keys()),
1170-
method=hltype(self.update_router_transport_principals))
1171-
11721148
auth_config[authmethod]['principals'] = principals
11731149
updated_count += 1
11741150
updated_methods.append(authmethod)
11751151

11761152
self.log.info(
1177-
'{method} Updated auth method "{authmethod}" in transport "{transport_id}" with principals: {principal_authids}',
1153+
'{method} Updated auth method "{authmethod}" in transport "{transport_id}" with {count} principals: {principal_authids}',
11781154
authmethod=hlid(authmethod),
11791155
transport_id=hlid(transport_id),
1156+
count=len(principals),
11801157
principal_authids=hlval(list(principals.keys()), color='green'),
11811158
method=hltype(self.update_router_transport_principals))
11821159

0 commit comments

Comments
 (0)