Repository navigation
feat(openfeature): add agentless configuration and source resolution #6291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pavlokhrebto
merged 12 commits into
master
from
pavlo.khrebto/FFLSDK-10/agentless-configuration
Sep 30, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
234efd3
feat(openfeature): add agentless configuration settings and source re…
pavlokhrebto 8b56709
fix(openfeature): complete configuration type signatures
pavlokhrebto 5d93414
fix(openfeature): align configuration RBS visibility
pavlokhrebto 2901229
fix: validate agentless endpoint inputs before normalization
pavlokhrebto e699d0b
docs: add changelog entry for agentless feature flags
pavlokhrebto 2ae5b56
refactor(openfeature): address configuration review feedback
pavlokhrebto 58f131c
refactor(openfeature): clarify integer setting name parameter
pavlokhrebto 027a033
refactor(openfeature): clarify configuration source resolution
pavlokhrebto 58dd57c
test(openfeature): make configuration expectations explicit
pavlokhrebto 2fc2693
fix(openfeature): preserve legacy source selection and allow long pol…
pavlokhrebto e0ddb5b
refactor(openfeature): align feature flags configuration namespace
pavlokhrebto 66c6f77
refactor(openfeature): centralize lenient integer option parsing
pavlokhrebto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
lib/datadog/open_feature/configuration/agentless_endpoint.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require "uri" | ||
|
|
||
| module Datadog | ||
| module OpenFeature | ||
| module Configuration | ||
| # Validated endpoint for agentless Feature Flags configuration delivery. | ||
| class AgentlessEndpoint | ||
| DEFAULT_SITE = "datadoghq.com" | ||
| AGENTLESS_SUBDOMAIN = "ufc-server.ff-cdn" | ||
| CONFIGURATION_PATH = "/api/v2/feature-flagging/config/rules-based/server" | ||
| INVALID_SITE_CHARACTERS = /[\s\/?#@:]/ | ||
| INTERNAL_WHITESPACE = /\s/ | ||
|
|
||
| class << self | ||
| def build(site:, environment:, base_url: nil, logger: Datadog.logger) | ||
| if base_url | ||
| build_custom(base_url, logger) | ||
| else | ||
| build_managed(site, environment, logger) | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def build_custom(base_url, logger) | ||
| unless base_url.ascii_only? | ||
| logger.warn("Feature Flags agentless base URL is invalid; agentless delivery is disabled") | ||
| return | ||
| end | ||
|
|
||
| if base_url.match?(INTERNAL_WHITESPACE) | ||
| logger.warn("Feature Flags agentless base URL contains whitespace; agentless delivery is disabled") | ||
| return | ||
| end | ||
|
|
||
| uri = URI.parse(base_url) | ||
| unless uri.is_a?(URI::HTTP) && uri.absolute? && uri.host | ||
| logger.warn("Feature Flags agentless base URL must be an absolute HTTP or HTTPS URL; agentless delivery is disabled") | ||
| return | ||
| end | ||
|
|
||
| uri.path = CONFIGURATION_PATH if uri.path.to_s.empty? || uri.path == "/" | ||
| new(uri, managed: false) | ||
| rescue URI::InvalidURIError | ||
| logger.warn("Feature Flags agentless base URL is invalid; agentless delivery is disabled") | ||
| nil | ||
| end | ||
|
|
||
| def build_managed(site, environment, logger) | ||
| string_site = site.to_s | ||
| unless string_site.ascii_only? | ||
| logger.warn("Feature Flags site is invalid; agentless delivery is disabled") | ||
| return | ||
| end | ||
|
|
||
| normalized_site = string_site.strip.downcase | ||
| normalized_site = DEFAULT_SITE if normalized_site.empty? | ||
| if normalized_site.match?(INVALID_SITE_CHARACTERS) | ||
| logger.warn("Feature Flags site is invalid; agentless delivery is disabled") | ||
| return | ||
| end | ||
|
|
||
| uri = URI::HTTPS.build( | ||
| host: "#{AGENTLESS_SUBDOMAIN}.#{normalized_site}", | ||
| path: CONFIGURATION_PATH, | ||
| query: environment.nil? ? nil : URI.encode_www_form(dd_env: environment), | ||
| ) | ||
| new(uri, managed: true) | ||
| rescue URI::InvalidComponentError | ||
| logger.warn("Feature Flags site is invalid; agentless delivery is disabled") | ||
| nil | ||
| end | ||
| end | ||
|
|
||
| attr_reader :uri | ||
|
|
||
| def initialize(uri, managed:) | ||
| @uri = uri | ||
| @managed = managed | ||
| end | ||
|
|
||
| def managed? | ||
| @managed | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require_relative "source/resolution" | ||
|
|
||
| module Datadog | ||
| module OpenFeature | ||
| module Configuration | ||
| module Source | ||
| AGENTLESS = "agentless" | ||
| REMOTE_CONFIG = "remote_config" | ||
| OFFLINE = "offline" | ||
|
|
||
| class << self | ||
| def resolve(settings, logger: Datadog.logger) | ||
|
pavlokhrebto marked this conversation as resolved.
|
||
| feature_flags = settings.feature_flags | ||
| source = resolve_source(feature_flags, legacy: settings.open_feature, logger: logger) | ||
| enabled = feature_flags.enabled && source != OFFLINE | ||
|
|
||
| Resolution.new(source, enabled: enabled) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def resolve_source(settings, legacy:, logger:) | ||
| configured_source = settings.configuration_source | ||
| if !settings.using_default?(:configuration_source) && !configured_source.empty? | ||
| return configured_source if configured_source == AGENTLESS || | ||
| configured_source == REMOTE_CONFIG || | ||
| configured_source == OFFLINE | ||
|
|
||
| logger.warn("Unsupported Feature Flags configuration source; Feature Flags are disabled") | ||
| OFFLINE | ||
| elsif !legacy.using_default?(:enabled) | ||
| legacy.enabled ? REMOTE_CONFIG : OFFLINE | ||
| else | ||
| AGENTLESS | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
22 changes: 22 additions & 0 deletions
22
lib/datadog/open_feature/configuration/source/resolution.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Datadog | ||
| module OpenFeature | ||
| module Configuration | ||
| module Source | ||
| class Resolution | ||
| attr_reader :source | ||
|
|
||
| def initialize(source, enabled:) | ||
| @source = source | ||
| @enabled = enabled | ||
| end | ||
|
|
||
| def enabled? | ||
| @enabled | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.