-
-
Save jolynch/0a6c4bbe78d4907eec9d to your computer and use it in GitHub Desktop.
An example composition of Elasticsearch Clients
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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