예제 #1
0
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__)}
예제 #2
0
 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}
             }
예제 #3
0
 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}
             }
예제 #4
0
 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)
             }}
예제 #5
0
 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__}
     }
예제 #6
0
 def retry_policy_insights_serializer(policy):
     return {'type': policy.__class__.__name__,
             'namespace': namespace(policy.__class__),
             'options': {}}
예제 #7
0
 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}
             }
예제 #8
0
 def whitelist_round_robin_policy_insights_serializer(policy):
     return {'type': policy.__class__.__name__,
             'namespace': namespace(policy.__class__),
             'options': {'allowed_hosts': policy._allowed_hosts}
             }
예제 #9
0
 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}
             }
예제 #10
0
 def speculative_execution_policy_insights_serializer(policy):
     return {'type': policy.__class__.__name__,
             'namespace': namespace(policy.__class__),
             'options': {}}