Skip to content

Commit

Permalink
logging improvements around plugin registration
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniszewski committed Feb 3, 2020
1 parent 06015ba commit 3adf18b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion synse_server/discovery/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _register_from_endpoints(ns: str, cfg: dict) -> List[str]:
)
else:
# Search for a port with name 'http'
logger.debug(_('found multiple ports - search for port named "http"'))
logger.debug(_('found multiple ports - searching for port named "http"'))
for p in ports:
logger.debug(_('found port'), subset=i, name=p.name)
if p.name != 'http':
Expand Down
7 changes: 6 additions & 1 deletion synse_server/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,18 @@ def register(self, address: str, protocol: str) -> str:
version=utils.to_dict(ver),
client=c,
)
logger.debug(
_('loaded plugin info'),
id=plugin.id, version=plugin.version, addr=plugin.address, tag=plugin.tag,
)

if plugin.id in self.plugins:
# The plugin has already been registered. There is nothing left to
# do here, so just log and move on.
logger.debug(_('plugin with id already registered - skipping'), id=plugin.id)
else:
self.plugins[plugin.id] = plugin
logger.info(_('successfully registered plugin'), id=plugin.id, tag=plugin.tag)
logger.info(_('successfully registered new plugin'), id=plugin.id, tag=plugin.tag)

self.plugins[plugin.id].mark_active()
return plugin.id
Expand Down Expand Up @@ -162,6 +166,7 @@ def discover(cls) -> List[Tuple[str, str]]:
for address in addresses:
configs.append((address, 'tcp'))

logger.debug(_('found addresses via plugin discovery'), addresses=configs)
return configs

def refresh(self) -> None:
Expand Down

0 comments on commit 3adf18b

Please sign in to comment.