Skip to content

Commit e0e01a0

Browse files
rashidspaliabbasrizvi
authored andcommitted
chore: Updated change log and readme. (#199)
1 parent 2d0b8b3 commit e0e01a0

File tree

2 files changed

+55
-3
lines changed

2 files changed

+55
-3
lines changed

CHANGELOG.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# Optimizely Ruby SDK Changelog
22

3-
## [Unreleased]
4-
Changes that have landed but are not yet released.
3+
## 3.3.0
4+
September 20th, 2019
55

66
### New Features:
77
- 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.
88
- 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.
918

1019
## 3.2.0
1120
July 25th, 2019

README.md

+44-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ You can initialize the Optimizely instance in two ways: directly with a datafile
6363
skip_json_validation,
6464
user_profile_service,
6565
config_manager,
66-
notification_center
66+
notification_center,
67+
event_processor
6768
)
6869
```
6970
@@ -128,6 +129,48 @@ The following properties can be set to override the default configurations for `
128129
129130
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)`
130131
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`.
140+
141+
##### Use BatchEventProcessor
142+
~~~~~~
143+
event_processor = Optimizely::BatchEventProcessor.new(
144+
event_queue: SizedQueue.new(10),
145+
event_dispatcher: event_dispatcher,
146+
batch_size: 10,
147+
flush_interval: 30000,
148+
logger: logger,
149+
notification_center: notification_center
150+
)
151+
~~~~~~
152+
153+
#### Advanced configuration
154+
The following properties can be used to customize the `BatchEventProcessor` configuration.
155+
156+
| **Property Name** | **Default Value** | **Description**
157+
| -- | -- | --
158+
| `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+
131174
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.
132175
133176
## Development

0 commit comments

Comments
 (0)