def _make_index_backend(cluster=None): if not cluster: cluster_id = getattr( settings, 'SENTRY_SIMILARITY_INDEX_REDIS_CLUSTER', 'similarity', ) try: cluster = redis.redis_clusters.get(cluster_id) except KeyError: index = DummyIndexBackend() logger.info( 'No redis cluster provided for similarity, using {!r}.'.format( index)) return index return MetricsWrapper( RedisMinHashIndexBackend( cluster, 'sim:1', MinHashSignatureBuilder(16, 0xFFFF), 8, 60 * 60 * 24 * 30, 3, 5000, ), scope_tag_name='project_id', )
def _make_index_backend(cluster, namespace="sim:1"): if isinstance(cluster, six.string_types): cluster_id = cluster try: cluster = redis.redis_clusters.get(cluster_id) except KeyError: index = DummyIndexBackend() logger.info(u"No redis cluster provided for similarity, using {!r}.".format(index)) return index return MetricsWrapper( RedisScriptMinHashIndexBackend( cluster, namespace, MinHashSignatureBuilder(16, 0xFFFF), 8, 60 * 60 * 24 * 30, 3, 5000 ), scope_tag_name=None, )
def _make_index_backend(cluster=None, namespace="sim:1"): if not cluster: cluster_id = getattr(settings, "SENTRY_SIMILARITY_INDEX_REDIS_CLUSTER", "similarity") try: cluster = redis.redis_clusters.get(cluster_id) except KeyError: index = DummyIndexBackend() logger.info( u"No redis cluster provided for similarity, using {!r}.". format(index)) return index return MetricsWrapper( RedisScriptMinHashIndexBackend(cluster, namespace, MinHashSignatureBuilder(16, 0xFFFF), 8, 60 * 60 * 24 * 30, 3, 5000), scope_tag_name=None, )