def _default_serializer_for_object(obj, policy): # the insights server expects an 'options' dict for policy # objects, but not for other objects if policy: return {'type': obj.__class__.__name__, 'namespace': namespace(obj.__class__), 'options': {}} else: return {'type': obj.__class__.__name__, 'namespace': namespace(obj.__class__)}
def exponential_reconnection_policy_insights_serializer(policy): return {'type': policy.__class__.__name__, 'namespace': namespace(policy.__class__), 'options': {'base_delay': policy.base_delay, 'max_delay': policy.max_delay, 'max_attempts': policy.max_attempts} }
def token_aware_policy_insights_serializer(policy): return {'type': policy.__class__.__name__, 'namespace': namespace(policy.__class__), 'options': {'child_policy': insights_registry.serialize(policy._child_policy, policy=True), 'shuffle_replicas': policy.shuffle_replicas} }
def wrapper_policy_insights_serializer(policy): return {'type': policy.__class__.__name__, 'namespace': namespace(policy.__class__), 'options': { 'child_policy': insights_registry.serialize(policy._child_policy, policy=True) }}
def host_filter_policy_insights_serializer(policy): return { 'type': policy.__class__.__name__, 'namespace': namespace(policy.__class__), 'options': {'child_policy': insights_registry.serialize(policy._child_policy, policy=True), 'predicate': policy.predicate.__name__} }
def retry_policy_insights_serializer(policy): return {'type': policy.__class__.__name__, 'namespace': namespace(policy.__class__), 'options': {}}
def constant_reconnection_policy_insights_serializer(policy): return {'type': policy.__class__.__name__, 'namespace': namespace(policy.__class__), 'options': {'delay': policy.delay, 'max_attempts': policy.max_attempts} }
def whitelist_round_robin_policy_insights_serializer(policy): return {'type': policy.__class__.__name__, 'namespace': namespace(policy.__class__), 'options': {'allowed_hosts': policy._allowed_hosts} }
def dc_aware_round_robin_policy_insights_serializer(policy): return {'type': policy.__class__.__name__, 'namespace': namespace(policy.__class__), 'options': {'local_dc': policy.local_dc, 'used_hosts_per_remote_dc': policy.used_hosts_per_remote_dc} }
def speculative_execution_policy_insights_serializer(policy): return {'type': policy.__class__.__name__, 'namespace': namespace(policy.__class__), 'options': {}}