You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11-2
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,20 @@
1
1
# Optimizely Ruby SDK Changelog
2
2
3
-
## [Unreleased]
4
-
Changes that have landed but are not yet released.
3
+
## 3.3.0
4
+
September 20th, 2019
5
5
6
6
### New Features:
7
7
- Added non-typed `get_feature_variable` method ([#190](https://github.com/optimizely/ruby-sdk/pull/190)) as a more idiomatic approach to getting values of feature variables.
8
8
- Typed `get_feature_variable` methods will still be available for use.
9
+
- Added support for event batching via the event processor.
10
+
- Events generated by methods like `activate`, `track`, and `is_feature_enabled` will be held in a queue until the configured batch size is reached, or the configured flush interval has elapsed. Then, they will be batched into a single payload and sent to the event dispatcher.
11
+
- To configure event batching, set the `batch_size` and `flush_interval` properties in the `OptimizelyFactory` using `OptimizelyFactory.max_event_batch_size(batch_size, logger)` and `OptimizelyFactory.max_event_flush_interval(flush_interval, logger)` and then create `OptimizelyFactory.custom_instance`.
12
+
- Event batching is enabled by default. `batch_size` defaults to `10`. `flush_interval` defaults to `30000` milliseconds.
13
+
- Added the `close` method representing the process of closing the instance. When `close` is called, any events waiting to be sent as part of a batched event request will be immediately batched and sent to the event dispatcher.
14
+
15
+
### Deprecated
16
+
-`EventBuilder` was deprecated and now we will be using `UserEventFactory` and `EventFactory` to create logEvents.
17
+
-`LogEvent` was deprecated from `Activate` and `Track` notifications in favor of explicit `LogEvent` notification.
Copy file name to clipboardExpand all lines: README.md
+44-1
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,8 @@ You can initialize the Optimizely instance in two ways: directly with a datafile
63
63
skip_json_validation,
64
64
user_profile_service,
65
65
config_manager,
66
-
notification_center
66
+
notification_center,
67
+
event_processor
67
68
)
68
69
```
69
70
@@ -128,6 +129,48 @@ The following properties can be set to override the default configurations for `
128
129
129
130
A notification signal will be triggered whenever a _new_ datafile is fetched and Project Config is updated. To subscribe to these notifications, use the `notification_center.add_notification_listener(Optimizely::NotificationCenter::NOTIFICATION_TYPES[:OPTIMIZELY_CONFIG_UPDATE], @callback)`
130
131
132
+
133
+
#### BatchEventProcessor
134
+
135
+
[BatchEventProcessor](https://github.com/optimizely/ruby-sdk/blob/master/lib/optimizely/event/batch_event_processor.rb) is a batched implementation of the [EventProcessor](https://github.com/optimizely/ruby-sdk/blob/master/lib/optimizely/event/event_processor.rb)
136
+
137
+
* Events passed to the `BatchEventProcessor` are immediately added to a `Queue`.
138
+
139
+
* The `BatchEventProcessor` maintains a single consumer thread that pulls events off of the `Queue` and buffers them for either a configured batch size or for a maximum duration before the resulting `LogEvent` is sent to the `NotificationCenter`.
| `event_queue` | 1000 | `SizedQueue.new(100)` or `Queue.new`. Queues individual events to be batched and dispatched by the executor. Default value is 1000.
159
+
| `event_dispatcher` | nil | Used to dispatch event payload to Optimizely. By default `EventDispatcher.new` will be set.
160
+
| `batch_size` | 10 | The maximum number of events to batch before dispatching. Once this number is reached, all queued events are flushed and sent to Optimizely.
161
+
| `flush_interval` | 30000 ms | Maximum time to wait before batching and dispatching events. In milliseconds.
162
+
| `notification_center` | nil | Notification center instance to be used to trigger any notifications.
163
+
164
+
165
+
#### Close Optimizely
166
+
If you enable event batching, make sure that you call the `close` method, `optimizely.close()`, prior to exiting. This ensures that queued events are flushed as soon as possible to avoid any data loss.
167
+
168
+
**Note:** Because the Optimizely client maintains a buffer of queued events, we recommend that you call `close()` on the Optimizely instance before shutting down your application or whenever dereferencing the instance.
169
+
170
+
| **Method** | **Description**
171
+
| -- | --
172
+
| `close()` | Stops all timers and flushes the event queue. This method will also stop any timers that are happening for the datafile manager.
173
+
131
174
See the Optimizely Full Stack [developer documentation](http://developers.optimizely.com/server/reference/index.html) to learn how to set up your first Full Stack project and use the SDK.
0 commit comments