For the complete documentation index, see llms.txt. This page is also available as Markdown.

OpenFeature Provider for Go SDK

Integrate OpenFeature with Harness FME in your Go applications to evaluate feature flags, manage contexts, and track events using a standardized SDK.

Integrate your Go applications with Harness FME using the Go OpenFeature Provider, a standardized, vendor-agnostic feature flagging API. This provider implements the OpenFeature specification and bridges the OpenFeature SDK with the Harness FME Go SDK.

This page walks you through installing, configuring, and using the Go OpenFeature provider to evaluate feature flags in your Go applications.

Before you begin

Before you begin, ensure you have the following:

  • A valid Harness FME SDK key for your project

  • A Go environment running version 1.21 or later

  • Access to your Go module configuration (go.mod)

Version compatibility

Component
Minimum Version

Go

1.21+

github.com/splitio/split-openfeature-provider-go

≥ 2.0.0

OpenFeature Go SDK

≥ 1.0.0

Install the provider and dependencies

Add the Harness FME OpenFeature provider to your Go module.

go get github.com/splitio/split-openfeature-provider-go

Initialize the provider

You can instantiate and register the provider using your Harness FME SDK key.

Alternatively, if you want more control or need advanced initialization, you can create a SplitClient and provide it directly:

Construct an evaluation context

Provide an evaluation context with a targeting key to evaluate flags. The evaluation context passes targeting information such as user IDs, email addresses, or plan types for flag targeting.

For example:

If the same targeting key is reused across evaluations, set the context at the client level:

Or globally:

Once the context is set at the client or API level, you don't need to provide it for each evaluation.

Evaluate with details

Use the *ValueDetails APIs to get flag values and metadata (such as variant, reason, error code, and configuration). The FME treatment configuration is returned as a raw JSON string under FlagMetadata["config"].

For example:

Track events

The Harness FME OpenFeature provider supports tracking user actions or conversion events directly from your Go application.

To enable event tracking with Track(ctx, eventName, evalCtx, details), your evaluation context must include the following:

  • A non-blank targeting key on the EvaluationContext

  • A trafficType attribute (for example, "user" or "account")

  • A non-blank event name

Optionally, you can include a numeric value and additional event properties using openfeature.NewTrackingEventDetails(value) and .Add(key, value). For more information, see Sending Events.

For example:

For more information, go to the Harness FME Go OpenFeature Provider GitHub repository.

Last updated

Was this helpful?