Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ compile_rust.sh @Datadog/libdatadog-apm
# APM IDM Team
/src/ @DataDog/apm-idm-php

# FFE (Feature Flagging & Experimentation) SDK Team
/src/DDTrace/FeatureFlags/ @DataDog/feature-flagging-and-experimentation-sdk
/src/DDTrace/OpenFeature/ @DataDog/feature-flagging-and-experimentation-sdk
/tests/FeatureFlags/ @DataDog/feature-flagging-and-experimentation-sdk

# Release files
Cargo.lock @DataDog/apm-php @DataDog/profiling-php @Datadog/libdatadog-apm
package.xml @DataDog/apm-php @DataDog/profiling-php @Datadog/asm-php
Expand Down
3 changes: 2 additions & 1 deletion components-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ libdd-telemetry-ffi = { path = "../libdatadog/libdd-telemetry-ffi", default-feat
datadog-live-debugger = { path = "../libdatadog/datadog-live-debugger" }
datadog-live-debugger-ffi = { path = "../libdatadog/datadog-live-debugger-ffi", default-features = false }
datadog-ipc = { path = "../libdatadog/datadog-ipc" }
datadog-remote-config = { path = "../libdatadog/datadog-remote-config" }
datadog-remote-config = { path = "../libdatadog/datadog-remote-config", features = ["ffe"] }
datadog-sidecar = { path = "../libdatadog/datadog-sidecar" }
datadog-sidecar-ffi = { path = "../libdatadog/datadog-sidecar-ffi" }
libdd-tinybytes = { path = "../libdatadog/libdd-tinybytes" }
libdd-trace-utils = { path = "../libdatadog/libdd-trace-utils" }
libdd-crashtracker-ffi = { path = "../libdatadog/libdd-crashtracker-ffi", default-features = false, features = ["collector"] }
libdd-library-config-ffi = { path = "../libdatadog/libdd-library-config-ffi", default-features = false }
spawn_worker = { path = "../libdatadog/spawn_worker" }
datadog-ffe = { path = "../libdatadog/datadog-ffe" }
anyhow = { version = "1.0" }
const-str = "0.5.6"
itertools = "0.11.0"
Expand Down
34 changes: 33 additions & 1 deletion components-rs/ddtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,46 @@ uint32_t ddog_get_logs_count(ddog_CharSlice level);

void ddog_init_remote_config(bool live_debugging_enabled,
bool appsec_activation,
bool appsec_config);
bool appsec_config,
bool ffe_enabled);

struct ddog_RemoteConfigState *ddog_init_remote_config_state(const struct ddog_Endpoint *endpoint);

const char *ddog_remote_config_get_path(const struct ddog_RemoteConfigState *remote_config);

bool ddog_process_remote_configs(struct ddog_RemoteConfigState *remote_config);

bool ddog_ffe_load_config(const char *json);

bool ddog_ffe_has_config(void);

bool ddog_ffe_config_changed(void);

struct FfeResult;

struct FfeAttribute {
const char *key;
int32_t value_type; /* 0=string, 1=number, 2=bool */
const char *string_value;
double number_value;
bool bool_value;
Comment on lines +83 to +86
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: can shave some 8 bytes from the struct by reordering fields:

Suggested change
int32_t value_type; /* 0=string, 1=number, 2=bool */
const char *string_value;
double number_value;
bool bool_value;
uint8_t value_type; /* 0=string, 1=number, 2=bool */
bool bool_value;
const char *string_value;
double number_value;

or sort fields from bigger to smaller.

Or better yet, use union:

struct FfeAttribute {
    const char *key;
    uint8_t value_type;
    union {
        const char *string_value;
        double number_value;
        bool bool_value;
    } value;
};

};

struct FfeResult *ddog_ffe_evaluate(
const char *flag_key,
int32_t expected_type,
const char *targeting_key,
const struct FfeAttribute *attributes,
size_t attributes_count);

const char *ddog_ffe_result_value(const struct FfeResult *r);
const char *ddog_ffe_result_variant(const struct FfeResult *r);
const char *ddog_ffe_result_allocation_key(const struct FfeResult *r);
int32_t ddog_ffe_result_reason(const struct FfeResult *r);
int32_t ddog_ffe_result_error_code(const struct FfeResult *r);
bool ddog_ffe_result_do_log(const struct FfeResult *r);
void ddog_ffe_free_result(struct FfeResult *r);

bool ddog_type_can_be_instrumented(const struct ddog_RemoteConfigState *remote_config,
ddog_CharSlice typename_);

Expand Down
Loading
Loading