Skip to content

About

The official Dynatrace OpenFeature provider for Java.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Dynatrace OpenFeature Provider for Java

The official Dynatrace OpenFeature provider for Java server-side applications.

The provider evaluates flags in-process: on initialization it fetches your flag configuration from the Dynatrace CDN and keeps it up to date in the background, so evaluations are local and do not make a network call.

Status: Early alpha — not yet ready for production use.

Installation

<dependency>
  <groupId>com.dynatrace.openfeature</groupId>
  <artifactId>dynatrace-openfeature-provider-java</artifactId>
  <version>0.5.0-alpha</version> <!-- x-release-please-version -->
</dependency>
implementation 'com.dynatrace.openfeature:dynatrace-openfeature-provider-java:0.5.0-alpha' // x-release-please-version

Usage

import com.dynatrace.openfeature.DynatraceProvider;
import dev.openfeature.sdk.*;

OpenFeatureAPI api = OpenFeatureAPI.getInstance();
api.setProviderAndWait(new DynatraceProvider(System.getenv("DT_SDK_KEY")));

Client client = api.getClient();
EvaluationContext ctx = new ImmutableContext("user-123");
boolean enabled = client.getBooleanValue("my-flag", false, ctx);

// On shutdown:
api.shutdown();

Once the provider is registered, all flag evaluation goes through the OpenFeature API. See the OpenFeature Java SDK documentation for evaluation contexts, hooks, events, and the rest of the SDK surface.

Configuration

Build a DynatraceProviderOptions and pass it as the second constructor argument:

DynatraceProviderOptions options = DynatraceProviderOptions.builder()
    .configOrigin("https://cdn.eu.fm.dynatracelabs.com")
    .metricsOrigin("https://metrics.eu.fm.dynatracelabs.com")
    .build();

api.setProviderAndWait(new DynatraceProvider(sdkKey, options));
Option Type Default Description
configOrigin(String) String derived from SDK key Override the flag configuration origin.
metricsOrigin(String) String derived from SDK key Override the evaluation metrics ingest origin.

A runnable example lives in examples/local-demo.

Contributing

See CONTRIBUTING.md.

License

Apache 2.0 — see LICENSE.

About

The official Dynatrace OpenFeature provider for Java.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages