Skip to content

Feat/gcp parameter manager#1802

Closed
mahpatil wants to merge 7 commits into
open-feature:mainfrom
mahpatil:feat/gcp-parameter-manager
Closed

Feat/gcp parameter manager#1802
mahpatil wants to merge 7 commits into
open-feature:mainfrom
mahpatil:feat/gcp-parameter-manager

Conversation

@mahpatil

@mahpatil mahpatil commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

This PR

Adds a GCP Parameter Manager support to the GCP Provider that reads feature flags from GCP Parameter Manager config.
Includes updates to sample application under samples/gcp/ with setup/teardown script
Package: providers/gcp
Class: GcpParameterManagerProvider
Supports all OpenFeature flag types via structured or plain-text secret values
Configurable poll interval and GCP project settings

Related Issues

Fixes GCP services covered under #1420

Notes

This builds on top of the previous PR that added support for GCP Secret manager.

Follow-up Tasks

How to test

  • Unit tests for GcpParameterManagerProvider
  • Integration test (GcpParameterManagerProviderIntegrationTest) requires a real GCP project — set GCP_PROJECT_ID env var to run
  • [] Sample app: follow samples/gcp/README.md to run end-to-end

mahpatil and others added 7 commits April 11, 2026 21:41
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.

Signed-off-by: Mahesh Patil <maheshfinity@gmail.com>
1. Fix race condition in the get method
2. Remove spotbugs exclusions that were copy pasted

Signed-off-by: Mahesh Patil <maheshfinity@gmail.com>
- Use Reason.CACHED instead of Reason.STATIC (value is TTL-cached, not static)
- Update log4j-slf4j2-impl to 2.25.4 (latest stable)
- Fix pom.xml formatting
- Update test assertion to match Reason.CACHED

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Mahesh Patil <maheshfinity@gmail.com>
…uos folder

Signed-off-by: Mahesh Patil <maheshfinity@gmail.com>
@mahpatil mahpatil requested a review from a team as a code owner June 1, 2026 09:46

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

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.

Code Review

This pull request introduces support for Google Cloud Parameter Manager as an OpenFeature provider, along with a runnable sample application. The review identified several critical issues that will cause compilation and build failures, such as commenting out the required jackson-databind dependency, using incorrect artifact IDs and package imports in the sample application, and a broken link in the documentation. Additionally, defensive null checks were recommended in the provider to prevent potential NullPointerExceptions.

Comment thread providers/gcp/pom.xml
Comment on lines +62 to +65
<!-- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.21.1</version>
</dependency>
</dependency> -->

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

Commenting out the jackson-databind dependency will cause compilation or runtime errors because FlagValueConverter.java directly imports and uses Jackson classes (e.g., ObjectMapper, JsonNode). Since the version is managed by the Google Cloud Libraries BOM (libraries-bom) imported in dependencyManagement, you should keep the dependency declared but without a hardcoded version.

Suggested change
<!-- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.21.1</version>
</dependency>
</dependency> -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

Comment on lines +30 to +34
<dependency>
<groupId>dev.openfeature.contrib.providers</groupId>
<artifactId>gcp-parameter-manager</artifactId>
<version>0.0.1</version>
</dependency>

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

The artifact ID for the GCP provider is gcp, not gcp-parameter-manager. Additionally, the version should match the current version of the provider module, which is 0.0.2 in this pull request. Using the incorrect artifact ID will cause Maven build failures as the dependency cannot be resolved.

Suggested change
<dependency>
<groupId>dev.openfeature.contrib.providers</groupId>
<artifactId>gcp-parameter-manager</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>dev.openfeature.contrib.providers</groupId>
<artifactId>gcp</artifactId>
<version>0.0.2</version>
</dependency>

Comment on lines +3 to +4
import dev.openfeature.contrib.providers.gcpparametermanager.GcpParameterManagerProvider;
import dev.openfeature.contrib.providers.gcpparametermanager.GcpParameterManagerProviderOptions;

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

The package name for the newly added GcpParameterManagerProvider and its options is dev.openfeature.contrib.providers.gcp, not dev.openfeature.contrib.providers.gcpparametermanager. These incorrect imports will cause compilation failures in the sample application.

Suggested change
import dev.openfeature.contrib.providers.gcpparametermanager.GcpParameterManagerProvider;
import dev.openfeature.contrib.providers.gcpparametermanager.GcpParameterManagerProviderOptions;
import dev.openfeature.contrib.providers.gcp.GcpParameterManagerProvider;
import dev.openfeature.contrib.providers.gcp.GcpParameterManagerProviderOptions;

Comment on lines +60 to +62
public GcpParameterManagerProvider(GcpParameterManagerProviderOptions options) {
this.options = options;
}

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

To prevent potential NullPointerExceptions during initialization, add a defensive null check for the options parameter in the constructor.

    public GcpParameterManagerProvider(GcpParameterManagerProviderOptions options) {
        if (options == null) {
            throw new IllegalArgumentException("options must not be null");
        }
        this.options = options;
    }

Comment on lines +163 to +164
private String fetchFromGcp(String parameterName) {
try {

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

If the provider is evaluated before it is initialized, or after it has been shut down, client will be null. Accessing client.renderParameterVersion will throw a raw NullPointerException. Adding a defensive check to ensure client is initialized and throwing a GeneralError provides a much clearer error message.

Suggested change
private String fetchFromGcp(String parameterName) {
try {
private String fetchFromGcp(String parameterName) {
if (client == null) {
throw new GeneralError("ParameterManagerClient is not initialized or has been shut down");
}
try {

@@ -0,0 +1,173 @@
# GCP Parameter Manager — OpenFeature Sample

A runnable Java application demonstrating the [GCP Parameter Manager OpenFeature provider](../../providers/gcp-parameter-manager).

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

The link to the provider directory is incorrect. The provider is located in providers/gcp, not providers/gcp-parameter-manager.

Suggested change
A runnable Java application demonstrating the [GCP Parameter Manager OpenFeature provider](../../providers/gcp-parameter-manager).
A runnable Java application demonstrating the [GCP Parameter Manager OpenFeature provider](../../providers/gcp).

@mahpatil mahpatil closed this Jun 1, 2026
@toddbaert

Copy link
Copy Markdown
Member

Hey @mahpatil - are you still interested in adding this? I saw it earlier and came back to review it, and found it closed.

@mahpatil

mahpatil commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

yes @toddbaert definitely, still working on it. I was just trying to initiate some checks.

@toddbaert

Copy link
Copy Markdown
Member

OK no rush. Keep me posted.

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.

2 participants