Skip to content

Commit

Permalink
FFM-8364 Use Elixir based Murmur3 / Add retries to all network calls (#…
Browse files Browse the repository at this point in the history
…56)

* FFM-8300 Macro and config for verbose evaluation mode

* FFM-8300 Macro and config for verbose evaluation mode

* FFM-8300 Macro and config for verbose evaluation mode

* FFM-8300 Macro and config for verbose evaluation mode

* Revert "FFM-8300 Macro and config for verbose evaluation mode"

This reverts commit c5defa4.

* FFM-8300 Macro and config for verbose evaluation mode

* FFM-8300 Use destructuring

* FFM-8300 Use destructuring

* FFM-8300 Update readme

* FFM-8300 1.2.0 release prep

* FFM-8300 1.2.0 release prep

* FFM-8364 remove Add retries to auth, polling, and metrics

FFM-8300 Temp use branched change for CFAPI for adding error clause

* FFM-8300 Add new murmur3 lib

* FFM-8300 Add new murmur3 lib

* FFM-8300 Add new murmur3 lib

* FFM-8300 Add new murmur3 lib

* FFM-8300 Add new murmur3 lib

* FFM-8300 Add new murmur3 lib

* FFM-8300 Add new murmur3 lib

* FFM-8300 Got elixir lib working

* FFM-8300 Got elixir lib working

* FFM-8300 Got elixir lib working

* FFM-8300 Got elixir lib working

* FFM-8300 Use hash

* FFM-8300 Fix hash

* FFM-8300 comment

* FFM-8300 comment

* FFM-8300 fix readme

* FFM-8300 fix readme

* FFM-8300 steamroll

* FFM-8300 steamroll

* FFM-8300 2.0.0 release prep

* FFM-8300 2.0.0 release prep

* FFM-8364 Use 1.0.1 of client api

* FFM-8364 Increase intensity of root supervisor to 4 over 5 seconds

* FFM-8364 2.0.0 release notes
  • Loading branch information
erdirowlands authored Jun 30, 2023
1 parent a864be7 commit f4e2fa8
Show file tree
Hide file tree
Showing 60 changed files with 406 additions and 6,563 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.0.0] - 2023-06-30
## ** Breaking for Erlang applications (not affecting Elixir applications) **

- Due to a new dependency on a murmur3 hashing library implemented in Elixir, the following is now required to use the SDK in Erlang applications:
- Elixir is now required to be installed on your build system when compiling your application. Version 1.13.4 and above is required.
- Rebar3 `rebar_mix` plugin installed in your Rebar3 plugins
- For full details, see the [Erlang SDK reference](https://developer.harness.io/docs/feature-flags/ff-sdks/server-sdks/erlang-sdk-reference/#for-erlang-applications)

### Enhancements
- Implemented retry logic for authentication, polling, and metrics services for resilience and fault tolerance.
- Changes supervisor
### Fixes
- Swaps out murmur3 nif library which was giving unpredictable runtime behaviour in favour of pure Elixir implementation


## [1.2.1] - 2023-06-29
### Fixes
The optional configuration option introduced in 1.2.0 would only work if the application level was set to `info` - this change now sets the `cfclient_evaluation` module to `info` level if `verbose_evaluation_logs` is enabled.
Expand Down
80 changes: 49 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,18 @@ For a sample FF Erlang SDK Project for Elixir, see our

![FeatureFlags](https://github.com/harness/ff-erlang-server-sdk/raw/main/docs/images/ff-gui.png)

## Requirements
* **For Erlang** applications, install:

* Erlang/OTP 24 or later
* Rebar3 3.20.0 or later
* Important, since version 2.0.0 the SDK depends on an Elixir hashing library, so the following is also required for Erlang applications:
* Elixir 1.13.4 or later available on your build system
* Rebar3 `rebar_mix` plugin installed in your Rebar3 plugins

* **For Elixir** applications, install:
* Elixir version 1.13.4 or later
* OTP 24 or later

Erlang OTP 22 or newer.

## Quickstart

Expand All @@ -52,17 +61,26 @@ To install the SDK for Erlang based applications:
1. Add the SDK as a dependency to your `rebar.config` file:

```
{deps, [{cfclient, "1.2.0", {pkg, harness_ff_erlang_server_sdk}}]}.
{deps, [{cfclient, "2.0.0", {pkg, harness_ff_erlang_server_sdk}}]}.
```

2. Add the dependency to your project's `app.src`.

```erlang
{applications,
[kernel, stdlib, cfclient]
},
[kernel, stdlib, cfclient]
},
```

2. Add the `rebar_mix` plugin to your `rebar.config` file:

```erlang
{project_plugins, [rebar_mix]}.
```

Imporatant: for this plugin to work ensure you have Elixir 1.13.4 or later installed onto your build system


### For Elixir applications

To install the SDK for Elixir based applications:
Expand All @@ -72,7 +90,7 @@ To install the SDK for Elixir based applications:
```
defp deps do
[
{:cfclient, "~> 1.1.0", hex: :harness_ff_erlang_server_sdk}
{:cfclient, "~> 2.0.0", hex: :harness_ff_erlang_server_sdk}
]
```

Expand All @@ -84,19 +102,19 @@ Provide your API key in `sys.config` using an environment variable:

```erlang
[
{cfclient, [
{api_key, {environment_variable, "YOUR_API_KEY_ENV_VARIABLE"},
]}
{cfclient, [
{api_key, {environment_variable, "YOUR_API_KEY_ENV_VARIABLE"},
]}
].
```

Or you may provide the API key directly if required:

```erlang
[
{cfclient, [
{api_key, "YOUR_API_KEY"},
]}
{cfclient, [
{api_key, "YOUR_API_KEY"},
]}
].
```

Expand Down Expand Up @@ -140,21 +158,21 @@ config :cfclient,

```erlang
[{cfclient, [
%% Set the log level of the SDK to debug
{log_level, debug},
{api_key, {envrionment_variable, "YOUR_API_KEY_ENV_VARIABLE"},
{config, [
{config_url, "https://config.ff.harness.io/api/1.0"},
{events_url, "https://config.ff.harness.io/api/1.0"},
{poll_interval, 60},
{analytics_enabled, true},
]},
]}]
%% Set the log level of the SDK to debug
{log_level, debug},
{api_key, {envrionment_variable, "YOUR_API_KEY_ENV_VARIABLE"},
{config, [
{config_url, "https://config.ff.harness.io/api/1.0"},
{events_url, "https://config.ff.harness.io/api/1.0"},
{poll_interval, 60},
{analytics_enabled, true},
]},
]}]
```

### Enable Verbose Evaluation Logs

Evaluation logs are `debug` level by default. If required, they can be changed to `info` level. This is useful if production environments do not use `debug` level, but there is a requirement to check low level evaluation logs.
Evaluation logs are `debug` level by default. If required, they can be changed to `info` level. This is useful if production environments do not use `debug` level, but there is a requirement to check low level evaluation logs.
Note that this will only affect evaluation log statements.

#### Elixir
Expand All @@ -174,7 +192,7 @@ config :cfclient,
]]
```

#### Erlang
#### Erlang

```erlang
[{cfclient, [
Expand All @@ -194,11 +212,11 @@ config :cfclient,
## Run multiple instances of the SDK

The SDK by default starts up a single instance called `default` which is configured with your project API key.
If different parts of your application need to use specific [projects](https://developer.harness.io/docs/feature-flags/ff-using-flags/ff-creating-flag/create-a-project/), you can start up additional client instances using by defining additional configuration for each unique project.
If different parts of your application need to use specific [projects](https://developer.harness.io/docs/feature-flags/ff-using-flags/ff-creating-flag/create-a-project/), you can start up additional client instances using by defining additional configuration for each unique project.

### Erlang Project Config
### Erlang Project Config

The additional project config is defined in `sys.config`
The additional project config is defined in `sys.config`

The following `sys.config` snippet starts up two additional instances as well along with the default instance:

Expand Down Expand Up @@ -259,7 +277,7 @@ If you don't require the default instance to be started up, you can do:
```

In your application supervisor, e.g. `src/myapp_sup.erl`, start up a `cfclient_instance`
for each additional project. As the default instance is booted when your application starts, you cannot (and don't need to) start it here.
for each additional project. As the default instance is booted when your application starts, you cannot (and don't need to) start it here.
```erlang
init(Args) ->
Expand Down Expand Up @@ -334,8 +352,8 @@ multi_instance_evaluations() ->
]
```
2. In your application supervisor, e.g. `lib/myapp/supervisor.ex`, start up `cfclient_instance`
for each of the additional project configurations you provided above. As the default instance is booted when your application starts, you cannot (and don't need to) start it here:
2. In your application supervisor, e.g. `lib/myapp/supervisor.ex`, start up `cfclient_instance`
for each of the additional project configurations you provided above. As the default instance is booted when your application starts, you cannot (and don't need to) start it here:

```elixir
def init(_opts) do
Expand Down Expand Up @@ -533,4 +551,4 @@ In order to run the tests, pull the submodules:
```command
git submodule update --init
```
```
43 changes: 0 additions & 43 deletions doc/.build

This file was deleted.

144 changes: 0 additions & 144 deletions doc/404.html

This file was deleted.

Loading

0 comments on commit f4e2fa8

Please sign in to comment.