55
66
77Prerequisite packages
8- -------
8+ ---------------------
99.. code-block :: python
1010
1111 baseplate>= 2.0 .0
@@ -18,13 +18,13 @@ Prerequisite packages
1818 reddit- v2- events
1919
2020 Prerequisite infrastructure
21- -------
21+ ---------------------------
2222Set up your service to pull down & synchronize experiment configurations from Zookeeper via the Baseplate `live-data watcher sidecar
2323<https://baseplate.readthedocs.io/en/stable/api/baseplate/lib/live_data.html?highlight=sidecar#watcher-daemon> `_ (minimum v2.4.13).
2424You'll have to make sure that your service is authorized to fetch the appropriate secret from Vault.
2525
26- Prerequisite configuration:
27- -------
26+ Prerequisite configuration
27+ ---------------------------
2828Setup :code: `reddit-experiments ` in your application's configuration file:
2929
3030.. code-block :: ini
@@ -50,7 +50,7 @@ Setup :code:`reddit-experiments` in your application's configuration file:
5050
5151
5252 Integrate :code: `reddit-experiments ` into Baseplate service
53- -------
53+ -----------------------------------------------------------
5454In your service's initialization process, add a :code: `decider ` instance to baseplate's context:
5555(Note the use of the :code: `ExperimentLogger `, which is used to publish exposure V2 events,
5656an example can be seen `here <https://github.snooguts.net/reddit/reddit-service-graphql/blob/3734b51732c29d07eef32aced86677cce5064dbb/graphql-py/graphql_api/events/utils.py#L205 >`_)
@@ -78,11 +78,11 @@ an example can be seen `here <https://github.snooguts.net/reddit/reddit-service-
7878 baseplate.configure_context({
7979 " decider" : DeciderClient(
8080 prefix = " experiments." ,
81- event_logger = EventLogger ,
81+ event_logger = ExperimentLogger ,
8282 request_field_extractor = my_field_extractor # optional
8383 })
8484
85- Make sure :code:`edge_context ` is accessible on :code:`request` object like so:
85+ Make sure :code:`EdgeContext ` is accessible on :code:`request` object like so:
8686
8787.. code- block:: python
8888
@@ -108,14 +108,15 @@ Make sure :code:`edge_context` is accessible on :code:`request` object like so:
108108
109109 # Customized fields can be defined below to be extracted from a baseplate request
110110 # and will override above edge_context fields.
111+ # These fields may be used for targeting.
111112
112113 def my_field_extractor(request):
113114 # an example of customized baseplate request field extractor:
114115 return {" foo" : request.headers.get(" Foo" ), " bar" : " something" }
115116
116117
117- Usage
118- ------ -
118+ Basic Usage
119+ ---------- -
119120Use the attached :py:class :`~ reddit_decider.Decider` object in request to call
120121:code:`decider.get_variant()` (automatically sends an expose event)::
121122
@@ -130,20 +131,25 @@ or optionally, if manual exposure is necessary, use::
130131 ...
131132 request.decider.expose(experiment_name = ' experiment_name' , variant_name = variant)
132133
133- Configuration Classes
134- ------------ -
135134
136- .. autofunction:: decider_client_from_config
135+ Decider API
136+ ---------- -
137+
138+ .. autoclass:: Decider
139+ :members:
137140
141+ Configuration Class
142+ ------------------ -
138143
139144.. autoclass:: DeciderClient
140145
146+ Configuration function
147+ ----------------------
141148
142- .. autoclass :: DeciderContextFactory
149+ .. autofunction :: decider_client_from_config
143150
144151
145- Decider API
146- ------ -
152+ Configuration Context Factory
153+ ---------------------------- -
147154
148- .. autoclass:: Decider
149- :members:
155+ .. autoclass:: DeciderContextFactory
0 commit comments