Skip to content

feat: add GCP Parameter Manager OpenFeature provider#1771

Open
mahpatil wants to merge 1 commit intoopen-feature:mainfrom
mahpatil:feat/gcp-parameter-manager
Open

feat: add GCP Parameter Manager OpenFeature provider#1771
mahpatil wants to merge 1 commit intoopen-feature:mainfrom
mahpatil:feat/gcp-parameter-manager

Conversation

@mahpatil
Copy link
Copy Markdown

@mahpatil mahpatil commented Apr 9, 2026

Summary

  • Adds a new OpenFeature provider for GCP Parameter Manager that reads feature flags from GCP Parameter Manager parameters
  • Includes flag caching, value conversion for all OpenFeature types (bool, string, int, double, object), and background polling for updates
  • Adds a sample application under samples/gcp-parameter-manager-sample/ with setup/teardown scripts

Provider Details

  • Package: providers/gcp-parameter-manager
  • Class: GcpParameterManagerProvider
  • Supports all OpenFeature flag types via structured or plain-text parameter values
  • Configurable poll interval and GCP project/location settings

Test plan

  • Unit tests for FlagCache, FlagValueConverter, and GcpParameterManagerProvider
  • Integration test (GcpParameterManagerProviderIntegrationTest) requires a real GCP project — set GCP_PROJECT_ID env var to run
  • Sample app: follow samples/gcp-parameter-manager-sample/README.md to run end-to-end

Adds a new OpenFeature provider for GCP Parameter Manager that enables
reading feature flags from GCP Parameter Manager secrets. Includes the
provider implementation with flag caching, value conversion, unit tests,
integration tests, and a sample application demonstrating usage.
@mahpatil mahpatil requested a review from a team as a code owner April 9, 2026 05:18
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new OpenFeature provider for Google Cloud Parameter Manager, allowing feature flags to be evaluated from GCP parameters. The provider supports various data types (boolean, string, integer, double, and JSON objects) and includes an in-memory cache for performance. The changes encompass the core provider implementation, configuration options, unit and integration tests, and a sample application demonstrating its usage. Feedback indicates a potential race condition in the FlagCache.get method, suggesting a more robust removal mechanism for expired entries, and points out that the spotbugs-exclusions.xml file contains irrelevant entries that should be removed for clarity.

Comment on lines +44 to +47
if (entry.isExpired()) {
store.remove(key);
return Optional.empty();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There is a race condition in the get method. If a thread identifies an entry as expired and calls store.remove(key), it might inadvertently remove a fresh value inserted by another thread between the isExpired() check and the remove() call. Using store.remove(key, entry) ensures that the entry is only removed if it matches the one that was found to be expired.

Suggested change
if (entry.isExpired()) {
store.remove(key);
return Optional.empty();
}
if (entry.isExpired()) {
store.remove(key, entry);
return Optional.empty();
}

Comment on lines +4 to +30
<!-- Ignore generated dev.openfeature.flagd.grpc schemas -->
<Match>
<Package name="~dev\.openfeature\.flagd\.grpc.*" />
</Match>

<!-- Ignore generated dev.openfeature.flagd.sync schemas -->
<Match>
<Package name="~dev\.openfeature\.flagd\.sync.*" />
</Match>

<!-- Allow predictable random for backoff jitter generation -->
<Match>
<Class name="dev.openfeature.contrib.providers.flagd.resolver.common.backoff.BackoffService" />
<Bug pattern="PREDICTABLE_RANDOM" />
</Match>

<!-- Suppress: EI_EXPOSE_REP2 in ModuleMachine -->
<Match>
<Class name="dev.openfeature.contrib.providers.gofeatureflag.wasm.ModuleMachine"/>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>

<!-- Suppress: SKIPPED_CLASS_TOO_BIG in ModuleMachineFuncGroup_0 -->
<Match>
<Class name="dev.openfeature.contrib.providers.gofeatureflag.wasm.ModuleMachineFuncGroup_0"/>
<Bug pattern="SKIPPED_CLASS_TOO_BIG"/>
</Match>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This spotbugs-exclusions.xml file contains several exclusions for packages and classes (e.g., dev.openfeature.flagd.grpc, BackoffService, ModuleMachine) that are not part of this module. It appears to have been copied from another provider without being cleaned up. Please remove these irrelevant entries to maintain clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant