openfeature-go-feature-flag-provider 0.1.4 → 0.1.6
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/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -5
- data/lib/openfeature/go-feature-flag/go_feature_flag_provider.rb +8 -1
- data/lib/openfeature/go-feature-flag/goff_api.rb +2 -1
- data/lib/openfeature/go-feature-flag/options.rb +11 -2
- data/lib/openfeature/go-feature-flag/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88b909669520d990cdd3bab857d26fe0aebd5a6d753a311d88b73fd8026cfd49
|
|
4
|
+
data.tar.gz: f5ae9b1d0a474a1f547f1dd9b84b0f9c4cee48f938f79e1b2d96ca67acc5380c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 68053f645f8b2ea7d3c48f71e5c22bf6b64308cf4656a3480611bc82f200d38df9d527134e734b51e017bbf96814eb7b9abbb5b86205860eaafc7ff68df3d37c
|
|
7
|
+
data.tar.gz: 1f5125e5d8360b48a12282f227dc69ea9302dd273c4bd728ce5c67ff159f11aaa97753a8dcca25a7d36959400e5d40c4af80b39150cb83cd5a514058f1099248
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.6](https://github.com/open-feature/ruby-sdk-contrib/compare/openfeature-go-feature-flag-provider/v0.1.5...openfeature-go-feature-flag-provider/v0.1.6) (2025-11-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### 🐛 Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **openfeature-go-feature-flag-provider:** fallback to sdkDefault if reason is DISABLED ([#64](https://github.com/open-feature/ruby-sdk-contrib/issues/64)) ([6cb08c0](https://github.com/open-feature/ruby-sdk-contrib/commit/6cb08c0156ce1ee4ea17278937e6da8904a15d04))
|
|
9
|
+
|
|
10
|
+
## [0.1.5](https://github.com/open-feature/ruby-sdk-contrib/compare/openfeature-go-feature-flag-provider/v0.1.4...openfeature-go-feature-flag-provider/v0.1.5) (2025-11-04)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ✨ New Features
|
|
14
|
+
|
|
15
|
+
* **goff:** add Faraday instrumentation ([#62](https://github.com/open-feature/ruby-sdk-contrib/issues/62)) ([6ae223f](https://github.com/open-feature/ruby-sdk-contrib/commit/6ae223f3ffa076a45581f454cffbc49a0394d871))
|
|
16
|
+
|
|
3
17
|
## [0.1.4](https://github.com/open-feature/ruby-sdk-contrib/compare/openfeature-go-feature-flag-provider/v0.1.3...openfeature-go-feature-flag-provider/v0.1.4) (2025-07-30)
|
|
4
18
|
|
|
5
19
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -45,11 +45,11 @@ gem install openfeature-go-feature-flag-provider
|
|
|
45
45
|
|
|
46
46
|
The `OpenFeature::GoFeatureFlag::Provider` needs some options to be created and then set in the OpenFeature SDK.
|
|
47
47
|
|
|
48
|
-
| **Option**
|
|
49
|
-
|
|
50
|
-
| `endpoint`
|
|
51
|
-
| `headers`
|
|
52
|
-
|
|
48
|
+
| **Option** | **Description** |
|
|
49
|
+
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
|
50
|
+
| `endpoint` | **(mandatory)** The URL to access to the relay-proxy.<br />*(example: `https://relay.proxy.gofeatureflag.org/`)* |
|
|
51
|
+
| `headers` | A `Hash` object containing the headers to send to the relay-proxy.<br/>*(example to send APIKey: `{"Authorization" => "Bearer my-api-key"}` |
|
|
52
|
+
| `instrumentation` | [Faraday instrumentation](https://github.com/lostisland/faraday/blob/main/docs/middleware/included/instrumentation.md) hash |
|
|
53
53
|
The only required option to create a `GoFeatureFlagProvider` is the URL _(`endpoint`)_ to your GO Feature Flag relay-proxy instance.
|
|
54
54
|
|
|
55
55
|
```ruby
|
|
@@ -10,7 +10,7 @@ module OpenFeature
|
|
|
10
10
|
def initialize(options: Options.new)
|
|
11
11
|
@metadata = SDK::Provider::ProviderMetadata.new(name: PROVIDER_NAME)
|
|
12
12
|
@options = options
|
|
13
|
-
@goff_api = GoFeatureFlagApi.new(endpoint: options.endpoint, custom_headers: options.custom_headers)
|
|
13
|
+
@goff_api = GoFeatureFlagApi.new(endpoint: options.endpoint, custom_headers: options.custom_headers, instrumentation: options.instrumentation)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil)
|
|
@@ -52,6 +52,13 @@ module OpenFeature
|
|
|
52
52
|
)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
if parsed_response.reason == SDK::Provider::Reason::DISABLED
|
|
56
|
+
return SDK::Provider::ResolutionDetails.new(
|
|
57
|
+
value: default_value,
|
|
58
|
+
reason: SDK::Provider::Reason::DISABLED
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
|
|
55
62
|
unless allowed_classes.include?(parsed_response.value.class)
|
|
56
63
|
return SDK::Provider::ResolutionDetails.new(
|
|
57
64
|
value: default_value,
|
|
@@ -11,8 +11,9 @@ module OpenFeature
|
|
|
11
11
|
module GoFeatureFlag
|
|
12
12
|
# This class is the entry point for the GoFeatureFlagProvider
|
|
13
13
|
class GoFeatureFlagApi
|
|
14
|
-
def initialize(endpoint: nil, custom_headers: nil)
|
|
14
|
+
def initialize(endpoint: nil, custom_headers: nil, instrumentation: nil)
|
|
15
15
|
@faraday_connection = Faraday.new(url: endpoint, headers: headers(custom_headers)) do |f|
|
|
16
|
+
f.request :instrumentation, instrumentation if instrumentation
|
|
16
17
|
f.adapter :net_http_persistent do |http|
|
|
17
18
|
http.idle_timeout = 30
|
|
18
19
|
end
|
|
@@ -6,13 +6,15 @@ module OpenFeature
|
|
|
6
6
|
module GoFeatureFlag
|
|
7
7
|
# This class is the configuration class for the GoFeatureFlagProvider
|
|
8
8
|
class Options
|
|
9
|
-
attr_accessor :endpoint, :custom_headers, :exporter_metadata
|
|
9
|
+
attr_accessor :endpoint, :custom_headers, :exporter_metadata, :instrumentation
|
|
10
10
|
|
|
11
|
-
def initialize(endpoint: nil, headers: {}, exporter_metadata: {})
|
|
11
|
+
def initialize(endpoint: nil, headers: {}, exporter_metadata: {}, instrumentation: nil)
|
|
12
12
|
validate_endpoint(endpoint: endpoint)
|
|
13
|
+
validate_instrumentation(instrumentation: instrumentation)
|
|
13
14
|
@endpoint = endpoint
|
|
14
15
|
@custom_headers = headers
|
|
15
16
|
@exporter_metadata = exporter_metadata
|
|
17
|
+
@instrumentation = instrumentation
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
private
|
|
@@ -25,6 +27,13 @@ module OpenFeature
|
|
|
25
27
|
rescue URI::InvalidURIError
|
|
26
28
|
raise ArgumentError, "Invalid URL for endpoint: #{endpoint}"
|
|
27
29
|
end
|
|
30
|
+
|
|
31
|
+
def validate_instrumentation(instrumentation: nil)
|
|
32
|
+
return if instrumentation.nil?
|
|
33
|
+
return if instrumentation.is_a?(Hash)
|
|
34
|
+
|
|
35
|
+
raise ArgumentError, "Invalid type for instrumentation: #{instrumentation.class}"
|
|
36
|
+
end
|
|
28
37
|
end
|
|
29
38
|
end
|
|
30
39
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openfeature-go-feature-flag-provider
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Poignant
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: openfeature-sdk
|