Skip to content
Merged
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
253 changes: 252 additions & 1 deletion .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions examples/v2/experiments/ListExperimentHoldouts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
List experiment holdouts returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.experiments_api import ExperimentsApi

# there is a valid "experiment" in the system
EXPERIMENT_DATA_ID = environ["EXPERIMENT_DATA_ID"]

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = ExperimentsApi(api_client)
response = api_instance.list_experiment_holdouts(
experiment_id=EXPERIMENT_DATA_ID,
)

print(response)
43 changes: 43 additions & 0 deletions src/datadog_api_client/v2/api/experiments_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
ExperimentsConcludeExperimentV2Request,
)
from datadog_api_client.v2.model.experiments_experiment_diagnostics_v2_dto import ExperimentsExperimentDiagnosticsV2DTO
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_array import (
ExperimentsExperimentHoldoutV2DTOArray,
)
from datadog_api_client.v2.model.experiments_experiment_metric_group_v2_dto_array import (
ExperimentsExperimentMetricGroupV2DTOArray,
)
Expand Down Expand Up @@ -834,6 +837,29 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._list_experiment_holdouts_endpoint = _Endpoint(
settings={
"response_type": (ExperimentsExperimentHoldoutV2DTOArray,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/experiments/{experiment_id}/holdouts",
"operation_id": "list_experiment_holdouts",
"http_method": "GET",
"version": "v2",
},
params_map={
"experiment_id": {
"required": True,
"openapi_types": (UUID,),
"attribute": "experiment_id",
"location": "path",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._list_experiment_metric_groups_endpoint = _Endpoint(
settings={
"response_type": (ExperimentsExperimentMetricGroupV2DTOArray,),
Expand Down Expand Up @@ -2196,6 +2222,23 @@ def get_subject_type(

return self._get_subject_type_endpoint.call_with_http_info(**kwargs)

def list_experiment_holdouts(
self,
experiment_id: UUID,
) -> ExperimentsExperimentHoldoutV2DTOArray:
"""List experiment holdouts.

List the holdouts an experiment is attached to, in evaluation order: MANAGED holdouts first, starting with the GLOBAL holdout, followed by EXTERNAL holdouts. For a draft experiment, the response includes the GLOBAL holdout that the experiment would join if it started. The response excludes archived and deleted holdouts, and MANAGED holdouts past their analysis window. EXTERNAL holdouts are listed until they are archived. MANAGED holdouts are listed only for experiments that use a Datadog feature flag, because Datadog serves holdouts only through its flags. The order matches the experiment's ``holdout_ids`` attribute.

:param experiment_id: The UUID of the experiment.
:type experiment_id: UUID
:rtype: ExperimentsExperimentHoldoutV2DTOArray
"""
kwargs: Dict[str, Any] = {}
kwargs["experiment_id"] = experiment_id

return self._list_experiment_holdouts_endpoint.call_with_http_info(**kwargs)

def list_experiment_metric_groups(
self,
experiment_id: UUID,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data import (
ExperimentsExperimentHoldoutV2DTOData,
)


class ExperimentsExperimentHoldoutV2DTOArray(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data import (
ExperimentsExperimentHoldoutV2DTOData,
)

return {
"data": ([ExperimentsExperimentHoldoutV2DTOData],),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: List[ExperimentsExperimentHoldoutV2DTOData], **kwargs):
"""
Response containing the holdouts an experiment is attached to.

:param data: Holdouts the experiment is attached to, in evaluation order.
:type data: [ExperimentsExperimentHoldoutV2DTOData]
"""
super().__init__(kwargs)

self_.data = data
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
UUID,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_attributes import (
ExperimentsExperimentHoldoutV2DTODataAttributes,
)
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_type import (
ExperimentsExperimentHoldoutV2DTODataType,
)


class ExperimentsExperimentHoldoutV2DTOData(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_attributes import (
ExperimentsExperimentHoldoutV2DTODataAttributes,
)
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_type import (
ExperimentsExperimentHoldoutV2DTODataType,
)

return {
"attributes": (ExperimentsExperimentHoldoutV2DTODataAttributes,),
"id": (UUID,),
"type": (ExperimentsExperimentHoldoutV2DTODataType,),
}

attribute_map = {
"attributes": "attributes",
"id": "id",
"type": "type",
}

def __init__(
self_,
id: UUID,
type: ExperimentsExperimentHoldoutV2DTODataType,
attributes: Union[ExperimentsExperimentHoldoutV2DTODataAttributes, UnsetType] = unset,
**kwargs,
):
"""
A holdout the experiment is attached to.

:param attributes: Attributes of a holdout that the experiment is attached to.
:type attributes: ExperimentsExperimentHoldoutV2DTODataAttributes, optional

:param id: Identifier of the holdout.
:type id: UUID

:param type: Experiment holdout resource type.
:type type: ExperimentsExperimentHoldoutV2DTODataType
"""
if attributes is not unset:
kwargs["attributes"] = attributes
super().__init__(kwargs)

self_.id = id
self_.type = type
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
none_type,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_attributes_holdout_type import (
ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType,
)
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_attributes_kind import (
ExperimentsExperimentHoldoutV2DTODataAttributesKind,
)
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_attributes_state import (
ExperimentsExperimentHoldoutV2DTODataAttributesState,
)


class ExperimentsExperimentHoldoutV2DTODataAttributes(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_attributes_holdout_type import (
ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType,
)
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_attributes_kind import (
ExperimentsExperimentHoldoutV2DTODataAttributesKind,
)
from datadog_api_client.v2.model.experiments_experiment_holdout_v2_dto_data_attributes_state import (
ExperimentsExperimentHoldoutV2DTODataAttributesState,
)

return {
"evaluation_order": (int, none_type),
"holdout_type": (ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType,),
"key": (str,),
"kind": (ExperimentsExperimentHoldoutV2DTODataAttributesKind,),
"name": (str,),
"state": (ExperimentsExperimentHoldoutV2DTODataAttributesState,),
"traffic_allocation": (float,),
}

attribute_map = {
"evaluation_order": "evaluation_order",
"holdout_type": "holdout_type",
"key": "key",
"kind": "kind",
"name": "name",
"state": "state",
"traffic_allocation": "traffic_allocation",
}

def __init__(
self_,
evaluation_order: Union[int, none_type, UnsetType] = unset,
holdout_type: Union[ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType, none_type, UnsetType] = unset,
key: Union[str, UnsetType] = unset,
kind: Union[ExperimentsExperimentHoldoutV2DTODataAttributesKind, UnsetType] = unset,
name: Union[str, UnsetType] = unset,
state: Union[ExperimentsExperimentHoldoutV2DTODataAttributesState, UnsetType] = unset,
traffic_allocation: Union[float, UnsetType] = unset,
**kwargs,
):
"""
Attributes of a holdout that the experiment is attached to.

:param evaluation_order: Zero-based position of this MANAGED holdout in the experiment's evaluation order. The GLOBAL holdout is evaluated first. Null for EXTERNAL holdouts.
:type evaluation_order: int, none_type, optional

:param holdout_type: How Datadog serves a MANAGED holdout. GLOBAL holdouts apply to every eligible experiment of a subject type. SELECTIVE holdouts apply only to the experiments attached to them. Null for EXTERNAL holdouts.
:type holdout_type: ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType, none_type, optional

:param key: Key of the holdout.
:type key: str, optional

:param kind: Whether Datadog serves the holdout. Datadog serves MANAGED holdouts. EXTERNAL holdouts record what your own feature flagging system holds back, and Datadog does not serve them.
:type kind: ExperimentsExperimentHoldoutV2DTODataAttributesKind, optional

:param name: Display name of the holdout.
:type name: str, optional

:param state: Lifecycle phase of the holdout. PENDING holdouts have not started including experiments. INCLUDING holdouts are adding experiments. WAITING_FOR_ANALYSIS holdouts have stopped including experiments but have not started analysis. ANALYSING holdouts are in their analysis window. COMPLETE applies only to EXTERNAL holdouts that have ended their analysis window but are not archived.
:type state: ExperimentsExperimentHoldoutV2DTODataAttributesState, optional

:param traffic_allocation: Share of subjects the holdout holds back, from 0 to 1.
:type traffic_allocation: float, optional
"""
if evaluation_order is not unset:
kwargs["evaluation_order"] = evaluation_order
if holdout_type is not unset:
kwargs["holdout_type"] = holdout_type
if key is not unset:
kwargs["key"] = key
if kind is not unset:
kwargs["kind"] = kind
if name is not unset:
kwargs["name"] = name
if state is not unset:
kwargs["state"] = state
if traffic_allocation is not unset:
kwargs["traffic_allocation"] = traffic_allocation
super().__init__(kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType(ModelSimple):
"""
How Datadog serves a MANAGED holdout. GLOBAL holdouts apply to every eligible experiment of a subject type. SELECTIVE holdouts apply only to the experiments attached to them. Null for EXTERNAL holdouts.

:param value: Must be one of ["GLOBAL", "SELECTIVE", "UNKNOWN"].
:type value: str
"""

allowed_values = {
"GLOBAL",
"SELECTIVE",
"UNKNOWN",
}
GLOBAL: ClassVar["ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType"]
SELECTIVE: ClassVar["ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType"]
UNKNOWN: ClassVar["ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType"]

_nullable = True

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType.GLOBAL = (
ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType("GLOBAL")
)
ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType.SELECTIVE = (
ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType("SELECTIVE")
)
ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType.UNKNOWN = (
ExperimentsExperimentHoldoutV2DTODataAttributesHoldoutType("UNKNOWN")
)
Loading
Loading