Skip to content

Commit cdf5175

Browse files
committed
Update provider documentation
1 parent 396073e commit cdf5175

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

lib/datadog/open_feature/provider.rb

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,46 @@
55

66
module Datadog
77
module OpenFeature
8-
# Example
8+
# OpenFeature feature flagging provider backed by Datadog Remote Configuration.
99
#
10-
# require 'open_feature/sdk'
11-
# require 'datadog/open_feature/provider'
10+
# In the example below you can see how to configure the OpenFeature SDK
11+
# https://github.com/open-feature/ruby-sdk to use the Datadog feature flags provider.
12+
#
13+
# Example:
1214
#
15+
# Make sure to enable Remote Configuration and OpenFeature in the Datadog configuration.
16+
#
17+
# ```ruby
18+
# # FILE: initializers/datadog.rb
1319
# Datadog.configure do |config|
20+
# config.remote.enabled = true
1421
# config.open_feature.enabled = true
1522
# end
23+
# ```
24+
#
25+
# And configure the OpenFeature SDK to use the Datadog feature flagging provider.
26+
#
27+
# ```ruby
28+
# # FILE: initializers/open_feature.rb
29+
# require 'open_feature/sdk'
30+
# require 'datadog/open_feature/provider'
1631
#
1732
# OpenFeature::SDK.configure do |config|
1833
# config.set_provider(Datadog::OpenFeature::Provider.new)
1934
# end
35+
# ```
2036
#
37+
# Now you can create OpenFeature SDK client and use it to fetch feature flag values.
38+
#
39+
# ```ruby
2140
# client = OpenFeature::SDK.build_client
22-
# client.fetch_string_value(flag_key: 'banner', default_value: 'default')
41+
# context = OpenFeature::SDK::EvaluationContext.new('email' => '[email protected]')
42+
#
43+
# client.fetch_string_value(
44+
# flag_key: 'banner', default_value: 'Greetings!', evaluation_context: context
45+
# )
46+
# # => 'Welcome back!'
47+
# ```
2348
class Provider
2449
NAME = 'Datadog Feature Flagging Provider'
2550

0 commit comments

Comments
 (0)