Skip to content

Commit dbab684

Browse files
avara1986dd-oleksiigyuheon0hemmettbutler
authored andcommitted
feat(ffe): integrate datadog-ffe (#15241)
#15231 to main --------- Co-authored-by: Oleksii Shmalko <[email protected]> Co-authored-by: Gyuheon Oh <[email protected]> Co-authored-by: Emmett Butler <[email protected]>
1 parent 920c2fd commit dbab684

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+7442
-1303
lines changed

.riot/requirements/104618a.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

.riot/requirements/1346280.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

.riot/requirements/183bf88.txt

Lines changed: 0 additions & 26 deletions
This file was deleted.

.riot/requirements/1d5d90b.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

.riot/requirements/68eb9ac.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

.riot/requirements/db50e43.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

ddtrace/internal/native/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from ._native import SerializationError # noqa: F401
1616
from ._native import TraceExporter # noqa: F401
1717
from ._native import TraceExporterBuilder # noqa: F401
18-
from ._native import ffande_process_config # noqa: F401
18+
from ._native import ffe # noqa: F401
1919
from ._native import logger # noqa: F401
2020
from ._native import store_metadata # noqa: F401
2121

ddtrace/internal/native/_native.pyi

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Dict, List, Literal, Optional
1+
from typing import Dict, List, Literal, Optional, Any
2+
from enum import Enum
23

34
class DDSketch:
45
def __init__(self): ...
@@ -447,11 +448,58 @@ class SerializationError(Exception):
447448

448449
...
449450

450-
def ffande_process_config(config_bytes: bytes) -> Optional[bool]:
451+
class ffe:
451452
"""
452-
Process feature flagging and experimentation configuration rules.
453-
454-
:param config_bytes: Raw bytes containing the configuration data
455-
:return: True if processing was successful, False otherwise, None on error
453+
Native Feature Flags and Experimentation module.
456454
"""
457-
...
455+
456+
class FlagType(Enum):
457+
String = ...
458+
Integer = ...
459+
Float = ...
460+
Boolean = ...
461+
Object = ...
462+
463+
class Reason(Enum):
464+
Static = ...
465+
Default = ...
466+
TargetingMatch = ...
467+
Split = ...
468+
Cached = ...
469+
Disabled = ...
470+
Unknown = ...
471+
Stale = ...
472+
Error = ...
473+
474+
class ErrorCode(Enum):
475+
TypeMismatch = ...
476+
ParseError = ...
477+
FlagNotFound = ...
478+
TargetingKeyMissing = ...
479+
InvalidContext = ...
480+
ProviderNotReady = ...
481+
General = ...
482+
483+
class ResolutionDetails:
484+
@property
485+
def value(self) -> Optional[Any]: ...
486+
@property
487+
def error_code(self) -> Optional[ffe.ErrorCode]: ...
488+
@property
489+
def error_message(self) -> Optional[str]: ...
490+
@property
491+
def reason(self) -> Optional[ffe.Reason]: ...
492+
@property
493+
def variant(self) -> Optional[str]: ...
494+
@property
495+
def allocation_key(self) -> Optional[str]: ...
496+
@property
497+
def flag_metadata(self) -> dict[str, str]: ...
498+
@property
499+
def do_log(self) -> bool: ...
500+
@property
501+
def extra_logging(self) -> Optional[dict[str, str]]: ...
502+
503+
class Configuration:
504+
def __init__(self, config_bytes: bytes) -> None: ...
505+
def resolve_value(self, flag_key: str, expected_type: ffe.FlagType, context: dict) -> ffe.ResolutionDetails: ...
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
from typing import Mapping
1+
from typing import Optional
22

3+
from ddtrace.internal.native._native import ffe
34

4-
FFE_CONFIG: Mapping = {}
5+
6+
FFE_CONFIG: Optional[ffe.Configuration] = None
57

68

79
def _get_ffe_config():
8-
"""Retrieve the current IAST context identifier from the ContextVar."""
10+
"""Retrieve the current FFE configuration."""
911
return FFE_CONFIG
1012

1113

12-
def _set_ffe_config(data):
14+
def _set_ffe_config(config):
15+
"""Set the FFE configuration."""
1316
global FFE_CONFIG
14-
"""Retrieve the current IAST context identifier from the ContextVar."""
15-
FFE_CONFIG = data
17+
FFE_CONFIG = config

ddtrace/internal/openfeature/_ffe_mock.py

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)