(server_uri)
return hostname
Make a reasonable hostname for a replset membership event to mention.
Make a reasonable hostname for a replset membership event to mention.
Make a reasonable hostname for a replset membership event to mention .
def extract_hostname_for_event(server_uri):
        """Make a reasonable hostname for a replset membership event to mention."""
        uri = urlsplit(server_uri)
        if '@' in uri.netloc:
            hostname = uri.netloc.split('@')[1].split(':')[0]
        else:
            hostname = uri.netloc.split(':')[0]
        if hostname == 'localhost':
            hostname = datadog_agent.get_hostname()

        return hostname
def extract_hostname_for_event ( server_uri ) : uri = urlsplit ( server_uri ) if '@' in uri . netloc : hostname = uri . netloc . split ( '@' ) [ 1 ] . split ( ':' ) [ 0 ] else : hostname = uri . netloc . split ( ':' ) [ 0 ] if hostname == 'localhost' : hostname = datadog_agent . get_hostname ( ) return hostname