launchdarkly-server-sdk 8.6.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ldclient-rb/config.rb +20 -0
- data/lib/ldclient-rb/events.rb +1 -1
- data/lib/ldclient-rb/impl/event_sender.rb +13 -1
- data/lib/ldclient-rb/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5af0bbef2faa957948f0a7f50e15fcabe977389a33985907183d58325e1c6b3d
|
4
|
+
data.tar.gz: 4ecb07d71897441c2d02cc1972a75b63f07615b6fa1266330f7403c5e36c01c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22409520414843c8249e2fa303686289c3701d7802fb558fe87870d4d5293381fabbf4f0634f6a14784e77eb328a5601929e096555bdc14f66ee4826a6f36316
|
7
|
+
data.tar.gz: 36f9746807944960f161f83f4a37258d0d6ce1035018dc4d49c2e9b2a1d09fa96e83f35e6a1a0afeb30ee902bf4713e74ef06d32068611458d384a35561775e9
|
data/lib/ldclient-rb/config.rb
CHANGED
@@ -65,6 +65,7 @@ module LaunchDarkly
|
|
65
65
|
@all_attributes_private = opts[:all_attributes_private] || false
|
66
66
|
@private_attributes = opts[:private_attributes] || []
|
67
67
|
@send_events = opts.has_key?(:send_events) ? opts[:send_events] : Config.default_send_events
|
68
|
+
@compress_events = opts.has_key?(:compress_events) ? opts[:compress_events] : Config.default_compress_events
|
68
69
|
@context_keys_capacity = opts[:context_keys_capacity] || Config.default_context_keys_capacity
|
69
70
|
@context_keys_flush_interval = opts[:context_keys_flush_interval] || Config.default_context_keys_flush_interval
|
70
71
|
@data_source = opts[:data_source]
|
@@ -254,6 +255,17 @@ module LaunchDarkly
|
|
254
255
|
#
|
255
256
|
attr_reader :send_events
|
256
257
|
|
258
|
+
#
|
259
|
+
# Should the event payload sent to LaunchDarkly use gzip compression. By default this is false to prevent backward
|
260
|
+
# breaking compatibility issues with older versions of the relay proxy.
|
261
|
+
#
|
262
|
+
# Customers not using the relay proxy are strongly encouraged to enable this feature to reduce egress bandwidth
|
263
|
+
# cost.
|
264
|
+
#
|
265
|
+
# @return [Boolean]
|
266
|
+
#
|
267
|
+
attr_reader :compress_events
|
268
|
+
|
257
269
|
#
|
258
270
|
# The number of context keys that the event processor can remember at any one time. This reduces the
|
259
271
|
# amount of duplicate context details sent in analytics events.
|
@@ -539,6 +551,14 @@ module LaunchDarkly
|
|
539
551
|
true
|
540
552
|
end
|
541
553
|
|
554
|
+
#
|
555
|
+
# The default value for {#compress_events}.
|
556
|
+
# @return [Boolean] false
|
557
|
+
#
|
558
|
+
def self.default_compress_events
|
559
|
+
false
|
560
|
+
end
|
561
|
+
|
542
562
|
#
|
543
563
|
# The default value for {#context_keys_capacity}.
|
544
564
|
# @return [Integer] 1000
|
data/lib/ldclient-rb/events.rb
CHANGED
@@ -513,13 +513,13 @@ module LaunchDarkly
|
|
513
513
|
evaluation: {
|
514
514
|
key: event.key,
|
515
515
|
value: event.evaluation.value,
|
516
|
+
reason: event.evaluation.reason,
|
516
517
|
},
|
517
518
|
}
|
518
519
|
|
519
520
|
out[:evaluation][:version] = event.version unless event.version.nil?
|
520
521
|
out[:evaluation][:default] = event.default unless event.default.nil?
|
521
522
|
out[:evaluation][:variation] = event.evaluation.variation_index unless event.evaluation.variation_index.nil?
|
522
|
-
out[:evaluation][:reason] = event.evaluation.reason unless event.evaluation.reason.nil?
|
523
523
|
out[:samplingRatio] = event.sampling_ratio unless event.sampling_ratio.nil? || event.sampling_ratio == 1
|
524
524
|
|
525
525
|
measurements = []
|
@@ -2,6 +2,8 @@ require "ldclient-rb/impl/unbounded_pool"
|
|
2
2
|
|
3
3
|
require "securerandom"
|
4
4
|
require "http"
|
5
|
+
require "stringio"
|
6
|
+
require "zlib"
|
5
7
|
|
6
8
|
module LaunchDarkly
|
7
9
|
module Impl
|
@@ -42,14 +44,24 @@ module LaunchDarkly
|
|
42
44
|
@logger.debug { "[LDClient] sending #{description}: #{event_data}" }
|
43
45
|
headers = {}
|
44
46
|
headers["content-type"] = "application/json"
|
47
|
+
headers["content-encoding"] = "gzip" if @config.compress_events
|
45
48
|
Impl::Util.default_http_headers(@sdk_key, @config).each { |k, v| headers[k] = v }
|
46
49
|
unless is_diagnostic
|
47
50
|
headers["X-LaunchDarkly-Event-Schema"] = CURRENT_SCHEMA_VERSION.to_s
|
48
51
|
headers["X-LaunchDarkly-Payload-ID"] = payload_id
|
49
52
|
end
|
53
|
+
|
54
|
+
body = event_data
|
55
|
+
if @config.compress_events
|
56
|
+
gzip = Zlib::GzipWriter.new(StringIO.new)
|
57
|
+
gzip << event_data
|
58
|
+
|
59
|
+
body = gzip.close.string
|
60
|
+
end
|
61
|
+
|
50
62
|
response = http_client.request("POST", uri, {
|
51
63
|
headers: headers,
|
52
|
-
body:
|
64
|
+
body: body,
|
53
65
|
})
|
54
66
|
rescue StandardError => exn
|
55
67
|
@logger.warn { "[LDClient] Error sending events: #{exn.inspect}." }
|
data/lib/ldclient-rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launchdarkly-server-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LaunchDarkly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-dynamodb
|
@@ -248,6 +248,20 @@ dependencies:
|
|
248
248
|
- - "~>"
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: 0.1.2
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: zlib
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - "~>"
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '3.1'
|
258
|
+
type: :runtime
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - "~>"
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '3.1'
|
251
265
|
- !ruby/object:Gem::Dependency
|
252
266
|
name: json
|
253
267
|
requirement: !ruby/object:Gem::Requirement
|