Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
381 commits
Select commit Hold shift + click to select a range
e84fbe7
add test for Unicode in feature store serialization
eli-darkly Jan 15, 2019
dd61579
Merge branch 'master' into eb/ch28430/consul
eli-darkly Jan 15, 2019
8920923
fill in the rest of the Consul implementation
eli-darkly Jan 15, 2019
21c79fe
minor doc fixes
eli-darkly Jan 15, 2019
7ea110f
rm debugging
eli-darkly Jan 15, 2019
5136187
fix initialized check
eli-darkly Jan 15, 2019
46ebc1f
improve feature store tests + minor Redis fixes
eli-darkly Jan 15, 2019
2a4064c
Merge pull request #95 from launchdarkly/eb/feature-store-unicode
eli-darkly Jan 16, 2019
7691723
Merge pull request #96 from launchdarkly/eb/ch28430/consul
eli-darkly Jan 16, 2019
97ee2da
test fix: we can't use Unicode in flag keys anyway
eli-darkly Jan 16, 2019
3061a42
Merge branch 'master' into eb/better-feature-store-tests
eli-darkly Jan 16, 2019
be4523c
Merge branch 'master' into eb/ch22514/docs
eli-darkly Jan 16, 2019
621ef03
Merge pull request #90 from launchdarkly/eb/ch22514/docs
eli-darkly Jan 16, 2019
dbbd033
Merge branch 'master' into eb/better-feature-store-tests
eli-darkly Jan 16, 2019
21a505e
test fix
eli-darkly Jan 16, 2019
9dcbda8
Merge pull request #97 from launchdarkly/eb/better-feature-store-tests
eli-darkly Jan 17, 2019
784eb07
misc prerelease fixes
eli-darkly Jan 17, 2019
a6490eb
merge from public after release
LaunchDarklyCI Jan 18, 2019
e9b06c6
fix doc comments
eli-darkly Jan 18, 2019
7812be4
merge from public after release
LaunchDarklyCI Jan 18, 2019
6389a26
add YARD config so our docs show up correctly everywhere
eli-darkly Jan 18, 2019
3406a03
don't need markup-provider option
eli-darkly Jan 18, 2019
2175108
Merge pull request #98 from launchdarkly/eb/ch17821/yard-config
eli-darkly Jan 18, 2019
76fa71e
merge from public after release
LaunchDarklyCI Jan 18, 2019
207e8fd
Merge branch 'master' into eb/no-faraday
eli-darkly Jan 29, 2019
d38973a
rm obsolete proxy param
eli-darkly Jan 29, 2019
0405d3d
Merge pull request #92 from launchdarkly/eb/no-faraday
eli-darkly Jan 29, 2019
def22fc
remove net-http-persistent
eli-darkly Jan 31, 2019
f5ef9a4
fix concurrent-ruby usage that breaks on Windows
eli-darkly Jan 31, 2019
e725a2c
Merge pull request #99 from launchdarkly/eb/ch30984/no-http-persistent
eli-darkly Feb 1, 2019
d4081a9
Merge pull request #100 from launchdarkly/eb/ch30999/atomic-value
eli-darkly Feb 1, 2019
9b4d75b
add pipeline and clean up with with rm_rf instead of rm
hroederld Feb 4, 2019
09ee839
Merge pull request #101 from launchdarkly/hr/azure2
hroederld Feb 4, 2019
eb4ad97
fix highlight blocks
hroederld Feb 4, 2019
d1190f5
Merge pull request #102 from launchdarkly/hr/blockfix
hroederld Feb 4, 2019
4aa6272
Hr/azure3 (#103)
hroederld Feb 5, 2019
fd143d7
add dynamo (#104)
hroederld Feb 5, 2019
e8860ba
Merge branch 'master' of github.com:launchdarkly/ruby-client
eli-darkly Feb 14, 2019
6a20ff1
add experimentation event overrides for rules and fallthrough
eli-darkly Feb 22, 2019
12f541a
warn & don't send event if identify or track has no valid user
eli-darkly Feb 22, 2019
2800db8
include user in prereq flag events
eli-darkly Feb 22, 2019
47106d9
rm unnecessary logic
eli-darkly Feb 26, 2019
763a222
more factory methods
eli-darkly Feb 26, 2019
0d0086b
Merge pull request #107 from launchdarkly/eb/ch32577/prereq-event-user
eli-darkly Mar 1, 2019
0cbb8cd
Merge branch 'experiment' into eb/ch32304/experiment
eli-darkly Mar 2, 2019
70cacc9
Merge pull request #106 from launchdarkly/eb/ch32176-ch31956/bad-user
eli-darkly Mar 5, 2019
1c7a349
Merge pull request #105 from launchdarkly/eb/ch32304/experiment
eli-darkly Mar 5, 2019
4c23461
update readme to refer to docs
bwoskow-ld Mar 6, 2019
43d39c0
Merge pull request #108 from launchdarkly/bw/ch33438/update-readme-to…
bwoskow-ld Mar 8, 2019
0f91442
Merge commit '72ba633b4f9b34507b5aaad61d0e0541e83df3ad'
eli-darkly Mar 13, 2019
232f419
add Ruby 2.6.2 to CI
eli-darkly Mar 20, 2019
20d109b
fix missing require for net/http
eli-darkly Mar 20, 2019
9e218c2
Merge pull request #109 from launchdarkly/eb/ch34549/net-http-name-error
eli-darkly Mar 21, 2019
ef0f819
merge from public after release
LaunchDarklyCI Mar 21, 2019
651dc37
stringify built-in user attributes in events, and secondary key for e…
eli-darkly Mar 28, 2019
da15bdd
make const names consistent
eli-darkly Mar 28, 2019
ecf18b2
Merge pull request #110 from launchdarkly/eb/ch35206/secondary-string
eli-darkly Mar 29, 2019
3b6bde7
merge from public after release
LaunchDarklyCI Mar 29, 2019
37f9757
Merge pull request #111 from launchdarkly/eb/ch34550/ruby-2.6
eli-darkly Apr 9, 2019
260bd1b
support metric value with track()
eli-darkly Apr 13, 2019
703ffe5
update method description
eli-darkly Apr 17, 2019
8cd7615
Merge pull request #112 from launchdarkly/eb/ch32304/metric-value
eli-darkly Apr 17, 2019
4bc671b
applying markdown templates and updating repository url references
bwoskow-ld May 6, 2019
a56ee20
Cleaning up markdown files
bwoskow-ld May 7, 2019
2bafe25
Merge pull request #114 from launchdarkly/bw/ch36771/applying-markdow…
eli-darkly May 9, 2019
962e729
allow skipping database tests
eli-darkly May 9, 2019
e044e81
Merge pull request #116 from launchdarkly/eb/ch37610/skip-db-tests
eli-darkly May 9, 2019
ca2f8ed
merge from public after release
LaunchDarklyCI May 10, 2019
f32b9c6
Updating the package name (#115)
bwoskow-ld May 13, 2019
650d24c
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
bwoskow-ld May 13, 2019
746ebda
merge from public after release
LaunchDarklyCI May 13, 2019
8defb30
bump ld-eventsource version for stream logging fix
eli-darkly Jul 11, 2019
e7d27e2
Merge pull request #117 from launchdarkly/eb/ch40932/ioerror-log
eli-darkly Jul 11, 2019
8707138
merge from public after release
LaunchDarklyCI Jul 11, 2019
ed0c110
Merge branch 'master' of github.com:launchdarkly/ruby-client
eli-darkly Jul 23, 2019
f1e5b38
merge from public after release
LaunchDarklyCI Jul 23, 2019
c1aeaa3
use YAML.safe_load
eli-darkly Jul 24, 2019
f8aac44
add unit test and temporarily revert fix to demonstrate failure
eli-darkly Jul 24, 2019
8f48060
restore fix
eli-darkly Jul 24, 2019
b5af713
Merge pull request #118 from launchdarkly/eb/ch44118/safe-yaml
eli-darkly Jul 24, 2019
8fa005f
add comment about not using FileDataSource in production
eli-darkly Jul 24, 2019
6a89b0f
Merge pull request #119 from launchdarkly/eb/file-data-warning
eli-darkly Jul 24, 2019
c1bcd04
merge from public after release
LaunchDarklyCI Jul 24, 2019
bb543ad
merge from public after release
LaunchDarklyCI Jul 25, 2019
963e4eb
drop events if inbox is full
eli-darkly Jul 25, 2019
26933ab
Merge pull request #120 from launchdarkly/eb/ch42975/event-bottleneck
eli-darkly Jul 26, 2019
039efed
merge from public after release
LaunchDarklyCI Aug 5, 2019
77acf35
Merge branch 'master' into experiment
eli-darkly Aug 19, 2019
f0581a0
update doc comment for track with metric_value
eli-darkly Aug 19, 2019
c4c2cc1
Merge branch 'master' of github.com:launchdarkly/ruby-client
eli-darkly Aug 19, 2019
c742fda
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
eli-darkly Aug 19, 2019
f8622a7
Merge pull request #121 from launchdarkly/eb/ch32304/track-comment
eli-darkly Aug 19, 2019
162b0fe
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
eli-darkly Aug 19, 2019
032cd5e
Merge branch 'master' into experiment
eli-darkly Aug 20, 2019
1b25d98
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
eli-darkly Aug 20, 2019
e3bd340
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
eli-darkly Aug 29, 2019
db27402
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
eli-darkly Nov 1, 2019
62518e4
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
bwoskow-ld Nov 7, 2019
7620721
don't let user fall outside of last bucket in rollout
eli-darkly Dec 30, 2019
fbf8eb9
refactor evaluation logic and move it out of the main namespace
eli-darkly Jan 2, 2020
45ea437
comments
eli-darkly Jan 2, 2020
575352c
fix type coercion behavior
eli-darkly Jan 2, 2020
62548d1
make type coercion behavior consistent with earlier versions for now
eli-darkly Jan 2, 2020
fd1d837
whitespace
eli-darkly Jan 2, 2020
3c52897
break up Evaluator tests further
eli-darkly Jan 3, 2020
d068336
make EvaluationReason an immutable class
eli-darkly Jan 3, 2020
4bf9abc
FrozenError doesn't exist in older Ruby, use more general RuntimeError
eli-darkly Jan 3, 2020
d8f5263
precompute evaluation reasons when we receive a flag
eli-darkly Jan 3, 2020
4ffd4fc
rm unused
eli-darkly Jan 3, 2020
bc24928
Merge branch 'eb/ch60312/reason-type' into eb/ch60312/precompute-reasons
eli-darkly Jan 3, 2020
365dddc
rename FeatureStore to DataStore
eli-darkly Jan 3, 2020
38493b9
remove references to UpdateProcessor (now DataSource)
eli-darkly Jan 3, 2020
4abded2
Merge pull request #122 from launchdarkly/eb/ch43307/bucketing-fix
eli-darkly Jan 7, 2020
0c90251
merge from public after release
LaunchDarklyCI Jan 7, 2020
10620a9
Merge branch 'master' into eb/ch60309/evaluator
eli-darkly Jan 9, 2020
4a38bc5
Merge pull request #123 from launchdarkly/eb/ch60309/evaluator
eli-darkly Jan 9, 2020
d4b1738
Merge pull request #124 from launchdarkly/eb/ch60312/reason-type
eli-darkly Jan 9, 2020
a34f2da
Merge branch 'master' into 6.0
eli-darkly Jan 9, 2020
ae89808
Merge pull request #125 from launchdarkly/eb/ch60312/precompute-reasons
eli-darkly Jan 9, 2020
8b78a4f
Merge pull request #126 from launchdarkly/eb/ch60407/rename-intfs
eli-darkly Jan 10, 2020
1cfcd52
add event payload ID header
eli-darkly Jan 15, 2020
640387c
Merge pull request #128 from launchdarkly/eb/ch61092/event-payload-id
eli-darkly Jan 15, 2020
5e91fe0
merge from public after release
LaunchDarklyCI Jan 15, 2020
abf83e7
Merge branch 'master' into 6.0
eli-darkly Jan 18, 2020
9865a98
(6.0) drop support for old Ruby versions
eli-darkly Jan 18, 2020
bb0d3b1
add Ruby version constraint to gemspec
eli-darkly Jan 23, 2020
65d8bb5
Merge pull request #129 from launchdarkly/eb/ch62102/old-rubies
eli-darkly Feb 3, 2020
4aaf75e
remove Rake dependency
eli-darkly Mar 9, 2020
441a195
update ld-eventsource to 1.0.2 which doesn't have Rake dependency
eli-darkly Mar 10, 2020
df631a7
Merge pull request #131 from launchdarkly/eb/ch68263/no-rake
eli-darkly Mar 10, 2020
602c5e6
implement diagnostic events in Ruby (#130)
eli-darkly Mar 10, 2020
b6566e2
merge from public after release
LaunchDarklyCI Mar 10, 2020
ddfbd17
update ruby-eventsource to 1.0.3 for backoff bug
eli-darkly Mar 18, 2020
4d6f9b5
Merge pull request #132 from launchdarkly/eb/ch69559/eventsource-fix
eli-darkly Mar 18, 2020
b53a212
merge from public after release
LaunchDarklyCI Mar 18, 2020
1fe77bb
fix incorrect initialization of EventProcessor
eli-darkly Mar 27, 2020
87a3f35
Merge pull request #133 from launchdarkly/eb/ch71287/broken-events
eli-darkly Mar 27, 2020
a4280d7
merge from public after release
LaunchDarklyCI Mar 27, 2020
6f0e1e5
remove install-time openssl check that breaks if you don't have rake
eli-darkly Apr 27, 2020
e35f8ab
treat comparison with wrong data type as a non-match, not an exceptio…
eli-darkly Apr 27, 2020
3e55dc4
fail fast for nil SDK key when appropriate
eli-darkly Apr 27, 2020
93112f5
Merge pull request #135 from launchdarkly/eb/ch74874/remove-openssl-c…
eli-darkly Apr 27, 2020
78e7496
Merge pull request #136 from launchdarkly/eb/ch73982/nil-sdk-key
eli-darkly Apr 27, 2020
dcacf1c
merge from public after release
LaunchDarklyCI Apr 27, 2020
ad7cd7f
tolerate nil value for user.custom (#137)
eli-darkly May 4, 2020
3b152d7
merge from public after release
LaunchDarklyCI May 4, 2020
4ca5ad3
Only shutdown the Redis pool if it is owned by the SDK (#158)
jacobthemyth May 27, 2020
60279fe
Merge branch 'contrib' of github.com:launchdarkly/ruby-server-sdk
eli-darkly May 27, 2020
06d55d5
improve doc comment
eli-darkly May 27, 2020
07f202f
merge from public after release
LaunchDarklyCI May 27, 2020
77bf917
remove support for indirect/patch and indirect/put (#138)
eli-darkly Jun 27, 2020
cf7c8a7
update to json 2.3.1 (#139)
apache-hb Nov 9, 2020
3d351a6
merge from public after release
LaunchDarklyCI Nov 9, 2020
ba28493
Merge branch 'master' into 6.0
eli-darkly Nov 17, 2020
0594a08
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
eli-darkly Jan 6, 2021
4cc6d9c
add publication of API docs on GitHub Pages (#143)
eli-darkly Jan 6, 2021
5831aa6
try fixing release metadata
eli-darkly Jan 20, 2021
3396234
merge from public after release
LaunchDarklyCI Jan 20, 2021
cc78bba
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
eli-darkly Jan 20, 2021
d4eb5b6
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk-priv…
bwoskow-ld Jan 20, 2021
3214f71
update the default base url (#144)
bwoskow-ld Jan 20, 2021
557d2c4
revert renames of feature_store & update_processor
eli-darkly Jan 21, 2021
d2b5a3c
Merge pull request #145 from launchdarkly/eb/ch98642/revert-intf-rename
eli-darkly Jan 21, 2021
97d2ca0
[ch92483] Use http gem and add socket factory support (#142)
hroederld Jan 22, 2021
c769011
update dependencies and add CI for ruby 3 (#141)
apache-hb Jan 25, 2021
91692ca
reference eventsource 2.0 in gemspec
hroederld Jan 26, 2021
ad0c4f2
add 5.x releasable branch for releaser
hroederld Jan 26, 2021
d76a76f
merge from public after release
LaunchDarklyCI Jan 26, 2021
aa10bba
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
eli-darkly Jan 26, 2021
567f54e
use Ruby 2.6.6 in releases
eli-darkly Jan 26, 2021
a092048
Merge pull request #146 from launchdarkly/eb/ch99445/release-ruby-ver…
eli-darkly Jan 26, 2021
ab83620
merge from public after release
LaunchDarklyCI Jan 26, 2021
cc18b1f
Merge github.com:launchdarkly/ruby-server-sdk
hroederld Jan 26, 2021
efec41f
Removed the guides link
bwoskow-ld Feb 3, 2021
7601ec7
[ch99757] add alias method (#147)
hroederld Feb 4, 2021
819c499
merge from public after release
LaunchDarklyCI Feb 4, 2021
162c596
don't send event for nil user evaluation
eli-darkly Feb 6, 2021
3b55709
remove lockfile (#148)
hroederld Feb 6, 2021
110b7c4
Merge branch 'master' into eb/ch100050/no-event-for-nil-user
eli-darkly Feb 6, 2021
e7f4aaa
rm redundant nil check
eli-darkly Feb 6, 2021
bd925f9
Merge pull request #149 from launchdarkly/eb/ch100050/no-event-for-ni…
eli-darkly Feb 6, 2021
c0be90f
merge from public after release
LaunchDarklyCI May 27, 2021
0452cd9
Experiment Allocation Changes (#150)
ld-kyee May 14, 2021
4418cce
Use camelCase for JSON property names (#151)
samstokes Jun 15, 2021
4c2fd31
fixing ruby logic causing ih failures (#152)
ld-kyee Jun 16, 2021
ffda3a2
merge from public after release
LaunchDarklyCI Jun 17, 2021
03dd676
add log warning for missing user key (#153)
eli-darkly Jul 14, 2021
0b86b1b
merge from public after release
Jul 15, 2021
6e5a76c
Merge branch 'master' of github.com:launchdarkly/ruby-server-sdk
eli-darkly Jul 23, 2021
ea70f09
merge from public after release
Jul 23, 2021
0de2cab
diagnostic events should respect HTTPS_PROXY (#154)
bwoskow-ld Aug 6, 2021
6bfb030
minor test simplification (#155)
bwoskow-ld Aug 6, 2021
2a7e0fb
merge from public after release
Aug 6, 2021
57d8eae
allow higher minor versions of json and http gems
eli-darkly Aug 10, 2021
f23c075
Merge pull request #156 from launchdarkly/eb/ch118053/dependency-cons…
eli-darkly Aug 10, 2021
e1d7e83
allow v5.x of http gem (#157)
eli-darkly Aug 10, 2021
d6b7c43
use Bundler 2.2.10 + modernize CI config (#158)
eli-darkly Aug 11, 2021
9272882
merge from public after release
Aug 11, 2021
3891054
enable verbose rspec output
eli-darkly Sep 20, 2021
483799f
fix socket factory tests
eli-darkly Sep 20, 2021
b57c6f4
restore log suppression
eli-darkly Sep 20, 2021
f9f0060
Merge pull request #160 from launchdarkly/eb/ch123138/fix-tests
eli-darkly Sep 21, 2021
dc13eee
Replacing deprecated circleci image usage (#159)
bwoskow-ld Sep 21, 2021
4ff45fc
use Releaser v2 config (#161)
eli-darkly Sep 23, 2021
635b7f8
Updates docs URLs
ember-stevens Sep 24, 2021
fbbe4e6
Update lib/ldclient-rb/ldclient.rb
ember-stevens Sep 26, 2021
e14ac76
Merge pull request #162 from launchdarkly/emberstevens/sc-118589/url-…
ember-stevens Sep 27, 2021
7e2efc8
remove reliance on git in gemspec (#163)
keelerm84 Oct 8, 2021
8331058
use ruby-eventsource 2.1.1 for fix of sc-123850 and sc-125504 (#164)
eli-darkly Oct 12, 2021
2e9f818
merge from public after release
Oct 12, 2021
951df1a
Start work on flag builder.
belevy Nov 21, 2021
7f9091d
Add user targeting and rule builder
belevy Nov 22, 2021
4fdc7e8
Add datasource implementation
belevy Nov 22, 2021
58c60d7
Convert the current_flags hash to use symbols instead of strings as keys
belevy Nov 23, 2021
42e642e
Fix typo on FlagRuleBuilder copy constructor
belevy Nov 23, 2021
2b75a67
minor refactoring of impl; Added use of new Clause struct instead of …
belevy Nov 23, 2021
8a408b2
Add the doc comments
belevy Nov 23, 2021
7c0541d
(big segments 1) add public config/interface/reason types (#167)
eli-darkly Nov 23, 2021
28776f3
Cleanup docstrings to be YARD docs
belevy Nov 24, 2021
ce5de89
Added Util.is_bool helper function to clean up the check for whether …
belevy Nov 24, 2021
f3fd0b4
Merge branch 'bl/sc-130603/test-data-flag-builder' into bl/sc-130603/…
belevy Nov 24, 2021
d9f9af5
Move public classes out of Impl namespace. Most of it is in public na…
belevy Nov 24, 2021
042ecb0
Move require of concurrent/atomics to the correct module
belevy Nov 24, 2021
78e0da5
(big segments 2) implement Big Segments evaluation & status APIs (#168)
eli-darkly Nov 24, 2021
a0794d9
improve CONTRIBUTING.md with notes on code organization
eli-darkly Nov 25, 2021
7199ff1
add note about doc comments
eli-darkly Nov 25, 2021
b9f879f
Cleanup YARD warnings and cleanup docs
belevy Nov 29, 2021
54d8d23
Merge pull request #170 from launchdarkly/eb/sc-132599/code-structure…
eli-darkly Nov 30, 2021
d405059
Merge pull request #165 from launchdarkly/bl/sc-130603/test-data-flag…
belevy Nov 30, 2021
2eacf24
Merge remote-tracking branch 'origin/test-data' into bl/sc-130603/tes…
belevy Nov 30, 2021
5bbf2d3
Address PR feedback: Move is_bool back to Impl namespace to avoid con…
belevy Nov 30, 2021
19087f2
(big segments 3) implement Redis & DynamoDB big segment stores (#169)
eli-darkly Dec 1, 2021
201a61c
add missing import
eli-darkly Dec 4, 2021
fa70dc5
Merge pull request #166 from launchdarkly/bl/sc-130603/test-data-source
belevy Dec 6, 2021
91a7de3
fix stale calculation
eli-darkly Dec 6, 2021
ece6454
fix big segments user hash algorithm to use SHA256
eli-darkly Dec 8, 2021
21777e6
Merge pull request #171 from launchdarkly/eb/sc-132086/big-seg-sha256
eli-darkly Dec 8, 2021
a11d286
improve & refactor client/evaluation tests
eli-darkly Dec 8, 2021
554407c
more cleanup/DRY
eli-darkly Dec 8, 2021
786a8c9
Merge pull request #172 from launchdarkly/eb/sc-132086/better-eval-tests
eli-darkly Dec 8, 2021
0270d99
Merge branch 'big-segments'
eli-darkly Dec 9, 2021
28043c5
Merge branch 'test-data'
eli-darkly Dec 9, 2021
2b544c5
add use_preconfigured_flag and use_preconfigured_segment to TestData …
eli-darkly Dec 9, 2021
c8c8693
always cache big segment query result even if it's nil
eli-darkly Dec 9, 2021
6283277
comments
eli-darkly Dec 9, 2021
88e6b2a
add test for cache expiration
eli-darkly Dec 9, 2021
bb3ecc5
Merge pull request #175 from launchdarkly/eb/sc-132086/cache-nil-big-seg
eli-darkly Dec 9, 2021
d9c3274
use TestData in our own tests (#174)
eli-darkly Dec 9, 2021
3e4c893
replace LaunchDarkly::FileDataSource with LaunchDarkly::Integrations:…
eli-darkly Dec 9, 2021
86e3d62
Merge pull request #176 from launchdarkly/eb/sc-134212/move-file-data
eli-darkly Dec 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
mkmf.log
*.gem
.DS_Store
Gemfile.lock
Gemfile.lock
.ruby-version
41 changes: 33 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
Contributing to the LaunchDarkly Server-side SDK for Ruby
================================================
# Contributing to the LaunchDarkly Server-side SDK for Ruby

LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.

Submitting bug reports and feature requests
------------------
## Submitting bug reports and feature requests

The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/ruby-server-sdk/issues) in the SDK repository. Bug reports and feature requests specific to this SDK should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days.

Submitting pull requests
------------------
## Submitting pull requests

We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days.

Build instructions
------------------
## Build instructions

### Prerequisites

Expand All @@ -35,3 +31,32 @@ bundle exec rspec spec
```

By default, the full unit test suite includes live tests of the integrations for Consul, DynamoDB, and Redis. Those tests expect you to have instances of all of those databases running locally. To skip them, set the environment variable `LD_SKIP_DATABASE_TESTS=1` before running the tests.

### Building documentation

Documentation is built automatically with YARD for each release. To build the documentation locally:

```
cd docs
make
```

The output will appear in `docs/build/html`.

## Code organization

The SDK's namespacing convention is as follows:

* `LaunchDarkly`: This namespace contains the most commonly used classes and methods in the SDK, such as `LDClient` and `EvaluationDetail`.
* `LaunchDarkly::Integrations`: This namespace contains entry points for optional features that are related to how the SDK communicates with other systems, such as `Redis`.
* `LaunchDarkly::Interfaces`: This namespace contains types that do not do anything by themselves, but may need to be referenced if you are using optional features or implementing a custom component.

A special case is the namespace `LaunchDarkly::Impl`, and any namespaces within it. Everything under `Impl` is considered a private implementation detail: all files there are excluded from the generated documentation, and are considered subject to change at any time and not supported for direct use by application developers. We do this because Ruby's scope/visibility system is somewhat limited compared to other languages: a method can be `private` or `protected` within a class, but there is no way to make it visible to other classes in the SDK yet invisible to code outside of the SDK, and there is similarly no way to hide a class.

So, if there is a class whose existence is entirely an implementation detail, it should be in `Impl`. Similarly, classes that are _not_ in `Impl` must not expose any public members that are not meant to be part of the supported public API. This is important because of our guarantee of backward compatibility for all public APIs within a major version: we want to be able to change our implementation details to suit the needs of the code, without worrying about breaking a customer's code. Due to how the language works, we can't actually prevent an application developer from referencing those classes in their code, but this convention makes it clear that such use is discouraged and unsupported.

## Documenting types and methods

All classes and public methods outside of `LaunchDarkly::Impl` should have documentation comments. These are used to build the API documentation that is published at https://launchdarkly.github.io/ruby-server-sdk/ and https://www.rubydoc.info/gems/launchdarkly-server-sdk. The documentation generator is YARD; see https://yardoc.org/ for the comment format it uses.

Please try to make the style and terminology in documentation comments consistent with other documentation comments in the SDK. Also, if a class or method is being added that has an equivalent in other SDKs, and if we have described it in a consistent away in those other SDKs, please reuse the text whenever possible (with adjustments for anything language-specific) rather than writing new text.
79 changes: 78 additions & 1 deletion lib/ldclient-rb/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Config
# @option opts [String] :wrapper_name See {#wrapper_name}.
# @option opts [String] :wrapper_version See {#wrapper_version}.
# @option opts [#open] :socket_factory See {#socket_factory}.
# @option opts [BigSegmentsConfig] :big_segments See {#big_segments}.
#
def initialize(opts = {})
@base_uri = (opts[:base_uri] || Config.default_base_uri).chomp("/")
Expand Down Expand Up @@ -73,6 +74,7 @@ def initialize(opts = {})
@wrapper_name = opts[:wrapper_name]
@wrapper_version = opts[:wrapper_version]
@socket_factory = opts[:socket_factory]
@big_segments = opts[:big_segments] || BigSegmentsConfig.new(store: nil)
end

#
Expand Down Expand Up @@ -258,10 +260,21 @@ def offline?
# object.
#
# @return [LaunchDarkly::Interfaces::DataSource|lambda]
# @see FileDataSource
# @see LaunchDarkly::Integrations::FileData
# @see LaunchDarkly::Integrations::TestData
#
attr_reader :data_source

#
# Configuration options related to Big Segments.
#
# Big Segments are a specific type of user segments. For more information, read the LaunchDarkly
# documentation: https://docs.launchdarkly.com/home/users/big-segments
#
# @return [BigSegmentsConfig]
#
attr_reader :big_segments

# @deprecated This is replaced by {#data_source}.
attr_reader :update_processor

Expand Down Expand Up @@ -484,4 +497,68 @@ def self.minimum_diagnostic_recording_interval
60
end
end

#
# Configuration options related to Big Segments.
#
# Big Segments are a specific type of user segments. For more information, read the LaunchDarkly
# documentation: https://docs.launchdarkly.com/home/users/big-segments
#
# If your application uses Big Segments, you will need to create a `BigSegmentsConfig` that at a
# minimum specifies what database integration to use, and then pass the `BigSegmentsConfig`
# object as the `big_segments` parameter when creating a {Config}.
#
# @example Configuring Big Segments with Redis
# store = LaunchDarkly::Integrations::Redis::new_big_segments_store(redis_url: "redis://my-server")
# config = LaunchDarkly::Config.new(big_segments:
# LaunchDarkly::BigSegmentsConfig.new(store: store))
# client = LaunchDarkly::LDClient.new(my_sdk_key, config)
#
class BigSegmentsConfig
DEFAULT_USER_CACHE_SIZE = 1000
DEFAULT_USER_CACHE_TIME = 5
DEFAULT_STATUS_POLL_INTERVAL = 5
DEFAULT_STALE_AFTER = 2 * 60

#
# Constructor for setting Big Segments options.
#
# @param store [LaunchDarkly::Interfaces::BigSegmentStore] the data store implementation
# @param user_cache_size [Integer] See {#user_cache_size}.
# @param user_cache_time [Float] See {#user_cache_time}.
# @param status_poll_interval [Float] See {#status_poll_interval}.
# @param stale_after [Float] See {#stale_after}.
#
def initialize(store:, user_cache_size: nil, user_cache_time: nil, status_poll_interval: nil, stale_after: nil)
@store = store
@user_cache_size = user_cache_size.nil? ? DEFAULT_USER_CACHE_SIZE : user_cache_size
@user_cache_time = user_cache_time.nil? ? DEFAULT_USER_CACHE_TIME : user_cache_time
@status_poll_interval = status_poll_interval.nil? ? DEFAULT_STATUS_POLL_INTERVAL : status_poll_interval
@stale_after = stale_after.nil? ? DEFAULT_STALE_AFTER : stale_after
end

# The implementation of {LaunchDarkly::Interfaces::BigSegmentStore} that will be used to
# query the Big Segments database.
# @return [LaunchDarkly::Interfaces::BigSegmentStore]
attr_reader :store

# The maximum number of users whose Big Segment state will be cached by the SDK at any given time.
# @return [Integer]
attr_reader :user_cache_size

# The maximum length of time (in seconds) that the Big Segment state for a user will be cached
# by the SDK.
# @return [Float]
attr_reader :user_cache_time

# The interval (in seconds) at which the SDK will poll the Big Segment store to make sure it is
# available and to determine how long ago it was updated.
# @return [Float]
attr_reader :status_poll_interval

# The maximum length of time between updates of the Big Segments data before the data is
# considered out of date.
# @return [Float]
attr_reader :stale_after
end
end
75 changes: 67 additions & 8 deletions lib/ldclient-rb/evaluation_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,42 @@ class EvaluationReason

# Indicates the general category of the reason. Will always be one of the class constants such
# as {#OFF}.
# @return [Symbol]
attr_reader :kind

# The index of the rule that was matched (0 for the first rule in the feature flag). If
# {#kind} is not {#RULE_MATCH}, this will be `nil`.
# @return [Integer|nil]
attr_reader :rule_index

# A unique string identifier for the matched rule, which will not change if other rules are added
# or deleted. If {#kind} is not {#RULE_MATCH}, this will be `nil`.
# @return [String]
attr_reader :rule_id

# A boolean or nil value representing if the rule or fallthrough has an experiment rollout.
# @return [Boolean|nil]
attr_reader :in_experiment

# The key of the prerequisite flag that did not return the desired variation. If {#kind} is not
# {#PREREQUISITE_FAILED}, this will be `nil`.
# @return [String]
attr_reader :prerequisite_key

# A value indicating the general category of error. This should be one of the class constants such
# as {#ERROR_FLAG_NOT_FOUND}. If {#kind} is not {#ERROR}, it will be `nil`.
# @return [Symbol]
attr_reader :error_kind

# Describes the validity of Big Segment information, if and only if the flag evaluation required
# querying at least one Big Segment. Otherwise it returns `nil`. Possible values are defined by
# {BigSegmentsStatus}.
#
# Big Segments are a specific kind of user segments. For more information, read the LaunchDarkly
# documentation: https://docs.launchdarkly.com/home/users/big-segments
# @return [Symbol]
attr_reader :big_segments_status

# Returns an instance whose {#kind} is {#OFF}.
# @return [EvaluationReason]
def self.off
Expand Down Expand Up @@ -196,11 +211,13 @@ def self.error(error_kind)
def ==(other)
if other.is_a? EvaluationReason
@kind == other.kind && @rule_index == other.rule_index && @rule_id == other.rule_id &&
@prerequisite_key == other.prerequisite_key && @error_kind == other.error_kind
@prerequisite_key == other.prerequisite_key && @error_kind == other.error_kind &&
@big_segments_status == other.big_segments_status
elsif other.is_a? Hash
@kind.to_s == other[:kind] && @rule_index == other[:ruleIndex] && @rule_id == other[:ruleId] &&
@prerequisite_key == other[:prerequisiteKey] &&
(other[:errorKind] == @error_kind.nil? ? nil : @error_kind.to_s)
(other[:errorKind] == @error_kind.nil? ? nil : @error_kind.to_s) &&
(other[:bigSegmentsStatus] == @big_segments_status.nil? ? nil : @big_segments_status.to_s)
end
end

Expand Down Expand Up @@ -242,7 +259,7 @@ def as_json(*) # parameter is unused, but may be passed if we're using the json
# enabled for a flag and the application called variation_detail, or 2. experimentation is
# enabled for an evaluation. We can't reuse these hashes because an application could call
# as_json and then modify the result.
case @kind
ret = case @kind
when :RULE_MATCH
if @in_experiment
{ kind: @kind, ruleIndex: @rule_index, ruleId: @rule_id, inExperiment: @in_experiment }
Expand All @@ -262,6 +279,10 @@ def as_json(*) # parameter is unused, but may be passed if we're using the json
else
{ kind: @kind }
end
if !@big_segments_status.nil?
ret[:bigSegmentsStatus] = @big_segments_status
end
ret
end

# Same as {#as_json}, but converts the JSON structure into a string.
Expand All @@ -285,14 +306,24 @@ def [](key)
@prerequisite_key
when :errorKind
@error_kind.nil? ? nil : @error_kind.to_s
when :bigSegmentsStatus
@big_segments_status.nil? ? nil : @big_segments_status.to_s
else
nil
end
end

private
def with_big_segments_status(big_segments_status)
return self if @big_segments_status == big_segments_status
EvaluationReason.new(@kind, @rule_index, @rule_id, @prerequisite_key, @error_kind, @in_experiment, big_segments_status)
end

def initialize(kind, rule_index, rule_id, prerequisite_key, error_kind, in_experiment=nil)
#
# Constructor that sets all properties. Applications should not normally use this constructor,
# but should use class methods like {#off} to avoid creating unnecessary instances.
#
def initialize(kind, rule_index, rule_id, prerequisite_key, error_kind, in_experiment=nil,
big_segments_status = nil)
@kind = kind.to_sym
@rule_index = rule_index
@rule_id = rule_id
Expand All @@ -301,11 +332,10 @@ def initialize(kind, rule_index, rule_id, prerequisite_key, error_kind, in_exper
@prerequisite_key.freeze if !prerequisite_key.nil?
@error_kind = error_kind
@in_experiment = in_experiment
@big_segments_status = big_segments_status
end

private_class_method :new

def self.make_error(error_kind)
private_class_method def self.make_error(error_kind)
new(:ERROR, nil, nil, nil, error_kind)
end

Expand All @@ -321,4 +351,33 @@ def self.make_error(error_kind)
ERROR_EXCEPTION => make_error(ERROR_EXCEPTION)
}
end

#
# Defines the possible values of {EvaluationReason#big_segments_status}.
#
module BigSegmentsStatus
#
# Indicates that the Big Segment query involved in the flag evaluation was successful, and
# that the segment state is considered up to date.
#
HEALTHY = :HEALTHY

#
# Indicates that the Big Segment query involved in the flag evaluation was successful, but
# that the segment state may not be up to date.
#
STALE = :STALE

#
# Indicates that Big Segments could not be queried for the flag evaluation because the SDK
# configuration did not include a Big Segment store.
#
NOT_CONFIGURED = :NOT_CONFIGURED

#
# Indicates that the Big Segment query involved in the flag evaluation failed, for instance
# due to a database error.
#
STORE_ERROR = :STORE_ERROR
end
end
Loading