Skip to content

Instantly share code, notes, and snippets.

@jolynch
Last active August 29, 2015 14:09
Show Gist options
  • Save jolynch/0a6c4bbe78d4907eec9d to your computer and use it in GitHub Desktop.
Save jolynch/0a6c4bbe78d4907eec9d to your computer and use it in GitHub Desktop.
An example composition of Elasticsearch Clients
# Create base clients
PyESClient = ReviewSearchClient(query_timeout_s=0.300)
OfficialClient = OfficialReviewSearchClient(query_timeout_s=0.300)
OfficialClientCloud = OfficialReviewSearchClient(
service_name='elasticsearch-cloud',
query_timeout_s=0.300
)
# Compose base clients together
ComposedReviewSearchClient = SlowQueryLogger(
log_threshold_ms=500,
client=Tee(
toggle='toggles.reviews.enable_dark_launch',
client=Mux(
fallback=ClientWithToggle(
client=PyESClient,
toggle='toggles.reviews.use_pyes_client' # set to 0.50
),
client_configs=[
ClientWithToggle(
client=OfficialClient,
toggle='toggles.reviews.use_official_client' # set to 0.50
)
])
tee_client=OfficialClientCloud
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment