diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 18e4572760..8c2525cf6a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -12968,6 +12968,13 @@ components: Allocation: description: Targeting rule (allocation) details for a feature flag environment. properties: + bandit_id: + description: >- + The bandit that serves through this targeting rule allocation. Absent when no bandit uses it. Until the bandit ends, only the bandit's own operations can change or delete the allocation. The allocation's position among the flag's targeting rules can still change. + example: "4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f" + format: uuid + readOnly: true + type: string created_at: description: The timestamp when the targeting rule allocation was created. example: "2024-01-01T12:00:00Z" @@ -49941,6 +49948,1117 @@ components: type: string x-enum-varnames: - ANALYSIS_PLANS + ExperimentsBanditArmDataStatus: + description: "Where the arm's reward variance came from, or why it's unavailable." + enum: + - usable + - insufficient_data + - zero_variance + - pooled_within_variance + - pooled_total_variance + example: usable + type: string + x-enum-varnames: + - USABLE + - INSUFFICIENT_DATA + - ZERO_VARIANCE + - POOLED_WITHIN_VARIANCE + - POOLED_TOTAL_VARIANCE + ExperimentsBanditBayesianPriorV2: + description: "The prior the bandit's estimates start from." + properties: + arm_standard_deviation: + description: "Prior standard deviation of each arm's mean around the shared mean." + example: 100 + format: double + type: number + grand_mean: + description: "Prior mean of the shared mean of the arms, in the metric's units." + example: 0 + format: double + type: number + grand_mean_standard_deviation: + description: "Prior standard deviation of the shared mean of the arms." + example: 10000 + format: double + type: number + required: + - grand_mean + - grand_mean_standard_deviation + - arm_standard_deviation + type: object + ExperimentsBanditConfidenceIntervalV2: + description: "A central interval around point_estimate at confidence_level." + properties: + lower: + description: "Lower bound of the interval." + example: 39.9 + format: double + type: number + upper: + description: "Upper bound of the interval." + example: 42.5 + format: double + type: number + required: + - lower + - upper + type: object + ExperimentsBanditDailyTrafficV2: + description: "An arm's observations and new subjects on one UTC day." + properties: + cumulative_new_subjects: + description: >- + The arm's new subjects from the bandit's start through this day, including days before the requested range. + example: 3600 + format: int64 + type: integer + cumulative_observations: + description: >- + The arm's observations from the bandit's start through this day, including days before the requested range. + example: 4260 + format: int64 + type: integer + date: + description: "A UTC date as YYYY-MM-DD." + example: "2026-10-29" + format: date + type: string + feature_flag_variant_id: + description: "The arm's variant ID on the flag." + example: 770e8400-e29b-41d4-a716-446655440001 + format: uuid + type: string + new_subjects: + description: "Subjects whose first valid observation is on this day and arm." + example: 300 + format: int64 + type: integer + observations: + description: "The arm's valid observations on this day." + example: 410 + format: int64 + type: integer + variant_key: + description: "The arm's variant key." + example: blue + nullable: true + type: string + required: + - date + - variant_key + - feature_flag_variant_id + - observations + - cumulative_observations + - new_subjects + - cumulative_new_subjects + type: object + ExperimentsBanditDesiredChange: + description: >- + The direction the bandit optimizes the metric in. It's fixed when the bandit starts. `null` before the first saved refresh. + enum: + - METRIC_INCREASES + - METRIC_DECREASES + example: METRIC_INCREASES + nullable: true + type: string + x-enum-varnames: + - METRIC_INCREASES + - METRIC_DECREASES + ExperimentsBanditFlagConfigurationV2: + description: >- + The flag rule the bandit serves through. Absent until a draft is added to a flag. Also absent when the caller lacks feature flag or environment read permissions, in which case `meta.warnings` includes `datadog_flag_configuration_omitted`. + properties: + allocation_key: + description: "The key of the bandit's rule on the flag. Exposures log it." + example: checkout-button-color-bandit + type: string + environment_id: + description: "The environment the bandit serves in." + example: 660e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + feature_flag_id: + description: "The flag the bandit serves through." + example: 550e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + targeting_rules: + description: "Who the bandit serves. When empty, the bandit serves everyone in the environment." + example: [] + items: + $ref: "#/components/schemas/ExperimentsTargetingRule" + type: array + required: + - feature_flag_id + - environment_id + - allocation_key + - targeting_rules + type: object + ExperimentsBanditNullableConfidenceIntervalV2: + description: "A central interval around point_estimate at confidence_level. `null` when the estimate is unavailable." + nullable: true + properties: + lower: + description: "Lower bound of the interval." + example: 39.9 + format: double + type: number + upper: + description: "Upper bound of the interval." + example: 42.5 + format: double + type: number + required: + - lower + - upper + type: object + ExperimentsBanditObservationCountsV2: + description: >- + How many observations the latest saved refresh saw, regardless of the requested range. `null` when its counts can't be read. + nullable: true + properties: + invalid: + description: "Observations the refresh couldn't use." + example: 40 + format: int64 + type: integer + total: + description: "All observations (the sum of the other three counts)." + example: 14210 + format: int64 + type: integer + valid_immature: + description: "Valid observations whose aggregation window is still open." + example: 420 + format: int64 + type: integer + valid_mature: + description: "Valid observations whose aggregation window has closed. The estimates use these." + example: 13750 + format: int64 + type: integer + required: + - total + - valid_mature + - valid_immature + - invalid + type: object + ExperimentsBanditOptimalVariantUnavailableReason: + description: "Why no optimal variant is reported. Absent when one is, or when the cause isn't known." + enum: + - NO_RESULTS_YET + - WARMUP + - NOT_ENOUGH_DATA + - NO_DIFFERENCE + - STATS_UNAVAILABLE + example: NOT_ENOUGH_DATA + type: string + x-enum-varnames: + - NO_RESULTS_YET + - WARMUP + - NOT_ENOUGH_DATA + - NO_DIFFERENCE + - STATS_UNAVAILABLE + ExperimentsBanditPointEstimateV2: + description: "An arm's point estimate from one saved refresh." + properties: + confidence_interval: + $ref: "#/components/schemas/ExperimentsBanditConfidenceIntervalV2" + data_as_of: + description: "The timestamp of the most recent warehouse data that the refresh read." + example: "2026-10-30T00:00:00Z" + format: date-time + nullable: true + type: string + feature_flag_variant_id: + description: "The arm's variant ID on the flag." + example: 770e8400-e29b-41d4-a716-446655440001 + format: uuid + type: string + point_estimate: + description: "The arm's estimated mean of the metric, in the metric's units." + example: 41.2 + format: double + type: number + refresh_id: + description: "The refresh the estimate comes from." + example: bb0e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + results_last_updated: + description: "When the refresh saved its results." + example: "2026-10-30T02:15:00Z" + format: date-time + type: string + variant_key: + description: "The arm's variant key." + example: blue + nullable: true + type: string + required: + - refresh_id + - results_last_updated + - data_as_of + - variant_key + - feature_flag_variant_id + - point_estimate + - confidence_interval + type: object + ExperimentsBanditPolicyKind: + description: >- + `WARMUP` serves the arms equally. `ADAPTIVE` serves the initial split or a split from a refresh. `FALLBACK` serves one variant after the bandit ends. + enum: + - WARMUP + - ADAPTIVE + - FALLBACK + example: ADAPTIVE + type: string + x-enum-varnames: + - WARMUP + - ADAPTIVE + - FALLBACK + ExperimentsBanditPolicyReason: + description: "Why the policy was applied." + enum: + - ACTIVATION + - REFRESH + - ARM_CHANGE + - SCHEDULED_END + - STOP + example: REFRESH + type: string + x-enum-varnames: + - ACTIVATION + - REFRESH + - ARM_CHANGE + - SCHEDULED_END + - STOP + ExperimentsBanditPolicyV2: + description: "The policy the bandit serves. `null` until the bandit starts." + nullable: true + properties: + applied_at: + description: "When the policy started being served." + example: "2026-10-30T02:15:00Z" + format: date-time + type: string + config_version: + description: "The configuration version the policy was made for." + example: 2 + format: int64 + type: integer + id: + description: "The policy ID. Each exposure logs it as `bandit.policy_id`." + example: dd0e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + kind: + $ref: "#/components/schemas/ExperimentsBanditPolicyKind" + reason: + $ref: "#/components/schemas/ExperimentsBanditPolicyReason" + variants: + description: "Each variant's share of traffic. The probabilities add up to 1." + items: + $ref: "#/components/schemas/ExperimentsBanditPolicyVariantV2" + type: array + required: + - id + - applied_at + - config_version + - kind + - reason + - variants + type: object + ExperimentsBanditPolicyVariantV2: + description: "A variant's share of traffic under a policy." + properties: + feature_flag_variant_id: + description: "The variant's ID on the flag." + example: 770e8400-e29b-41d4-a716-446655440001 + format: uuid + type: string + probability: + description: "The share of traffic the variant gets, from 0 to 1." + example: 0.3 + format: double + maximum: 1 + minimum: 0 + type: number + variant_key: + description: "The variant's key. `null` when it can't be resolved." + example: blue + nullable: true + type: string + required: + - variant_key + - feature_flag_variant_id + - probability + type: object + ExperimentsBanditPosteriorUnavailableReason: + description: "Why the arm's estimate and interval are unavailable. Absent when they are available." + enum: + - no_data + - insufficient_data + - zero_variance + example: no_data + type: string + x-enum-varnames: + - NO_DATA + - INSUFFICIENT_DATA + - ZERO_VARIANCE + ExperimentsBanditRefreshStatus: + description: "The status of the refresh." + enum: + - PENDING + - RUNNING + - SUCCEEDED + - FAILED + - CANCELLED + example: SUCCEEDED + type: string + x-enum-varnames: + - PENDING + - RUNNING + - SUCCEEDED + - FAILED + - CANCELLED + ExperimentsBanditRefreshV2: + description: "The most recently started refresh. `null` until one starts." + nullable: true + properties: + created_at: + description: "When the refresh was requested." + example: "2026-10-30T00:00:00Z" + format: date-time + type: string + ended_at: + description: "When the refresh finished. `null` while it runs." + example: "2026-10-30T02:15:00Z" + format: date-time + nullable: true + type: string + id: + description: "The refresh ID." + example: bb0e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + started_at: + description: "When the refresh started running. `null` while it is pending." + example: "2026-10-30T00:02:00Z" + format: date-time + nullable: true + type: string + status: + $ref: "#/components/schemas/ExperimentsBanditRefreshStatus" + required: + - id + - status + - created_at + - started_at + - ended_at + type: object + ExperimentsBanditResultsState: + description: >- + `WAITING_FOR_FIRST_REFRESH` until a refresh saves results. `STATS_UNAVAILABLE` when the latest saved refresh has no complete probabilities of being optimal. `ENDED` after the bandit is stopped or completed, and its last estimates are kept. Otherwise, `WARMUP` or `OPTIMIZING` indicates which policy the bandit serves. A paused bandit keeps its state. + enum: + - WAITING_FOR_FIRST_REFRESH + - WARMUP + - OPTIMIZING + - STATS_UNAVAILABLE + - ENDED + example: OPTIMIZING + type: string + x-enum-varnames: + - WAITING_FOR_FIRST_REFRESH + - WARMUP + - OPTIMIZING + - STATS_UNAVAILABLE + - ENDED + ExperimentsBanditResultsV2DTO: + description: "Response containing a bandit's results." + properties: + data: + $ref: "#/components/schemas/ExperimentsBanditResultsV2DTOData" + required: + - data + type: object + ExperimentsBanditResultsV2DTOData: + description: "JSON:API resource containing a bandit's results." + properties: + attributes: + $ref: "#/components/schemas/ExperimentsBanditResultsV2DTODataAttributes" + id: + description: "The bandit ID." + example: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + format: uuid + type: string + type: + $ref: "#/components/schemas/ExperimentsBanditResultsV2DTODataType" + required: + - id + - type + - attributes + type: object + ExperimentsBanditResultsV2DTODataAttributes: + description: "What the bandit's refreshes have learned." + properties: + confidence_level: + description: "The probability mass of each confidence interval." + example: 0.95 + format: double + maximum: 1 + minimum: 0 + type: number + config_version: + description: >- + The configuration version the latest saved refresh used. It can be older than the bandit's, because changes such as a new end date don't invalidate results. + example: 2 + format: int64 + nullable: true + type: integer + data_as_of: + description: "The timestamp of the most recent warehouse data that the latest saved refresh read." + example: "2026-10-30T00:00:00Z" + format: date-time + nullable: true + type: string + desired_change: + $ref: "#/components/schemas/ExperimentsBanditDesiredChange" + next_refresh_at: + description: >- + An estimate of when the next scheduled refresh starts. `null` when the bandit isn't running or the time can't be estimated. Only daily and hourly schedules get an estimate. + example: "2026-10-31T02:00:00Z" + format: date-time + nullable: true + type: string + optimal_variant_key: + description: >- + The key of the arm most likely to be best, when one arm leads and the bandit is outside warmup. `null` otherwise. + example: green + nullable: true + type: string + optimal_variant_unavailable_reason: + $ref: "#/components/schemas/ExperimentsBanditOptimalVariantUnavailableReason" + point_estimates: + description: >- + Each arm's point estimate from up to the latest 400 saved refreshes in the requested range, oldest first. + items: + $ref: "#/components/schemas/ExperimentsBanditPointEstimateV2" + type: array + refresh_id: + description: "The latest refresh that saved results. The estimates come from it." + example: bb0e8400-e29b-41d4-a716-446655440000 + format: uuid + nullable: true + type: string + results_last_updated: + description: "When the latest saved refresh saved its results." + example: "2026-10-30T02:15:00Z" + format: date-time + nullable: true + type: string + state: + $ref: "#/components/schemas/ExperimentsBanditResultsState" + statistics_status: + $ref: "#/components/schemas/ExperimentsBanditStatisticsStatus" + variants: + description: "One row per arm, in arm order." + items: + $ref: "#/components/schemas/ExperimentsBanditVariantResultV2" + type: array + required: + - state + - refresh_id + - config_version + - desired_change + - results_last_updated + - data_as_of + - next_refresh_at + - confidence_level + - optimal_variant_key + - variants + - point_estimates + type: object + ExperimentsBanditResultsV2DTODataType: + default: bandit-results + description: Bandit results resource type. + enum: + - bandit-results + example: bandit-results + type: string + x-enum-varnames: + - BANDIT_RESULTS + ExperimentsBanditScheduledEndFailureV2: + description: >- + Why the scheduled end couldn't run. It isn't retried until the end date or fallback changes. Absent when there's no failure. + properties: + failed_at: + description: "When the scheduled end failed." + example: "2026-12-01T00:00:05Z" + format: date-time + type: string + reason: + description: "Why the scheduled end failed." + example: The fallback variant is no longer on the flag. + type: string + required: + - failed_at + - reason + type: object + ExperimentsBanditStatisticsStatus: + description: "Whether the latest saved refresh calculated its statistics. Absent for older refreshes." + enum: + - calculated + - failed + example: calculated + type: string + x-enum-varnames: + - CALCULATED + - FAILED + ExperimentsBanditStatus: + description: >- + The bandit's status. `STOPPED` means the bandit was stopped and serves the variant chosen then. `COMPLETED` means it reached its scheduled end and serves its fallback. + enum: + - DRAFT + - SCHEDULED + - RUNNING + - PAUSED + - STOPPED + - COMPLETED + example: RUNNING + type: string + x-enum-varnames: + - DRAFT + - SCHEDULED + - RUNNING + - PAUSED + - STOPPED + - COMPLETED + ExperimentsBanditTrafficSummaryV2DTO: + description: "Response containing a bandit's traffic summary." + properties: + data: + $ref: "#/components/schemas/ExperimentsBanditTrafficSummaryV2DTOData" + required: + - data + type: object + ExperimentsBanditTrafficSummaryV2DTOData: + description: "JSON:API resource containing a bandit's traffic summary." + properties: + attributes: + $ref: "#/components/schemas/ExperimentsBanditTrafficSummaryV2DTODataAttributes" + id: + description: "The bandit ID." + example: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + format: uuid + type: string + type: + $ref: "#/components/schemas/ExperimentsBanditTrafficSummaryV2DTODataType" + required: + - id + - type + - attributes + type: object + ExperimentsBanditTrafficSummaryV2DTODataAttributes: + description: "What the bandit has observed, as of its latest saved refresh." + properties: + daily: + description: >- + Valid observations per arm, grouped by the UTC day of their anchor time. Includes each day from the bandit's start to the data cutoff that overlaps the requested range. Days without observations have zero counts. Empty before the first saved refresh. + items: + $ref: "#/components/schemas/ExperimentsBanditDailyTrafficV2" + type: array + data_as_of: + description: "The timestamp of the most recent warehouse data that the latest saved refresh read." + example: "2026-10-30T00:00:00Z" + format: date-time + nullable: true + type: string + observation_counts: + $ref: "#/components/schemas/ExperimentsBanditObservationCountsV2" + refresh_id: + description: "The latest refresh that saved results. The counts come from it." + example: bb0e8400-e29b-41d4-a716-446655440000 + format: uuid + nullable: true + type: string + total_subjects: + description: "Distinct subjects with a valid observation, regardless of the requested range." + example: 11900 + format: int64 + type: integer + variants: + description: "One row per arm, regardless of the requested range." + items: + $ref: "#/components/schemas/ExperimentsBanditTrafficVariantV2" + type: array + required: + - refresh_id + - data_as_of + - observation_counts + - total_subjects + - variants + - daily + type: object + ExperimentsBanditTrafficSummaryV2DTODataType: + default: bandit-traffic-summary + description: Bandit traffic summary resource type. + enum: + - bandit-traffic-summary + example: bandit-traffic-summary + type: string + x-enum-varnames: + - BANDIT_TRAFFIC_SUMMARY + ExperimentsBanditTrafficVariantV2: + description: "An arm's observations and subjects in total." + properties: + feature_flag_variant_id: + description: "The arm's variant ID on the flag." + example: 770e8400-e29b-41d4-a716-446655440001 + format: uuid + type: string + observations: + description: "The arm's valid observations, regardless of whether their aggregation windows have closed." + example: 4260 + format: int64 + type: integer + subjects: + description: >- + Subjects whose first valid observation is on this arm. A subject counts once, on the arm its reward goes to. + example: 3600 + format: int64 + type: integer + variant_key: + description: "The arm's variant key." + example: blue + nullable: true + type: string + required: + - variant_key + - feature_flag_variant_id + - observations + - subjects + type: object + ExperimentsBanditV2DTO: + description: "Response containing a bandit." + properties: + data: + $ref: "#/components/schemas/ExperimentsBanditV2DTOData" + meta: + $ref: "#/components/schemas/ExperimentsBanditV2ReadMetaDTO" + required: + - data + type: object + ExperimentsBanditV2DTOData: + description: "JSON:API resource containing a bandit." + properties: + attributes: + $ref: "#/components/schemas/ExperimentsBanditV2DTODataAttributes" + id: + description: "The bandit ID." + example: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + format: uuid + type: string + type: + $ref: "#/components/schemas/ExperimentsBanditV2DTODataType" + required: + - id + - type + - attributes + type: object + ExperimentsBanditV2DTODataAttributes: + description: "A bandit's setup, the policy it serves, and its latest refresh." + properties: + active_policy: + $ref: "#/components/schemas/ExperimentsBanditPolicyV2" + aggregation_window_seconds: + description: "The aggregation window: how long after an exposure the bandit keeps counting its reward, in seconds." + example: 3600 + format: int64 + type: integer + bayesian_prior: + $ref: "#/components/schemas/ExperimentsBanditBayesianPriorV2" + config_version: + description: "The version of the bandit's configuration. Each saved change adds one." + example: 2 + format: int64 + type: integer + created_at: + description: "When the bandit was created." + example: "2026-10-22T12:00:00Z" + format: date-time + type: string + datadog_flag_configuration: + $ref: "#/components/schemas/ExperimentsBanditFlagConfigurationV2" + description: + description: "The bandit's description." + example: Find the button color that maximizes checkout revenue. + type: string + ended_at: + description: "When the bandit was stopped or reached its scheduled end. `null` while it hasn't ended." + example: "2026-12-01T00:00:00Z" + format: date-time + nullable: true + type: string + exposure_sql_model_id: + description: "The exposure SQL model the bandit reads its exposures from. `null` until set on a draft." + example: aa0e8400-e29b-41d4-a716-446655440000 + format: uuid + nullable: true + type: string + latest_refresh: + $ref: "#/components/schemas/ExperimentsBanditRefreshV2" + lookback_seconds: + description: "How far back each refresh reads observations, in seconds." + example: 2592000 + format: int64 + type: integer + metric_id: + description: "The metric the bandit optimizes. `null` until set on a draft." + example: 990e8400-e29b-41d4-a716-446655440000 + format: uuid + nullable: true + type: string + name: + description: "The bandit's name." + example: Checkout button color + type: string + optimal_variant_key: + description: >- + The key of the arm most likely to be best, when one arm leads and the bandit is outside warmup. `null` otherwise. Matches Get bandit results. + example: green + nullable: true + type: string + optimal_variant_unavailable_reason: + $ref: "#/components/schemas/ExperimentsBanditOptimalVariantUnavailableReason" + refresh_schedule_id: + description: "The schedule the bandit refreshes on." + example: cc0e8400-e29b-41d4-a716-446655440000 + nullable: true + type: string + scheduled_end_at: + description: "When the bandit ends and serves its fallback. `null` when it has no scheduled end." + example: "2026-12-01T00:00:00Z" + format: date-time + nullable: true + type: string + scheduled_end_failure: + $ref: "#/components/schemas/ExperimentsBanditScheduledEndFailureV2" + started_at: + description: "When the bandit started. `null` until it starts." + example: "2026-10-23T09:00:00Z" + format: date-time + nullable: true + type: string + status: + $ref: "#/components/schemas/ExperimentsBanditStatus" + subject_type_id: + description: "The subject type the bandit randomizes and measures by. `null` until set on a draft." + example: 880e8400-e29b-41d4-a716-446655440000 + format: uuid + nullable: true + type: string + tags: + description: "The bandit's tags, without team tags." + example: + - checkout + items: + description: "A tag on the bandit." + type: string + type: array + teams: + description: "Handles of the teams that own the bandit." + example: + - growth + items: + description: "A team handle." + type: string + type: array + updated_at: + description: "When the bandit was last changed." + example: "2026-10-30T02:15:00Z" + format: date-time + type: string + variants: + description: >- + The flag variants the bandit uses: its arms in arm order, then its fallback when the fallback isn't an arm. + items: + $ref: "#/components/schemas/ExperimentsBanditVariantV2" + type: array + warmup_seconds: + description: >- + How long the bandit serves its arms equally after it starts, in seconds. `null` when it has no warmup. + example: 86400 + format: int64 + nullable: true + type: integer + required: + - name + - description + - status + - subject_type_id + - metric_id + - exposure_sql_model_id + - variants + - bayesian_prior + - lookback_seconds + - aggregation_window_seconds + - warmup_seconds + - refresh_schedule_id + - scheduled_end_at + - config_version + - active_policy + - latest_refresh + - optimal_variant_key + - tags + - teams + - started_at + - ended_at + - created_at + - updated_at + type: object + ExperimentsBanditV2DTODataType: + default: bandits + description: Bandit resource type. + enum: + - bandits + example: bandits + type: string + x-enum-varnames: + - BANDITS + ExperimentsBanditV2ListDTOArray: + description: "Response containing a page of bandit summaries." + properties: + data: + description: "Bandits on this page." + items: + $ref: "#/components/schemas/ExperimentsBanditV2ListDTOData" + type: array + links: + $ref: "#/components/schemas/ExperimentsOffsetLinks" + meta: + $ref: "#/components/schemas/ExperimentsOffsetMeta" + required: + - data + - meta + - links + type: object + ExperimentsBanditV2ListDTOData: + description: "JSON:API resource containing a bandit summary." + properties: + attributes: + $ref: "#/components/schemas/ExperimentsBanditV2ListDTODataAttributes" + id: + description: "The bandit ID." + example: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + format: uuid + type: string + type: + $ref: "#/components/schemas/ExperimentsBanditV2DTODataType" + required: + - id + - type + - attributes + type: object + ExperimentsBanditV2ListDTODataAttributes: + description: "Summary of a bandit. Use Get bandit for its setup, active policy, and latest refresh." + properties: + created_at: + description: "When the bandit was created." + example: "2026-10-22T12:00:00Z" + format: date-time + type: string + description: + description: "The bandit's description." + example: Find the button color that maximizes checkout revenue. + type: string + ended_at: + description: "When the bandit was stopped or reached its scheduled end. `null` while it hasn't ended." + example: "2026-12-01T00:00:00Z" + format: date-time + nullable: true + type: string + metric_id: + description: "The metric the bandit optimizes. `null` until set on a draft." + example: 990e8400-e29b-41d4-a716-446655440000 + format: uuid + nullable: true + type: string + name: + description: "The bandit's name." + example: Checkout button color + type: string + optimal_variant_key: + description: >- + The key of the arm most likely to be best, when one arm leads and the bandit is outside warmup. `null` otherwise. + example: green + nullable: true + type: string + optimal_variant_unavailable_reason: + $ref: "#/components/schemas/ExperimentsBanditOptimalVariantUnavailableReason" + started_at: + description: "When the bandit started. `null` until it starts." + example: "2026-10-23T09:00:00Z" + format: date-time + nullable: true + type: string + status: + $ref: "#/components/schemas/ExperimentsBanditStatus" + subject_type_id: + description: "The subject type the bandit randomizes and measures by. `null` until set on a draft." + example: 880e8400-e29b-41d4-a716-446655440000 + format: uuid + nullable: true + type: string + tags: + description: "The bandit's tags, without team tags." + example: + - checkout + items: + description: "A tag on the bandit." + type: string + type: array + teams: + description: "Handles of the teams that own the bandit." + example: + - growth + items: + description: "A team handle." + type: string + type: array + updated_at: + description: "When the bandit was last changed." + example: "2026-10-30T02:15:00Z" + format: date-time + type: string + required: + - name + - description + - status + - subject_type_id + - metric_id + - optimal_variant_key + - tags + - teams + - started_at + - ended_at + - created_at + - updated_at + type: object + ExperimentsBanditV2ReadMetaDTO: + description: "Information about the bandit response." + properties: + warnings: + description: "Warnings about the response. Absent when there are none." + items: + $ref: "#/components/schemas/ExperimentsBanditV2WarningDTO" + type: array + type: object + ExperimentsBanditV2WarningCode: + description: >- + Code that identifies the warning. `datadog_flag_configuration_omitted` means the caller lacks feature flag or environment read permissions, so the response leaves out `datadog_flag_configuration`. + enum: + - datadog_flag_configuration_omitted + example: datadog_flag_configuration_omitted + type: string + x-enum-varnames: + - DATADOG_FLAG_CONFIGURATION_OMITTED + ExperimentsBanditV2WarningDTO: + description: "A warning about the response that isn't an error." + properties: + code: + $ref: "#/components/schemas/ExperimentsBanditV2WarningCode" + detail: + description: "Explanation of the warning." + example: >- + The Datadog flag configuration is not included because feature flag and environment read permissions are required to view it. The bandit still has its flag configuration. + type: string + required: + - code + - detail + type: object + ExperimentsBanditVariantResultV2: + description: "An arm's estimates from the latest saved refresh." + properties: + confidence_interval: + $ref: "#/components/schemas/ExperimentsBanditNullableConfidenceIntervalV2" + data_status: + $ref: "#/components/schemas/ExperimentsBanditArmDataStatus" + feature_flag_variant_id: + description: "The arm's variant ID on the flag." + example: 770e8400-e29b-41d4-a716-446655440001 + format: uuid + type: string + mature_observations: + description: "The arm's valid observations whose aggregation window has closed. The estimate uses these." + example: 4120 + format: int64 + type: integer + point_estimate: + description: "The arm's estimated mean of the metric, in the metric's units. It isn't a lift." + example: 41.2 + format: double + nullable: true + type: number + posterior_unavailable_reason: + $ref: "#/components/schemas/ExperimentsBanditPosteriorUnavailableReason" + probability_of_being_optimal: + description: "The probability that this arm is the best." + example: 0.08 + format: double + maximum: 1 + minimum: 0 + nullable: true + type: number + variant_key: + description: "The arm's variant key." + example: blue + nullable: true + type: string + required: + - variant_key + - feature_flag_variant_id + - mature_observations + - probability_of_being_optimal + - point_estimate + - confidence_interval + type: object + ExperimentsBanditVariantV2: + description: "A flag variant the bandit uses." + properties: + feature_flag_variant_id: + description: "The variant's ID on the flag." + example: 770e8400-e29b-41d4-a716-446655440001 + format: uuid + type: string + is_active: + description: "Whether the variant is one of the arms the bandit chooses between." + example: true + type: boolean + is_fallback: + description: >- + Whether the variant is served when the bandit reaches its scheduled end. At most one variant is the fallback. + example: true + type: boolean + key: + description: >- + The variant's key. An arm keeps the key it had when it was added, because exposures are matched on it. `null` only for a fallback deleted from the flag. + example: blue + nullable: true + type: string + name: + description: "The variant's name on the flag. `null` when it is no longer on the flag." + example: Blue + nullable: true + type: string + required: + - feature_flag_variant_id + - key + - name + - is_active + - is_fallback + type: object ExperimentsCancelExperimentV2Request: description: "Request to cancel an experiment and record a reason." example: @@ -183851,6 +184969,554 @@ paths: operator: AND permissions: - product_analytics_experiments_write + /api/v2/experiments/bandits: + get: + description: >- + List the organization's bandits, newest first by default. Each item is a summary. For a bandit's setup, active policy, and latest refresh, use Get bandit. Bandits must be enabled for the organization. + operationId: ListBandits + parameters: + - description: Number of results to skip for pagination. Defaults to 0 when omitted. + in: query + name: page[offset] + schema: + description: "Number of results to skip for pagination. Defaults to 0 when omitted." + format: int64 + type: integer + - description: >- + Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links. + in: query + name: page[limit] + schema: + description: |- + Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are + clamped to 50). The response includes meta.page (with total) and pagination links. + format: int64 + type: integer + - description: "Find bandits whose names contain the search text, regardless of case." + in: query + name: search + schema: + description: "Find bandits whose names contain the search text, regardless of case." + type: string + - description: >- + Sort fields: `name`, `created_at`, or `updated_at`. Use a comma-separated list in priority order; for example, `name,-created_at`. Prefix each field with `-` for descending. Defaults to `created_at` descending. + in: query + name: sort + schema: + description: |- + Sort fields: `name`, `created_at`, or `updated_at`. Use a comma-separated list in priority order; for example, + `name,-created_at`. Prefix each field with `-` for descending. Defaults to `created_at` descending. + type: string + - description: |- + Filter by bandit status. Accepted values are `DRAFT`, `SCHEDULED`, `RUNNING`, `PAUSED`, `STOPPED`, and `COMPLETED`. + Repeat this parameter to select several statuses; for example, `status=RUNNING&status=PAUSED`. + in: query + name: status + schema: + description: |- + Filter by bandit status. Accepted values are `DRAFT`, `SCHEDULED`, `RUNNING`, `PAUSED`, `STOPPED`, and `COMPLETED`. + Repeat this parameter to select several statuses; for example, `status=RUNNING&status=PAUSED`. + items: + description: "Bandit status to include in the results." + type: string + type: array + - description: |- + Filter by subject type UUID. Repeat this parameter to supply several IDs. A bandit matches if it uses any + listed subject type. + in: query + name: subject_type_id + schema: + description: |- + Filter by subject type UUID. Repeat this parameter to supply several IDs. A bandit matches if it uses + any listed subject type. + items: + description: "UUID of a subject type to match." + format: uuid + type: string + type: array + - description: |- + Filter by tag name. Repeat this parameter to supply several tags. A bandit matches if it has at least one + listed tag. Use `team:` to filter by team. When both tags and teams are given, a bandit must match + one of each. + in: query + name: tags + schema: + description: |- + Filter by tag name. Repeat this parameter to supply several tags. A bandit matches if it has at least + one listed tag. Use `team:` to filter by team. When both tags and teams are given, a bandit must + match one of each. + items: + description: "Tag name, or `team:`, to match against bandit tags." + type: string + type: array + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2026-10-22T12:00:00Z" + description: Find the button color that maximizes checkout revenue. + ended_at: + metric_id: 990e8400-e29b-41d4-a716-446655440000 + name: Checkout button color + optimal_variant_key: green + started_at: "2026-10-23T09:00:00Z" + status: RUNNING + subject_type_id: 880e8400-e29b-41d4-a716-446655440000 + tags: + - checkout + teams: + - growth + updated_at: "2026-10-30T02:15:00Z" + id: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + type: bandits + links: + first: https://api.datadoghq.com/api/v2/experiments/bandits?page%5Blimit%5D=25&page%5Boffset%5D=0 + last: https://api.datadoghq.com/api/v2/experiments/bandits?page%5Blimit%5D=25&page%5Boffset%5D=0 + self: https://api.datadoghq.com/api/v2/experiments/bandits?page%5Blimit%5D=25&page%5Boffset%5D=0 + meta: + page: + first_offset: 0 + last_offset: 0 + limit: 25 + next_offset: + offset: 0 + prev_offset: + total: 1 + type: offset_limit + schema: + $ref: "#/components/schemas/ExperimentsBanditV2ListDTOArray" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Invalid query parameter: an unknown status or sort field, a subject_type_id that isn't a UUID, a search over 1024 characters, or a malformed page parameter. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Missing or invalid authentication (dd-api-key + dd-application-key headers, or a valid user session). + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Bandits are not enabled for the organization, or the caller lacks the product_analytics_experiments_read permission. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - product_analytics_experiments_read + summary: List bandits + tags: + - Experiments + x-permission: + operator: AND + permissions: + - product_analytics_experiments_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/experiments/bandits/{bandit_id}: + get: + description: >- + Get a bandit: its setup, the policy it serves, its latest refresh, and the arm most likely to be best. When the caller lacks feature flag or environment read permissions, the response omits `datadog_flag_configuration` and `meta.warnings` includes `datadog_flag_configuration_omitted`. Bandits must be enabled for the organization. + operationId: GetBandit + parameters: + - description: "The UUID of the bandit." + in: path + name: bandit_id + required: true + schema: + description: "The UUID of the bandit." + example: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + active_policy: + applied_at: "2026-10-30T02:15:00Z" + config_version: 2 + id: dd0e8400-e29b-41d4-a716-446655440000 + kind: ADAPTIVE + reason: REFRESH + variants: + - feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440001 + probability: 0.3 + variant_key: blue + - feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440002 + probability: 0.7 + variant_key: green + aggregation_window_seconds: 3600 + bayesian_prior: + arm_standard_deviation: 100 + grand_mean: 0 + grand_mean_standard_deviation: 10000 + config_version: 2 + created_at: "2026-10-22T12:00:00Z" + datadog_flag_configuration: + allocation_key: checkout-button-color-bandit + environment_id: 660e8400-e29b-41d4-a716-446655440000 + feature_flag_id: 550e8400-e29b-41d4-a716-446655440000 + targeting_rules: [] + description: Find the button color that maximizes checkout revenue. + ended_at: + exposure_sql_model_id: aa0e8400-e29b-41d4-a716-446655440000 + latest_refresh: + created_at: "2026-10-30T00:00:00Z" + ended_at: "2026-10-30T02:15:00Z" + id: bb0e8400-e29b-41d4-a716-446655440000 + started_at: "2026-10-30T00:02:00Z" + status: SUCCEEDED + lookback_seconds: 2592000 + metric_id: 990e8400-e29b-41d4-a716-446655440000 + name: Checkout button color + optimal_variant_key: green + refresh_schedule_id: cc0e8400-e29b-41d4-a716-446655440000 + scheduled_end_at: "2026-12-01T00:00:00Z" + started_at: "2026-10-23T09:00:00Z" + status: RUNNING + subject_type_id: 880e8400-e29b-41d4-a716-446655440000 + tags: + - checkout + teams: + - growth + updated_at: "2026-10-30T02:15:00Z" + variants: + - feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440001 + is_active: true + is_fallback: true + key: blue + name: Blue + - feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440002 + is_active: true + is_fallback: false + key: green + name: Green + warmup_seconds: 86400 + id: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + type: bandits + schema: + $ref: "#/components/schemas/ExperimentsBanditV2DTO" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Malformed bandit ID (not a valid UUID). + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Missing or invalid authentication (dd-api-key + dd-application-key headers, or a valid user session). + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Bandits are not enabled for the organization, or the caller lacks the product_analytics_experiments_read permission. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: No bandit with this ID exists for the organization. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - product_analytics_experiments_read + summary: Get bandit + tags: + - Experiments + x-permission: + operator: AND + permissions: + - product_analytics_experiments_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/experiments/bandits/{bandit_id}/results: + get: + description: >- + Get what a bandit's refreshes have learned: each arm's estimate and probability of being best from the latest saved refresh, and each arm's point estimate over time. `start` and `end` narrow only `point_estimates`, not the latest estimates. For observation counts, use Get bandit traffic summary. Bandits must be enabled for the organization. + operationId: GetBanditResults + parameters: + - description: "The UUID of the bandit." + in: path + name: bandit_id + required: true + schema: + description: "The UUID of the bandit." + example: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + format: uuid + type: string + - description: Return only point estimates from refreshes saved at or after this RFC3339 timestamp. Inclusive. + in: query + name: start + schema: + description: "Return only point estimates from refreshes saved at or after this RFC3339 timestamp. Inclusive." + format: date-time + type: string + - description: Return only point estimates from refreshes saved before this RFC3339 timestamp. Exclusive. + in: query + name: end + schema: + description: "Return only point estimates from refreshes saved before this RFC3339 timestamp. Exclusive." + format: date-time + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + confidence_level: 0.95 + config_version: 2 + data_as_of: "2026-10-30T00:00:00Z" + desired_change: METRIC_INCREASES + next_refresh_at: "2026-10-31T02:00:00Z" + optimal_variant_key: green + point_estimates: + - confidence_interval: + lower: 39.9 + upper: 42.5 + data_as_of: "2026-10-30T00:00:00Z" + feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440001 + point_estimate: 41.2 + refresh_id: bb0e8400-e29b-41d4-a716-446655440000 + results_last_updated: "2026-10-30T02:15:00Z" + variant_key: blue + - confidence_interval: + lower: 42.1 + upper: 43.9 + data_as_of: "2026-10-30T00:00:00Z" + feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440002 + point_estimate: 43.0 + refresh_id: bb0e8400-e29b-41d4-a716-446655440000 + results_last_updated: "2026-10-30T02:15:00Z" + variant_key: green + refresh_id: bb0e8400-e29b-41d4-a716-446655440000 + results_last_updated: "2026-10-30T02:15:00Z" + state: OPTIMIZING + statistics_status: calculated + variants: + - confidence_interval: + lower: 39.9 + upper: 42.5 + data_status: usable + feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440001 + mature_observations: 4120 + point_estimate: 41.2 + probability_of_being_optimal: 0.08 + variant_key: blue + - confidence_interval: + lower: 42.1 + upper: 43.9 + data_status: usable + feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440002 + mature_observations: 9630 + point_estimate: 43.0 + probability_of_being_optimal: 0.92 + variant_key: green + id: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + type: bandit-results + schema: + $ref: "#/components/schemas/ExperimentsBanditResultsV2DTO" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Malformed bandit ID (not a valid UUID), or start or end isn't an RFC3339 timestamp, or start isn't before end. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Missing or invalid authentication (dd-api-key + dd-application-key headers, or a valid user session). + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Bandits are not enabled for the organization, or the caller lacks the product_analytics_experiments_read permission. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: No bandit with this ID exists for the organization. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - product_analytics_experiments_read + summary: Get bandit results + tags: + - Experiments + x-permission: + operator: AND + permissions: + - product_analytics_experiments_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/experiments/bandits/{bandit_id}/traffic-summary: + get: + description: >- + Get what a bandit has observed, as of its latest saved refresh: observation counts, subjects, and each arm's valid observations and subjects in total and per UTC day. An observation is a subject's reward on the arm it was exposed to, counted on the UTC day of its anchor time. `start` and `end` narrow only `daily`, not the totals. Bandits must be enabled for the organization. + operationId: GetBanditTrafficSummary + parameters: + - description: "The UUID of the bandit." + in: path + name: bandit_id + required: true + schema: + description: "The UUID of the bandit." + example: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + format: uuid + type: string + - description: >- + Return only the UTC days that overlap the range starting at this RFC3339 timestamp. Inclusive. + in: query + name: start + schema: + description: "Return only the UTC days that overlap the range starting at this RFC3339 timestamp. Inclusive." + format: date-time + type: string + - description: >- + Return only the UTC days that overlap the range ending at this RFC3339 timestamp. Exclusive. + in: query + name: end + schema: + description: "Return only the UTC days that overlap the range ending at this RFC3339 timestamp. Exclusive." + format: date-time + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + daily: + - cumulative_new_subjects: 3600 + cumulative_observations: 4260 + date: "2026-10-29" + feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440001 + new_subjects: 300 + observations: 410 + variant_key: blue + - cumulative_new_subjects: 8300 + cumulative_observations: 9910 + date: "2026-10-29" + feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440002 + new_subjects: 880 + observations: 1210 + variant_key: green + data_as_of: "2026-10-30T00:00:00Z" + observation_counts: + invalid: 40 + total: 14210 + valid_immature: 420 + valid_mature: 13750 + refresh_id: bb0e8400-e29b-41d4-a716-446655440000 + total_subjects: 11900 + variants: + - feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440001 + observations: 4260 + subjects: 3600 + variant_key: blue + - feature_flag_variant_id: 770e8400-e29b-41d4-a716-446655440002 + observations: 9910 + subjects: 8300 + variant_key: green + id: 4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f + type: bandit-traffic-summary + schema: + $ref: "#/components/schemas/ExperimentsBanditTrafficSummaryV2DTO" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Malformed bandit ID (not a valid UUID), or start or end isn't an RFC3339 timestamp, or start isn't before end. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Missing or invalid authentication (dd-api-key + dd-application-key headers, or a valid user session). + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: >- + Bandits are not enabled for the organization, or the caller lacks the product_analytics_experiments_read permission. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: No bandit with this ID exists for the organization. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - product_analytics_experiments_read + summary: Get bandit traffic summary + tags: + - Experiments + x-permission: + operator: AND + permissions: + - product_analytics_experiments_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/experiments/exposure-sql-models: get: description: >- @@ -183871,12 +185537,12 @@ paths: type: string type: array - description: >- - When true, archived models are included in the result. Defaults to false, so archived models are hidden. + When `true`, archived models are included in the result. Defaults to `false`, so archived models are hidden. in: query name: include_archived schema: description: |- - When true, archived models are included in the result. Defaults to false, so archived models are hidden. + When `true`, archived models are included in the result. Defaults to `false`, so archived models are hidden. type: boolean - description: >- Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links. @@ -183902,14 +185568,14 @@ paths: description: "Find exposure SQL models whose names contain the search text, regardless of case." type: string - description: |- - Sort field: name, created_at, or updated_at. Prefix with `-` for descending (for example, `-created_at`). - Defaults to created_at descending. + Sort field: `name`, `created_at`, or `updated_at`. Prefix with `-` for descending (for example, `-created_at`). + Defaults to `created_at` descending. in: query name: sort schema: description: |- - Sort field: name, created_at, or updated_at. Prefix with `-` for descending (for example, - `-created_at`). Defaults to created_at descending. + Sort field: `name`, `created_at`, or `updated_at`. Prefix with `-` for descending (for example, + `-created_at`). Defaults to `created_at` descending. type: string responses: "200": diff --git a/examples/v2/experiments/GetBandit.py b/examples/v2/experiments/GetBandit.py new file mode 100644 index 0000000000..9d7a86e5ee --- /dev/null +++ b/examples/v2/experiments/GetBandit.py @@ -0,0 +1,19 @@ +""" +Get bandit returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.experiments_api import ExperimentsApi +from uuid import UUID + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["get_bandit"] = True +with ApiClient(configuration) as api_client: + api_instance = ExperimentsApi(api_client) + response = api_instance.get_bandit( + bandit_id=UUID("4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f"), + ) + + print(response) diff --git a/examples/v2/experiments/GetBanditResults.py b/examples/v2/experiments/GetBanditResults.py new file mode 100644 index 0000000000..7b71bcd052 --- /dev/null +++ b/examples/v2/experiments/GetBanditResults.py @@ -0,0 +1,19 @@ +""" +Get bandit results returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.experiments_api import ExperimentsApi +from uuid import UUID + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["get_bandit_results"] = True +with ApiClient(configuration) as api_client: + api_instance = ExperimentsApi(api_client) + response = api_instance.get_bandit_results( + bandit_id=UUID("4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f"), + ) + + print(response) diff --git a/examples/v2/experiments/GetBanditTrafficSummary.py b/examples/v2/experiments/GetBanditTrafficSummary.py new file mode 100644 index 0000000000..3d058654ed --- /dev/null +++ b/examples/v2/experiments/GetBanditTrafficSummary.py @@ -0,0 +1,19 @@ +""" +Get bandit traffic summary returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.experiments_api import ExperimentsApi +from uuid import UUID + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["get_bandit_traffic_summary"] = True +with ApiClient(configuration) as api_client: + api_instance = ExperimentsApi(api_client) + response = api_instance.get_bandit_traffic_summary( + bandit_id=UUID("4b1f3c2e-8d5a-4f6b-9c7e-1a2b3c4d5e6f"), + ) + + print(response) diff --git a/examples/v2/experiments/ListBandits.py b/examples/v2/experiments/ListBandits.py new file mode 100644 index 0000000000..1a98d67063 --- /dev/null +++ b/examples/v2/experiments/ListBandits.py @@ -0,0 +1,16 @@ +""" +List bandits returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.experiments_api import ExperimentsApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_bandits"] = True +with ApiClient(configuration) as api_client: + api_instance = ExperimentsApi(api_client) + response = api_instance.list_bandits() + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 7d8f36b32b..e44b58a5f1 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -609,6 +609,10 @@ def __init__( "v2.snooze_issue": False, "v2.get_eudm_device": False, "v2.get_eudm_devices": False, + "v2.get_bandit": False, + "v2.get_bandit_results": False, + "v2.get_bandit_traffic_summary": False, + "v2.list_bandits": False, "v2.clone_form": False, "v2.create_and_publish_form": False, "v2.create_form": False, diff --git a/src/datadog_api_client/v2/api/experiments_api.py b/src/datadog_api_client/v2/api/experiments_api.py index f3619759d2..8b6c6d1d8f 100644 --- a/src/datadog_api_client/v2/api/experiments_api.py +++ b/src/datadog_api_client/v2/api/experiments_api.py @@ -16,6 +16,10 @@ from datadog_api_client.v2.model.experiments_experiment_v2_list_dto_array import ExperimentsExperimentV2ListDTOArray from datadog_api_client.v2.model.experiments_experiment_v2_dto import ExperimentsExperimentV2DTO from datadog_api_client.v2.model.experiments_create_experiment_v2_request import ExperimentsCreateExperimentV2Request +from datadog_api_client.v2.model.experiments_bandit_v2_list_dto_array import ExperimentsBanditV2ListDTOArray +from datadog_api_client.v2.model.experiments_bandit_v2_dto import ExperimentsBanditV2DTO +from datadog_api_client.v2.model.experiments_bandit_results_v2_dto import ExperimentsBanditResultsV2DTO +from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto import ExperimentsBanditTrafficSummaryV2DTO from datadog_api_client.v2.model.experiments_exposure_sql_model_v2_dto_array import ( ExperimentsExposureSQLModelV2DTOArray, ) @@ -561,6 +565,95 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_bandit_endpoint = _Endpoint( + settings={ + "response_type": (ExperimentsBanditV2DTO,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/experiments/bandits/{bandit_id}", + "operation_id": "get_bandit", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "bandit_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "bandit_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_bandit_results_endpoint = _Endpoint( + settings={ + "response_type": (ExperimentsBanditResultsV2DTO,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/experiments/bandits/{bandit_id}/results", + "operation_id": "get_bandit_results", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "bandit_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "bandit_id", + "location": "path", + }, + "start": { + "openapi_types": (datetime,), + "attribute": "start", + "location": "query", + }, + "end": { + "openapi_types": (datetime,), + "attribute": "end", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_bandit_traffic_summary_endpoint = _Endpoint( + settings={ + "response_type": (ExperimentsBanditTrafficSummaryV2DTO,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/experiments/bandits/{bandit_id}/traffic-summary", + "operation_id": "get_bandit_traffic_summary", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "bandit_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "bandit_id", + "location": "path", + }, + "start": { + "openapi_types": (datetime,), + "attribute": "start", + "location": "query", + }, + "end": { + "openapi_types": (datetime,), + "attribute": "end", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_experiment_endpoint = _Endpoint( settings={ "response_type": (ExperimentsExperimentV2DTO,), @@ -837,6 +930,61 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_bandits_endpoint = _Endpoint( + settings={ + "response_type": (ExperimentsBanditV2ListDTOArray,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/experiments/bandits", + "operation_id": "list_bandits", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "page_offset": { + "openapi_types": (int,), + "attribute": "page[offset]", + "location": "query", + }, + "page_limit": { + "openapi_types": (int,), + "attribute": "page[limit]", + "location": "query", + }, + "search": { + "openapi_types": (str,), + "attribute": "search", + "location": "query", + }, + "sort": { + "openapi_types": (str,), + "attribute": "sort", + "location": "query", + }, + "status": { + "openapi_types": ([str],), + "attribute": "status", + "location": "query", + "collection_format": "multi", + }, + "subject_type_id": { + "openapi_types": ([UUID],), + "attribute": "subject_type_id", + "location": "query", + "collection_format": "multi", + }, + "tags": { + "openapi_types": ([str],), + "attribute": "tags", + "location": "query", + "collection_format": "multi", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_experiment_holdouts_endpoint = _Endpoint( settings={ "response_type": (ExperimentsExperimentHoldoutV2DTOArray,), @@ -2004,6 +2152,83 @@ def delete_subject_type( return self._delete_subject_type_endpoint.call_with_http_info(**kwargs) + def get_bandit( + self, + bandit_id: UUID, + ) -> ExperimentsBanditV2DTO: + """Get bandit. + + Get a bandit: its setup, the policy it serves, its latest refresh, and the arm most likely to be best. When the caller lacks feature flag or environment read permissions, the response omits ``datadog_flag_configuration`` and ``meta.warnings`` includes ``datadog_flag_configuration_omitted``. Bandits must be enabled for the organization. + + :param bandit_id: The UUID of the bandit. + :type bandit_id: UUID + :rtype: ExperimentsBanditV2DTO + """ + kwargs: Dict[str, Any] = {} + kwargs["bandit_id"] = bandit_id + + return self._get_bandit_endpoint.call_with_http_info(**kwargs) + + def get_bandit_results( + self, + bandit_id: UUID, + *, + start: Union[datetime, UnsetType] = unset, + end: Union[datetime, UnsetType] = unset, + ) -> ExperimentsBanditResultsV2DTO: + """Get bandit results. + + Get what a bandit's refreshes have learned: each arm's estimate and probability of being best from the latest saved refresh, and each arm's point estimate over time. ``start`` and ``end`` narrow only ``point_estimates`` , not the latest estimates. For observation counts, use Get bandit traffic summary. Bandits must be enabled for the organization. + + :param bandit_id: The UUID of the bandit. + :type bandit_id: UUID + :param start: Return only point estimates from refreshes saved at or after this RFC3339 timestamp. Inclusive. + :type start: datetime, optional + :param end: Return only point estimates from refreshes saved before this RFC3339 timestamp. Exclusive. + :type end: datetime, optional + :rtype: ExperimentsBanditResultsV2DTO + """ + kwargs: Dict[str, Any] = {} + kwargs["bandit_id"] = bandit_id + + if start is not unset: + kwargs["start"] = start + + if end is not unset: + kwargs["end"] = end + + return self._get_bandit_results_endpoint.call_with_http_info(**kwargs) + + def get_bandit_traffic_summary( + self, + bandit_id: UUID, + *, + start: Union[datetime, UnsetType] = unset, + end: Union[datetime, UnsetType] = unset, + ) -> ExperimentsBanditTrafficSummaryV2DTO: + """Get bandit traffic summary. + + Get what a bandit has observed, as of its latest saved refresh: observation counts, subjects, and each arm's valid observations and subjects in total and per UTC day. An observation is a subject's reward on the arm it was exposed to, counted on the UTC day of its anchor time. ``start`` and ``end`` narrow only ``daily`` , not the totals. Bandits must be enabled for the organization. + + :param bandit_id: The UUID of the bandit. + :type bandit_id: UUID + :param start: Return only the UTC days that overlap the range starting at this RFC3339 timestamp. Inclusive. + :type start: datetime, optional + :param end: Return only the UTC days that overlap the range ending at this RFC3339 timestamp. Exclusive. + :type end: datetime, optional + :rtype: ExperimentsBanditTrafficSummaryV2DTO + """ + kwargs: Dict[str, Any] = {} + kwargs["bandit_id"] = bandit_id + + if start is not unset: + kwargs["start"] = start + + if end is not unset: + kwargs["end"] = end + + return self._get_bandit_traffic_summary_endpoint.call_with_http_info(**kwargs) + def get_experiment( self, experiment_id: UUID, @@ -2222,6 +2447,65 @@ def get_subject_type( return self._get_subject_type_endpoint.call_with_http_info(**kwargs) + def list_bandits( + self, + *, + page_offset: Union[int, UnsetType] = unset, + page_limit: Union[int, UnsetType] = unset, + search: Union[str, UnsetType] = unset, + sort: Union[str, UnsetType] = unset, + status: Union[List[str], UnsetType] = unset, + subject_type_id: Union[List[UUID], UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + ) -> ExperimentsBanditV2ListDTOArray: + """List bandits. + + List the organization's bandits, newest first by default. Each item is a summary. For a bandit's setup, active policy, and latest refresh, use Get bandit. Bandits must be enabled for the organization. + + :param page_offset: Number of results to skip for pagination. Defaults to 0 when omitted. + :type page_offset: int, optional + :param page_limit: Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links. + :type page_limit: int, optional + :param search: Find bandits whose names contain the search text, regardless of case. + :type search: str, optional + :param sort: Sort fields: ``name`` , ``created_at`` , or ``updated_at``. Use a comma-separated list in priority order; for example, ``name,-created_at``. Prefix each field with ``-`` for descending. Defaults to ``created_at`` descending. + :type sort: str, optional + :param status: Filter by bandit status. Accepted values are ``DRAFT`` , ``SCHEDULED`` , ``RUNNING`` , ``PAUSED`` , ``STOPPED`` , and ``COMPLETED``. + Repeat this parameter to select several statuses; for example, ``status=RUNNING&status=PAUSED``. + :type status: [str], optional + :param subject_type_id: Filter by subject type UUID. Repeat this parameter to supply several IDs. A bandit matches if it uses any + listed subject type. + :type subject_type_id: [UUID], optional + :param tags: Filter by tag name. Repeat this parameter to supply several tags. A bandit matches if it has at least one + listed tag. Use ``team:`` to filter by team. When both tags and teams are given, a bandit must match + one of each. + :type tags: [str], optional + :rtype: ExperimentsBanditV2ListDTOArray + """ + kwargs: Dict[str, Any] = {} + if page_offset is not unset: + kwargs["page_offset"] = page_offset + + if page_limit is not unset: + kwargs["page_limit"] = page_limit + + if search is not unset: + kwargs["search"] = search + + if sort is not unset: + kwargs["sort"] = sort + + if status is not unset: + kwargs["status"] = status + + if subject_type_id is not unset: + kwargs["subject_type_id"] = subject_type_id + + if tags is not unset: + kwargs["tags"] = tags + + return self._list_bandits_endpoint.call_with_http_info(**kwargs) + def list_experiment_holdouts( self, experiment_id: UUID, @@ -2413,7 +2697,7 @@ def list_exposure_sql_models( :param include: Optional fields to include. Repeat this parameter to request several fields. ``counts`` adds experiment_count, which costs an extra aggregate query. :type include: [str], optional - :param include_archived: When true, archived models are included in the result. Defaults to false, so archived models are hidden. + :param include_archived: When ``true`` , archived models are included in the result. Defaults to ``false`` , so archived models are hidden. :type include_archived: bool, optional :param page_limit: Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links. :type page_limit: int, optional @@ -2421,8 +2705,8 @@ def list_exposure_sql_models( :type page_offset: int, optional :param search: Find exposure SQL models whose names contain the search text, regardless of case. :type search: str, optional - :param sort: Sort field: name, created_at, or updated_at. Prefix with ``-`` for descending (for example, ``-created_at`` ). - Defaults to created_at descending. + :param sort: Sort field: ``name`` , ``created_at`` , or ``updated_at``. Prefix with ``-`` for descending (for example, ``-created_at`` ). + Defaults to ``created_at`` descending. :type sort: str, optional :rtype: ExperimentsExposureSQLModelV2DTOArray """ diff --git a/src/datadog_api_client/v2/model/allocation.py b/src/datadog_api_client/v2/model/allocation.py index 0575664ee0..e9c26319ea 100644 --- a/src/datadog_api_client/v2/model/allocation.py +++ b/src/datadog_api_client/v2/model/allocation.py @@ -34,6 +34,7 @@ def openapi_types(_): from datadog_api_client.v2.model.variant_weight import VariantWeight return { + "bandit_id": (UUID,), "created_at": (datetime,), "environment_ids": ([UUID],), "experiment_id": (str, none_type), @@ -50,6 +51,7 @@ def openapi_types(_): } attribute_map = { + "bandit_id": "bandit_id", "created_at": "created_at", "environment_ids": "environment_ids", "experiment_id": "experiment_id", @@ -64,6 +66,9 @@ def openapi_types(_): "updated_at": "updated_at", "variant_weights": "variant_weights", } + read_only_vars = { + "bandit_id", + } def __init__( self_, @@ -77,6 +82,7 @@ def __init__( type: AllocationType, updated_at: datetime, variant_weights: List[VariantWeight], + bandit_id: Union[UUID, UnsetType] = unset, experiment_id: Union[str, none_type, UnsetType] = unset, exposure_schedule: Union[AllocationExposureSchedule, UnsetType] = unset, id: Union[UUID, UnsetType] = unset, @@ -85,6 +91,9 @@ def __init__( """ Targeting rule (allocation) details for a feature flag environment. + :param bandit_id: The bandit that serves through this targeting rule allocation. Absent when no bandit uses it. Until the bandit ends, only the bandit's own operations can change or delete the allocation. The allocation's position among the flag's targeting rules can still change. + :type bandit_id: UUID, optional + :param created_at: The timestamp when the targeting rule allocation was created. :type created_at: datetime @@ -124,6 +133,8 @@ def __init__( :param variant_weights: Weighted variant assignments for this targeting rule allocation. :type variant_weights: [VariantWeight] """ + if bandit_id is not unset: + kwargs["bandit_id"] = bandit_id if experiment_id is not unset: kwargs["experiment_id"] = experiment_id if exposure_schedule is not unset: diff --git a/src/datadog_api_client/v2/model/experiments_bandit_arm_data_status.py b/src/datadog_api_client/v2/model/experiments_bandit_arm_data_status.py new file mode 100644 index 0000000000..2741f31870 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_arm_data_status.py @@ -0,0 +1,47 @@ +# 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 ExperimentsBanditArmDataStatus(ModelSimple): + """ + Where the arm's reward variance came from, or why it's unavailable. + + :param value: Must be one of ["usable", "insufficient_data", "zero_variance", "pooled_within_variance", "pooled_total_variance"]. + :type value: str + """ + + allowed_values = { + "usable", + "insufficient_data", + "zero_variance", + "pooled_within_variance", + "pooled_total_variance", + } + USABLE: ClassVar["ExperimentsBanditArmDataStatus"] + INSUFFICIENT_DATA: ClassVar["ExperimentsBanditArmDataStatus"] + ZERO_VARIANCE: ClassVar["ExperimentsBanditArmDataStatus"] + POOLED_WITHIN_VARIANCE: ClassVar["ExperimentsBanditArmDataStatus"] + POOLED_TOTAL_VARIANCE: ClassVar["ExperimentsBanditArmDataStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditArmDataStatus.USABLE = ExperimentsBanditArmDataStatus("usable") +ExperimentsBanditArmDataStatus.INSUFFICIENT_DATA = ExperimentsBanditArmDataStatus("insufficient_data") +ExperimentsBanditArmDataStatus.ZERO_VARIANCE = ExperimentsBanditArmDataStatus("zero_variance") +ExperimentsBanditArmDataStatus.POOLED_WITHIN_VARIANCE = ExperimentsBanditArmDataStatus("pooled_within_variance") +ExperimentsBanditArmDataStatus.POOLED_TOTAL_VARIANCE = ExperimentsBanditArmDataStatus("pooled_total_variance") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_bayesian_prior_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_bayesian_prior_v2.py new file mode 100644 index 0000000000..9f6c21293e --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_bayesian_prior_v2.py @@ -0,0 +1,47 @@ +# 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 ( + ModelNormal, + cached_property, +) + + +class ExperimentsBanditBayesianPriorV2(ModelNormal): + @cached_property + def openapi_types(_): + return { + "arm_standard_deviation": (float,), + "grand_mean": (float,), + "grand_mean_standard_deviation": (float,), + } + + attribute_map = { + "arm_standard_deviation": "arm_standard_deviation", + "grand_mean": "grand_mean", + "grand_mean_standard_deviation": "grand_mean_standard_deviation", + } + + def __init__( + self_, arm_standard_deviation: float, grand_mean: float, grand_mean_standard_deviation: float, **kwargs + ): + """ + The prior the bandit's estimates start from. + + :param arm_standard_deviation: Prior standard deviation of each arm's mean around the shared mean. + :type arm_standard_deviation: float + + :param grand_mean: Prior mean of the shared mean of the arms, in the metric's units. + :type grand_mean: float + + :param grand_mean_standard_deviation: Prior standard deviation of the shared mean of the arms. + :type grand_mean_standard_deviation: float + """ + super().__init__(kwargs) + + self_.arm_standard_deviation = arm_standard_deviation + self_.grand_mean = grand_mean + self_.grand_mean_standard_deviation = grand_mean_standard_deviation diff --git a/src/datadog_api_client/v2/model/experiments_bandit_confidence_interval_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_confidence_interval_v2.py new file mode 100644 index 0000000000..065ecc4812 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_confidence_interval_v2.py @@ -0,0 +1,39 @@ +# 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 ( + ModelNormal, + cached_property, +) + + +class ExperimentsBanditConfidenceIntervalV2(ModelNormal): + @cached_property + def openapi_types(_): + return { + "lower": (float,), + "upper": (float,), + } + + attribute_map = { + "lower": "lower", + "upper": "upper", + } + + def __init__(self_, lower: float, upper: float, **kwargs): + """ + A central interval around point_estimate at confidence_level. + + :param lower: Lower bound of the interval. + :type lower: float + + :param upper: Upper bound of the interval. + :type upper: float + """ + super().__init__(kwargs) + + self_.lower = lower + self_.upper = upper diff --git a/src/datadog_api_client/v2/model/experiments_bandit_daily_traffic_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_daily_traffic_v2.py new file mode 100644 index 0000000000..d4cd3db2f9 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_daily_traffic_v2.py @@ -0,0 +1,83 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + UUID, +) + + +class ExperimentsBanditDailyTrafficV2(ModelNormal): + @cached_property + def openapi_types(_): + return { + "cumulative_new_subjects": (int,), + "cumulative_observations": (int,), + "date": (datetime,), + "feature_flag_variant_id": (UUID,), + "new_subjects": (int,), + "observations": (int,), + "variant_key": (str, none_type), + } + + attribute_map = { + "cumulative_new_subjects": "cumulative_new_subjects", + "cumulative_observations": "cumulative_observations", + "date": "date", + "feature_flag_variant_id": "feature_flag_variant_id", + "new_subjects": "new_subjects", + "observations": "observations", + "variant_key": "variant_key", + } + + def __init__( + self_, + cumulative_new_subjects: int, + cumulative_observations: int, + date: datetime, + feature_flag_variant_id: UUID, + new_subjects: int, + observations: int, + variant_key: Union[str, none_type], + **kwargs, + ): + """ + An arm's observations and new subjects on one UTC day. + + :param cumulative_new_subjects: The arm's new subjects from the bandit's start through this day, including days before the requested range. + :type cumulative_new_subjects: int + + :param cumulative_observations: The arm's observations from the bandit's start through this day, including days before the requested range. + :type cumulative_observations: int + + :param date: A UTC date as YYYY-MM-DD. + :type date: datetime + + :param feature_flag_variant_id: The arm's variant ID on the flag. + :type feature_flag_variant_id: UUID + + :param new_subjects: Subjects whose first valid observation is on this day and arm. + :type new_subjects: int + + :param observations: The arm's valid observations on this day. + :type observations: int + + :param variant_key: The arm's variant key. + :type variant_key: str, none_type + """ + super().__init__(kwargs) + + self_.cumulative_new_subjects = cumulative_new_subjects + self_.cumulative_observations = cumulative_observations + self_.date = date + self_.feature_flag_variant_id = feature_flag_variant_id + self_.new_subjects = new_subjects + self_.observations = observations + self_.variant_key = variant_key diff --git a/src/datadog_api_client/v2/model/experiments_bandit_desired_change.py b/src/datadog_api_client/v2/model/experiments_bandit_desired_change.py new file mode 100644 index 0000000000..59f1e91ad9 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_desired_change.py @@ -0,0 +1,40 @@ +# 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 ExperimentsBanditDesiredChange(ModelSimple): + """ + The direction the bandit optimizes the metric in. It's fixed when the bandit starts. `null` before the first saved refresh. + + :param value: Must be one of ["METRIC_INCREASES", "METRIC_DECREASES"]. + :type value: str + """ + + allowed_values = { + "METRIC_INCREASES", + "METRIC_DECREASES", + } + METRIC_INCREASES: ClassVar["ExperimentsBanditDesiredChange"] + METRIC_DECREASES: ClassVar["ExperimentsBanditDesiredChange"] + + _nullable = True + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditDesiredChange.METRIC_INCREASES = ExperimentsBanditDesiredChange("METRIC_INCREASES") +ExperimentsBanditDesiredChange.METRIC_DECREASES = ExperimentsBanditDesiredChange("METRIC_DECREASES") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_flag_configuration_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_flag_configuration_v2.py new file mode 100644 index 0000000000..39756e4a4c --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_flag_configuration_v2.py @@ -0,0 +1,66 @@ +# 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, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_targeting_rule import ExperimentsTargetingRule + + +class ExperimentsBanditFlagConfigurationV2(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_targeting_rule import ExperimentsTargetingRule + + return { + "allocation_key": (str,), + "environment_id": (UUID,), + "feature_flag_id": (UUID,), + "targeting_rules": ([ExperimentsTargetingRule],), + } + + attribute_map = { + "allocation_key": "allocation_key", + "environment_id": "environment_id", + "feature_flag_id": "feature_flag_id", + "targeting_rules": "targeting_rules", + } + + def __init__( + self_, + allocation_key: str, + environment_id: UUID, + feature_flag_id: UUID, + targeting_rules: List[ExperimentsTargetingRule], + **kwargs, + ): + """ + The flag rule the bandit serves through. Absent until a draft is added to a flag. Also absent when the caller lacks feature flag or environment read permissions, in which case ``meta.warnings`` includes ``datadog_flag_configuration_omitted``. + + :param allocation_key: The key of the bandit's rule on the flag. Exposures log it. + :type allocation_key: str + + :param environment_id: The environment the bandit serves in. + :type environment_id: UUID + + :param feature_flag_id: The flag the bandit serves through. + :type feature_flag_id: UUID + + :param targeting_rules: Who the bandit serves. When empty, the bandit serves everyone in the environment. + :type targeting_rules: [ExperimentsTargetingRule] + """ + super().__init__(kwargs) + + self_.allocation_key = allocation_key + self_.environment_id = environment_id + self_.feature_flag_id = feature_flag_id + self_.targeting_rules = targeting_rules diff --git a/src/datadog_api_client/v2/model/experiments_bandit_nullable_confidence_interval_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_nullable_confidence_interval_v2.py new file mode 100644 index 0000000000..8c21b08672 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_nullable_confidence_interval_v2.py @@ -0,0 +1,41 @@ +# 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 ( + ModelNormal, + cached_property, +) + + +class ExperimentsBanditNullableConfidenceIntervalV2(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + return { + "lower": (float,), + "upper": (float,), + } + + attribute_map = { + "lower": "lower", + "upper": "upper", + } + + def __init__(self_, lower: float, upper: float, **kwargs): + """ + A central interval around point_estimate at confidence_level. ``null`` when the estimate is unavailable. + + :param lower: Lower bound of the interval. + :type lower: float + + :param upper: Upper bound of the interval. + :type upper: float + """ + super().__init__(kwargs) + + self_.lower = lower + self_.upper = upper diff --git a/src/datadog_api_client/v2/model/experiments_bandit_observation_counts_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_observation_counts_v2.py new file mode 100644 index 0000000000..b06027fffb --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_observation_counts_v2.py @@ -0,0 +1,53 @@ +# 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 ( + ModelNormal, + cached_property, +) + + +class ExperimentsBanditObservationCountsV2(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + return { + "invalid": (int,), + "total": (int,), + "valid_immature": (int,), + "valid_mature": (int,), + } + + attribute_map = { + "invalid": "invalid", + "total": "total", + "valid_immature": "valid_immature", + "valid_mature": "valid_mature", + } + + def __init__(self_, invalid: int, total: int, valid_immature: int, valid_mature: int, **kwargs): + """ + How many observations the latest saved refresh saw, regardless of the requested range. ``null`` when its counts can't be read. + + :param invalid: Observations the refresh couldn't use. + :type invalid: int + + :param total: All observations (the sum of the other three counts). + :type total: int + + :param valid_immature: Valid observations whose aggregation window is still open. + :type valid_immature: int + + :param valid_mature: Valid observations whose aggregation window has closed. The estimates use these. + :type valid_mature: int + """ + super().__init__(kwargs) + + self_.invalid = invalid + self_.total = total + self_.valid_immature = valid_immature + self_.valid_mature = valid_mature diff --git a/src/datadog_api_client/v2/model/experiments_bandit_optimal_variant_unavailable_reason.py b/src/datadog_api_client/v2/model/experiments_bandit_optimal_variant_unavailable_reason.py new file mode 100644 index 0000000000..2c3b990582 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_optimal_variant_unavailable_reason.py @@ -0,0 +1,55 @@ +# 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 ExperimentsBanditOptimalVariantUnavailableReason(ModelSimple): + """ + Why no optimal variant is reported. Absent when one is, or when the cause isn't known. + + :param value: Must be one of ["NO_RESULTS_YET", "WARMUP", "NOT_ENOUGH_DATA", "NO_DIFFERENCE", "STATS_UNAVAILABLE"]. + :type value: str + """ + + allowed_values = { + "NO_RESULTS_YET", + "WARMUP", + "NOT_ENOUGH_DATA", + "NO_DIFFERENCE", + "STATS_UNAVAILABLE", + } + NO_RESULTS_YET: ClassVar["ExperimentsBanditOptimalVariantUnavailableReason"] + WARMUP: ClassVar["ExperimentsBanditOptimalVariantUnavailableReason"] + NOT_ENOUGH_DATA: ClassVar["ExperimentsBanditOptimalVariantUnavailableReason"] + NO_DIFFERENCE: ClassVar["ExperimentsBanditOptimalVariantUnavailableReason"] + STATS_UNAVAILABLE: ClassVar["ExperimentsBanditOptimalVariantUnavailableReason"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditOptimalVariantUnavailableReason.NO_RESULTS_YET = ExperimentsBanditOptimalVariantUnavailableReason( + "NO_RESULTS_YET" +) +ExperimentsBanditOptimalVariantUnavailableReason.WARMUP = ExperimentsBanditOptimalVariantUnavailableReason("WARMUP") +ExperimentsBanditOptimalVariantUnavailableReason.NOT_ENOUGH_DATA = ExperimentsBanditOptimalVariantUnavailableReason( + "NOT_ENOUGH_DATA" +) +ExperimentsBanditOptimalVariantUnavailableReason.NO_DIFFERENCE = ExperimentsBanditOptimalVariantUnavailableReason( + "NO_DIFFERENCE" +) +ExperimentsBanditOptimalVariantUnavailableReason.STATS_UNAVAILABLE = ExperimentsBanditOptimalVariantUnavailableReason( + "STATS_UNAVAILABLE" +) diff --git a/src/datadog_api_client/v2/model/experiments_bandit_point_estimate_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_point_estimate_v2.py new file mode 100644 index 0000000000..38896c62e5 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_point_estimate_v2.py @@ -0,0 +1,93 @@ +# 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, + datetime, + none_type, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_confidence_interval_v2 import ( + ExperimentsBanditConfidenceIntervalV2, + ) + + +class ExperimentsBanditPointEstimateV2(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_confidence_interval_v2 import ( + ExperimentsBanditConfidenceIntervalV2, + ) + + return { + "confidence_interval": (ExperimentsBanditConfidenceIntervalV2,), + "data_as_of": (datetime, none_type), + "feature_flag_variant_id": (UUID,), + "point_estimate": (float,), + "refresh_id": (UUID,), + "results_last_updated": (datetime,), + "variant_key": (str, none_type), + } + + attribute_map = { + "confidence_interval": "confidence_interval", + "data_as_of": "data_as_of", + "feature_flag_variant_id": "feature_flag_variant_id", + "point_estimate": "point_estimate", + "refresh_id": "refresh_id", + "results_last_updated": "results_last_updated", + "variant_key": "variant_key", + } + + def __init__( + self_, + confidence_interval: ExperimentsBanditConfidenceIntervalV2, + data_as_of: Union[datetime, none_type], + feature_flag_variant_id: UUID, + point_estimate: float, + refresh_id: UUID, + results_last_updated: datetime, + variant_key: Union[str, none_type], + **kwargs, + ): + """ + An arm's point estimate from one saved refresh. + + :param confidence_interval: A central interval around point_estimate at confidence_level. + :type confidence_interval: ExperimentsBanditConfidenceIntervalV2 + + :param data_as_of: The timestamp of the most recent warehouse data that the refresh read. + :type data_as_of: datetime, none_type + + :param feature_flag_variant_id: The arm's variant ID on the flag. + :type feature_flag_variant_id: UUID + + :param point_estimate: The arm's estimated mean of the metric, in the metric's units. + :type point_estimate: float + + :param refresh_id: The refresh the estimate comes from. + :type refresh_id: UUID + + :param results_last_updated: When the refresh saved its results. + :type results_last_updated: datetime + + :param variant_key: The arm's variant key. + :type variant_key: str, none_type + """ + super().__init__(kwargs) + + self_.confidence_interval = confidence_interval + self_.data_as_of = data_as_of + self_.feature_flag_variant_id = feature_flag_variant_id + self_.point_estimate = point_estimate + self_.refresh_id = refresh_id + self_.results_last_updated = results_last_updated + self_.variant_key = variant_key diff --git a/src/datadog_api_client/v2/model/experiments_bandit_policy_kind.py b/src/datadog_api_client/v2/model/experiments_bandit_policy_kind.py new file mode 100644 index 0000000000..183c12c473 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_policy_kind.py @@ -0,0 +1,41 @@ +# 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 ExperimentsBanditPolicyKind(ModelSimple): + """ + `WARMUP` serves the arms equally. `ADAPTIVE` serves the initial split or a split from a refresh. `FALLBACK` serves one variant after the bandit ends. + + :param value: Must be one of ["WARMUP", "ADAPTIVE", "FALLBACK"]. + :type value: str + """ + + allowed_values = { + "WARMUP", + "ADAPTIVE", + "FALLBACK", + } + WARMUP: ClassVar["ExperimentsBanditPolicyKind"] + ADAPTIVE: ClassVar["ExperimentsBanditPolicyKind"] + FALLBACK: ClassVar["ExperimentsBanditPolicyKind"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditPolicyKind.WARMUP = ExperimentsBanditPolicyKind("WARMUP") +ExperimentsBanditPolicyKind.ADAPTIVE = ExperimentsBanditPolicyKind("ADAPTIVE") +ExperimentsBanditPolicyKind.FALLBACK = ExperimentsBanditPolicyKind("FALLBACK") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_policy_reason.py b/src/datadog_api_client/v2/model/experiments_bandit_policy_reason.py new file mode 100644 index 0000000000..319e27f2f9 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_policy_reason.py @@ -0,0 +1,47 @@ +# 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 ExperimentsBanditPolicyReason(ModelSimple): + """ + Why the policy was applied. + + :param value: Must be one of ["ACTIVATION", "REFRESH", "ARM_CHANGE", "SCHEDULED_END", "STOP"]. + :type value: str + """ + + allowed_values = { + "ACTIVATION", + "REFRESH", + "ARM_CHANGE", + "SCHEDULED_END", + "STOP", + } + ACTIVATION: ClassVar["ExperimentsBanditPolicyReason"] + REFRESH: ClassVar["ExperimentsBanditPolicyReason"] + ARM_CHANGE: ClassVar["ExperimentsBanditPolicyReason"] + SCHEDULED_END: ClassVar["ExperimentsBanditPolicyReason"] + STOP: ClassVar["ExperimentsBanditPolicyReason"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditPolicyReason.ACTIVATION = ExperimentsBanditPolicyReason("ACTIVATION") +ExperimentsBanditPolicyReason.REFRESH = ExperimentsBanditPolicyReason("REFRESH") +ExperimentsBanditPolicyReason.ARM_CHANGE = ExperimentsBanditPolicyReason("ARM_CHANGE") +ExperimentsBanditPolicyReason.SCHEDULED_END = ExperimentsBanditPolicyReason("SCHEDULED_END") +ExperimentsBanditPolicyReason.STOP = ExperimentsBanditPolicyReason("STOP") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_policy_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_policy_v2.py new file mode 100644 index 0000000000..87bf6394fc --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_policy_v2.py @@ -0,0 +1,87 @@ +# 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, + datetime, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_policy_kind import ExperimentsBanditPolicyKind + from datadog_api_client.v2.model.experiments_bandit_policy_reason import ExperimentsBanditPolicyReason + from datadog_api_client.v2.model.experiments_bandit_policy_variant_v2 import ExperimentsBanditPolicyVariantV2 + + +class ExperimentsBanditPolicyV2(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_policy_kind import ExperimentsBanditPolicyKind + from datadog_api_client.v2.model.experiments_bandit_policy_reason import ExperimentsBanditPolicyReason + from datadog_api_client.v2.model.experiments_bandit_policy_variant_v2 import ExperimentsBanditPolicyVariantV2 + + return { + "applied_at": (datetime,), + "config_version": (int,), + "id": (UUID,), + "kind": (ExperimentsBanditPolicyKind,), + "reason": (ExperimentsBanditPolicyReason,), + "variants": ([ExperimentsBanditPolicyVariantV2],), + } + + attribute_map = { + "applied_at": "applied_at", + "config_version": "config_version", + "id": "id", + "kind": "kind", + "reason": "reason", + "variants": "variants", + } + + def __init__( + self_, + applied_at: datetime, + config_version: int, + id: UUID, + kind: ExperimentsBanditPolicyKind, + reason: ExperimentsBanditPolicyReason, + variants: List[ExperimentsBanditPolicyVariantV2], + **kwargs, + ): + """ + The policy the bandit serves. ``null`` until the bandit starts. + + :param applied_at: When the policy started being served. + :type applied_at: datetime + + :param config_version: The configuration version the policy was made for. + :type config_version: int + + :param id: The policy ID. Each exposure logs it as ``bandit.policy_id``. + :type id: UUID + + :param kind: ``WARMUP`` serves the arms equally. ``ADAPTIVE`` serves the initial split or a split from a refresh. ``FALLBACK`` serves one variant after the bandit ends. + :type kind: ExperimentsBanditPolicyKind + + :param reason: Why the policy was applied. + :type reason: ExperimentsBanditPolicyReason + + :param variants: Each variant's share of traffic. The probabilities add up to 1. + :type variants: [ExperimentsBanditPolicyVariantV2] + """ + super().__init__(kwargs) + + self_.applied_at = applied_at + self_.config_version = config_version + self_.id = id + self_.kind = kind + self_.reason = reason + self_.variants = variants diff --git a/src/datadog_api_client/v2/model/experiments_bandit_policy_variant_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_policy_variant_v2.py new file mode 100644 index 0000000000..6cd2ddd69b --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_policy_variant_v2.py @@ -0,0 +1,57 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + UUID, +) + + +class ExperimentsBanditPolicyVariantV2(ModelNormal): + validations = { + "probability": { + "inclusive_maximum": 1, + "inclusive_minimum": 0, + }, + } + + @cached_property + def openapi_types(_): + return { + "feature_flag_variant_id": (UUID,), + "probability": (float,), + "variant_key": (str, none_type), + } + + attribute_map = { + "feature_flag_variant_id": "feature_flag_variant_id", + "probability": "probability", + "variant_key": "variant_key", + } + + def __init__( + self_, feature_flag_variant_id: UUID, probability: float, variant_key: Union[str, none_type], **kwargs + ): + """ + A variant's share of traffic under a policy. + + :param feature_flag_variant_id: The variant's ID on the flag. + :type feature_flag_variant_id: UUID + + :param probability: The share of traffic the variant gets, from 0 to 1. + :type probability: float + + :param variant_key: The variant's key. ``null`` when it can't be resolved. + :type variant_key: str, none_type + """ + super().__init__(kwargs) + + self_.feature_flag_variant_id = feature_flag_variant_id + self_.probability = probability + self_.variant_key = variant_key diff --git a/src/datadog_api_client/v2/model/experiments_bandit_posterior_unavailable_reason.py b/src/datadog_api_client/v2/model/experiments_bandit_posterior_unavailable_reason.py new file mode 100644 index 0000000000..e3bfc53df1 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_posterior_unavailable_reason.py @@ -0,0 +1,43 @@ +# 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 ExperimentsBanditPosteriorUnavailableReason(ModelSimple): + """ + Why the arm's estimate and interval are unavailable. Absent when they are available. + + :param value: Must be one of ["no_data", "insufficient_data", "zero_variance"]. + :type value: str + """ + + allowed_values = { + "no_data", + "insufficient_data", + "zero_variance", + } + NO_DATA: ClassVar["ExperimentsBanditPosteriorUnavailableReason"] + INSUFFICIENT_DATA: ClassVar["ExperimentsBanditPosteriorUnavailableReason"] + ZERO_VARIANCE: ClassVar["ExperimentsBanditPosteriorUnavailableReason"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditPosteriorUnavailableReason.NO_DATA = ExperimentsBanditPosteriorUnavailableReason("no_data") +ExperimentsBanditPosteriorUnavailableReason.INSUFFICIENT_DATA = ExperimentsBanditPosteriorUnavailableReason( + "insufficient_data" +) +ExperimentsBanditPosteriorUnavailableReason.ZERO_VARIANCE = ExperimentsBanditPosteriorUnavailableReason("zero_variance") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_refresh_status.py b/src/datadog_api_client/v2/model/experiments_bandit_refresh_status.py new file mode 100644 index 0000000000..0ada96f938 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_refresh_status.py @@ -0,0 +1,47 @@ +# 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 ExperimentsBanditRefreshStatus(ModelSimple): + """ + The status of the refresh. + + :param value: Must be one of ["PENDING", "RUNNING", "SUCCEEDED", "FAILED", "CANCELLED"]. + :type value: str + """ + + allowed_values = { + "PENDING", + "RUNNING", + "SUCCEEDED", + "FAILED", + "CANCELLED", + } + PENDING: ClassVar["ExperimentsBanditRefreshStatus"] + RUNNING: ClassVar["ExperimentsBanditRefreshStatus"] + SUCCEEDED: ClassVar["ExperimentsBanditRefreshStatus"] + FAILED: ClassVar["ExperimentsBanditRefreshStatus"] + CANCELLED: ClassVar["ExperimentsBanditRefreshStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditRefreshStatus.PENDING = ExperimentsBanditRefreshStatus("PENDING") +ExperimentsBanditRefreshStatus.RUNNING = ExperimentsBanditRefreshStatus("RUNNING") +ExperimentsBanditRefreshStatus.SUCCEEDED = ExperimentsBanditRefreshStatus("SUCCEEDED") +ExperimentsBanditRefreshStatus.FAILED = ExperimentsBanditRefreshStatus("FAILED") +ExperimentsBanditRefreshStatus.CANCELLED = ExperimentsBanditRefreshStatus("CANCELLED") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_refresh_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_refresh_v2.py new file mode 100644 index 0000000000..3352d4dc34 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_refresh_v2.py @@ -0,0 +1,77 @@ +# 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, + datetime, + none_type, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_refresh_status import ExperimentsBanditRefreshStatus + + +class ExperimentsBanditRefreshV2(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_refresh_status import ExperimentsBanditRefreshStatus + + return { + "created_at": (datetime,), + "ended_at": (datetime, none_type), + "id": (UUID,), + "started_at": (datetime, none_type), + "status": (ExperimentsBanditRefreshStatus,), + } + + attribute_map = { + "created_at": "created_at", + "ended_at": "ended_at", + "id": "id", + "started_at": "started_at", + "status": "status", + } + + def __init__( + self_, + created_at: datetime, + ended_at: Union[datetime, none_type], + id: UUID, + started_at: Union[datetime, none_type], + status: ExperimentsBanditRefreshStatus, + **kwargs, + ): + """ + The most recently started refresh. ``null`` until one starts. + + :param created_at: When the refresh was requested. + :type created_at: datetime + + :param ended_at: When the refresh finished. ``null`` while it runs. + :type ended_at: datetime, none_type + + :param id: The refresh ID. + :type id: UUID + + :param started_at: When the refresh started running. ``null`` while it is pending. + :type started_at: datetime, none_type + + :param status: The status of the refresh. + :type status: ExperimentsBanditRefreshStatus + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.ended_at = ended_at + self_.id = id + self_.started_at = started_at + self_.status = status diff --git a/src/datadog_api_client/v2/model/experiments_bandit_results_state.py b/src/datadog_api_client/v2/model/experiments_bandit_results_state.py new file mode 100644 index 0000000000..3f75038616 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_results_state.py @@ -0,0 +1,47 @@ +# 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 ExperimentsBanditResultsState(ModelSimple): + """ + `WAITING_FOR_FIRST_REFRESH` until a refresh saves results. `STATS_UNAVAILABLE` when the latest saved refresh has no complete probabilities of being optimal. `ENDED` after the bandit is stopped or completed, and its last estimates are kept. Otherwise, `WARMUP` or `OPTIMIZING` indicates which policy the bandit serves. A paused bandit keeps its state. + + :param value: Must be one of ["WAITING_FOR_FIRST_REFRESH", "WARMUP", "OPTIMIZING", "STATS_UNAVAILABLE", "ENDED"]. + :type value: str + """ + + allowed_values = { + "WAITING_FOR_FIRST_REFRESH", + "WARMUP", + "OPTIMIZING", + "STATS_UNAVAILABLE", + "ENDED", + } + WAITING_FOR_FIRST_REFRESH: ClassVar["ExperimentsBanditResultsState"] + WARMUP: ClassVar["ExperimentsBanditResultsState"] + OPTIMIZING: ClassVar["ExperimentsBanditResultsState"] + STATS_UNAVAILABLE: ClassVar["ExperimentsBanditResultsState"] + ENDED: ClassVar["ExperimentsBanditResultsState"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditResultsState.WAITING_FOR_FIRST_REFRESH = ExperimentsBanditResultsState("WAITING_FOR_FIRST_REFRESH") +ExperimentsBanditResultsState.WARMUP = ExperimentsBanditResultsState("WARMUP") +ExperimentsBanditResultsState.OPTIMIZING = ExperimentsBanditResultsState("OPTIMIZING") +ExperimentsBanditResultsState.STATS_UNAVAILABLE = ExperimentsBanditResultsState("STATS_UNAVAILABLE") +ExperimentsBanditResultsState.ENDED = ExperimentsBanditResultsState("ENDED") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto.py b/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto.py new file mode 100644 index 0000000000..49b1e0d8bd --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_results_v2_dto_data import ExperimentsBanditResultsV2DTOData + + +class ExperimentsBanditResultsV2DTO(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_results_v2_dto_data import ExperimentsBanditResultsV2DTOData + + return { + "data": (ExperimentsBanditResultsV2DTOData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ExperimentsBanditResultsV2DTOData, **kwargs): + """ + Response containing a bandit's results. + + :param data: JSON:API resource containing a bandit's results. + :type data: ExperimentsBanditResultsV2DTOData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto_data.py b/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto_data.py new file mode 100644 index 0000000000..47cb7d0902 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto_data.py @@ -0,0 +1,69 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_results_v2_dto_data_attributes import ( + ExperimentsBanditResultsV2DTODataAttributes, + ) + from datadog_api_client.v2.model.experiments_bandit_results_v2_dto_data_type import ( + ExperimentsBanditResultsV2DTODataType, + ) + + +class ExperimentsBanditResultsV2DTOData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_results_v2_dto_data_attributes import ( + ExperimentsBanditResultsV2DTODataAttributes, + ) + from datadog_api_client.v2.model.experiments_bandit_results_v2_dto_data_type import ( + ExperimentsBanditResultsV2DTODataType, + ) + + return { + "attributes": (ExperimentsBanditResultsV2DTODataAttributes,), + "id": (UUID,), + "type": (ExperimentsBanditResultsV2DTODataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: ExperimentsBanditResultsV2DTODataAttributes, + id: UUID, + type: ExperimentsBanditResultsV2DTODataType, + **kwargs, + ): + """ + JSON:API resource containing a bandit's results. + + :param attributes: What the bandit's refreshes have learned. + :type attributes: ExperimentsBanditResultsV2DTODataAttributes + + :param id: The bandit ID. + :type id: UUID + + :param type: Bandit results resource type. + :type type: ExperimentsBanditResultsV2DTODataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto_data_attributes.py b/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto_data_attributes.py new file mode 100644 index 0000000000..9b8d830de1 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto_data_attributes.py @@ -0,0 +1,156 @@ +# 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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_desired_change import ExperimentsBanditDesiredChange + from datadog_api_client.v2.model.experiments_bandit_optimal_variant_unavailable_reason import ( + ExperimentsBanditOptimalVariantUnavailableReason, + ) + from datadog_api_client.v2.model.experiments_bandit_point_estimate_v2 import ExperimentsBanditPointEstimateV2 + from datadog_api_client.v2.model.experiments_bandit_results_state import ExperimentsBanditResultsState + from datadog_api_client.v2.model.experiments_bandit_statistics_status import ExperimentsBanditStatisticsStatus + from datadog_api_client.v2.model.experiments_bandit_variant_result_v2 import ExperimentsBanditVariantResultV2 + + +class ExperimentsBanditResultsV2DTODataAttributes(ModelNormal): + validations = { + "confidence_level": { + "inclusive_maximum": 1, + "inclusive_minimum": 0, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_desired_change import ExperimentsBanditDesiredChange + from datadog_api_client.v2.model.experiments_bandit_optimal_variant_unavailable_reason import ( + ExperimentsBanditOptimalVariantUnavailableReason, + ) + from datadog_api_client.v2.model.experiments_bandit_point_estimate_v2 import ExperimentsBanditPointEstimateV2 + from datadog_api_client.v2.model.experiments_bandit_results_state import ExperimentsBanditResultsState + from datadog_api_client.v2.model.experiments_bandit_statistics_status import ExperimentsBanditStatisticsStatus + from datadog_api_client.v2.model.experiments_bandit_variant_result_v2 import ExperimentsBanditVariantResultV2 + + return { + "confidence_level": (float,), + "config_version": (int, none_type), + "data_as_of": (datetime, none_type), + "desired_change": (ExperimentsBanditDesiredChange,), + "next_refresh_at": (datetime, none_type), + "optimal_variant_key": (str, none_type), + "optimal_variant_unavailable_reason": (ExperimentsBanditOptimalVariantUnavailableReason,), + "point_estimates": ([ExperimentsBanditPointEstimateV2],), + "refresh_id": (UUID, none_type), + "results_last_updated": (datetime, none_type), + "state": (ExperimentsBanditResultsState,), + "statistics_status": (ExperimentsBanditStatisticsStatus,), + "variants": ([ExperimentsBanditVariantResultV2],), + } + + attribute_map = { + "confidence_level": "confidence_level", + "config_version": "config_version", + "data_as_of": "data_as_of", + "desired_change": "desired_change", + "next_refresh_at": "next_refresh_at", + "optimal_variant_key": "optimal_variant_key", + "optimal_variant_unavailable_reason": "optimal_variant_unavailable_reason", + "point_estimates": "point_estimates", + "refresh_id": "refresh_id", + "results_last_updated": "results_last_updated", + "state": "state", + "statistics_status": "statistics_status", + "variants": "variants", + } + + def __init__( + self_, + confidence_level: float, + config_version: Union[int, none_type], + data_as_of: Union[datetime, none_type], + desired_change: Union[ExperimentsBanditDesiredChange, none_type], + next_refresh_at: Union[datetime, none_type], + optimal_variant_key: Union[str, none_type], + point_estimates: List[ExperimentsBanditPointEstimateV2], + refresh_id: Union[UUID, none_type], + results_last_updated: Union[datetime, none_type], + state: ExperimentsBanditResultsState, + variants: List[ExperimentsBanditVariantResultV2], + optimal_variant_unavailable_reason: Union[ExperimentsBanditOptimalVariantUnavailableReason, UnsetType] = unset, + statistics_status: Union[ExperimentsBanditStatisticsStatus, UnsetType] = unset, + **kwargs, + ): + """ + What the bandit's refreshes have learned. + + :param confidence_level: The probability mass of each confidence interval. + :type confidence_level: float + + :param config_version: The configuration version the latest saved refresh used. It can be older than the bandit's, because changes such as a new end date don't invalidate results. + :type config_version: int, none_type + + :param data_as_of: The timestamp of the most recent warehouse data that the latest saved refresh read. + :type data_as_of: datetime, none_type + + :param desired_change: The direction the bandit optimizes the metric in. It's fixed when the bandit starts. ``null`` before the first saved refresh. + :type desired_change: ExperimentsBanditDesiredChange, none_type + + :param next_refresh_at: An estimate of when the next scheduled refresh starts. ``null`` when the bandit isn't running or the time can't be estimated. Only daily and hourly schedules get an estimate. + :type next_refresh_at: datetime, none_type + + :param optimal_variant_key: The key of the arm most likely to be best, when one arm leads and the bandit is outside warmup. ``null`` otherwise. + :type optimal_variant_key: str, none_type + + :param optimal_variant_unavailable_reason: Why no optimal variant is reported. Absent when one is, or when the cause isn't known. + :type optimal_variant_unavailable_reason: ExperimentsBanditOptimalVariantUnavailableReason, optional + + :param point_estimates: Each arm's point estimate from up to the latest 400 saved refreshes in the requested range, oldest first. + :type point_estimates: [ExperimentsBanditPointEstimateV2] + + :param refresh_id: The latest refresh that saved results. The estimates come from it. + :type refresh_id: UUID, none_type + + :param results_last_updated: When the latest saved refresh saved its results. + :type results_last_updated: datetime, none_type + + :param state: ``WAITING_FOR_FIRST_REFRESH`` until a refresh saves results. ``STATS_UNAVAILABLE`` when the latest saved refresh has no complete probabilities of being optimal. ``ENDED`` after the bandit is stopped or completed, and its last estimates are kept. Otherwise, ``WARMUP`` or ``OPTIMIZING`` indicates which policy the bandit serves. A paused bandit keeps its state. + :type state: ExperimentsBanditResultsState + + :param statistics_status: Whether the latest saved refresh calculated its statistics. Absent for older refreshes. + :type statistics_status: ExperimentsBanditStatisticsStatus, optional + + :param variants: One row per arm, in arm order. + :type variants: [ExperimentsBanditVariantResultV2] + """ + if optimal_variant_unavailable_reason is not unset: + kwargs["optimal_variant_unavailable_reason"] = optimal_variant_unavailable_reason + if statistics_status is not unset: + kwargs["statistics_status"] = statistics_status + super().__init__(kwargs) + + self_.confidence_level = confidence_level + self_.config_version = config_version + self_.data_as_of = data_as_of + self_.desired_change = desired_change + self_.next_refresh_at = next_refresh_at + self_.optimal_variant_key = optimal_variant_key + self_.point_estimates = point_estimates + self_.refresh_id = refresh_id + self_.results_last_updated = results_last_updated + self_.state = state + self_.variants = variants diff --git a/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto_data_type.py b/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto_data_type.py new file mode 100644 index 0000000000..303122c34a --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_results_v2_dto_data_type.py @@ -0,0 +1,35 @@ +# 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 ExperimentsBanditResultsV2DTODataType(ModelSimple): + """ + Bandit results resource type. + + :param value: If omitted defaults to "bandit-results". Must be one of ["bandit-results"]. + :type value: str + """ + + allowed_values = { + "bandit-results", + } + BANDIT_RESULTS: ClassVar["ExperimentsBanditResultsV2DTODataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditResultsV2DTODataType.BANDIT_RESULTS = ExperimentsBanditResultsV2DTODataType("bandit-results") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_scheduled_end_failure_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_scheduled_end_failure_v2.py new file mode 100644 index 0000000000..b657f87237 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_scheduled_end_failure_v2.py @@ -0,0 +1,40 @@ +# 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 ( + ModelNormal, + cached_property, + datetime, +) + + +class ExperimentsBanditScheduledEndFailureV2(ModelNormal): + @cached_property + def openapi_types(_): + return { + "failed_at": (datetime,), + "reason": (str,), + } + + attribute_map = { + "failed_at": "failed_at", + "reason": "reason", + } + + def __init__(self_, failed_at: datetime, reason: str, **kwargs): + """ + Why the scheduled end couldn't run. It isn't retried until the end date or fallback changes. Absent when there's no failure. + + :param failed_at: When the scheduled end failed. + :type failed_at: datetime + + :param reason: Why the scheduled end failed. + :type reason: str + """ + super().__init__(kwargs) + + self_.failed_at = failed_at + self_.reason = reason diff --git a/src/datadog_api_client/v2/model/experiments_bandit_statistics_status.py b/src/datadog_api_client/v2/model/experiments_bandit_statistics_status.py new file mode 100644 index 0000000000..0903761b22 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_statistics_status.py @@ -0,0 +1,38 @@ +# 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 ExperimentsBanditStatisticsStatus(ModelSimple): + """ + Whether the latest saved refresh calculated its statistics. Absent for older refreshes. + + :param value: Must be one of ["calculated", "failed"]. + :type value: str + """ + + allowed_values = { + "calculated", + "failed", + } + CALCULATED: ClassVar["ExperimentsBanditStatisticsStatus"] + FAILED: ClassVar["ExperimentsBanditStatisticsStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditStatisticsStatus.CALCULATED = ExperimentsBanditStatisticsStatus("calculated") +ExperimentsBanditStatisticsStatus.FAILED = ExperimentsBanditStatisticsStatus("failed") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_status.py b/src/datadog_api_client/v2/model/experiments_bandit_status.py new file mode 100644 index 0000000000..f3c7b75ee4 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_status.py @@ -0,0 +1,50 @@ +# 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 ExperimentsBanditStatus(ModelSimple): + """ + The bandit's status. `STOPPED` means the bandit was stopped and serves the variant chosen then. `COMPLETED` means it reached its scheduled end and serves its fallback. + + :param value: Must be one of ["DRAFT", "SCHEDULED", "RUNNING", "PAUSED", "STOPPED", "COMPLETED"]. + :type value: str + """ + + allowed_values = { + "DRAFT", + "SCHEDULED", + "RUNNING", + "PAUSED", + "STOPPED", + "COMPLETED", + } + DRAFT: ClassVar["ExperimentsBanditStatus"] + SCHEDULED: ClassVar["ExperimentsBanditStatus"] + RUNNING: ClassVar["ExperimentsBanditStatus"] + PAUSED: ClassVar["ExperimentsBanditStatus"] + STOPPED: ClassVar["ExperimentsBanditStatus"] + COMPLETED: ClassVar["ExperimentsBanditStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditStatus.DRAFT = ExperimentsBanditStatus("DRAFT") +ExperimentsBanditStatus.SCHEDULED = ExperimentsBanditStatus("SCHEDULED") +ExperimentsBanditStatus.RUNNING = ExperimentsBanditStatus("RUNNING") +ExperimentsBanditStatus.PAUSED = ExperimentsBanditStatus("PAUSED") +ExperimentsBanditStatus.STOPPED = ExperimentsBanditStatus("STOPPED") +ExperimentsBanditStatus.COMPLETED = ExperimentsBanditStatus("COMPLETED") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto.py b/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto.py new file mode 100644 index 0000000000..70e28a6f64 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto.py @@ -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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto_data import ( + ExperimentsBanditTrafficSummaryV2DTOData, + ) + + +class ExperimentsBanditTrafficSummaryV2DTO(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto_data import ( + ExperimentsBanditTrafficSummaryV2DTOData, + ) + + return { + "data": (ExperimentsBanditTrafficSummaryV2DTOData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ExperimentsBanditTrafficSummaryV2DTOData, **kwargs): + """ + Response containing a bandit's traffic summary. + + :param data: JSON:API resource containing a bandit's traffic summary. + :type data: ExperimentsBanditTrafficSummaryV2DTOData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto_data.py b/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto_data.py new file mode 100644 index 0000000000..605f6f28da --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto_data.py @@ -0,0 +1,69 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto_data_attributes import ( + ExperimentsBanditTrafficSummaryV2DTODataAttributes, + ) + from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto_data_type import ( + ExperimentsBanditTrafficSummaryV2DTODataType, + ) + + +class ExperimentsBanditTrafficSummaryV2DTOData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto_data_attributes import ( + ExperimentsBanditTrafficSummaryV2DTODataAttributes, + ) + from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto_data_type import ( + ExperimentsBanditTrafficSummaryV2DTODataType, + ) + + return { + "attributes": (ExperimentsBanditTrafficSummaryV2DTODataAttributes,), + "id": (UUID,), + "type": (ExperimentsBanditTrafficSummaryV2DTODataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: ExperimentsBanditTrafficSummaryV2DTODataAttributes, + id: UUID, + type: ExperimentsBanditTrafficSummaryV2DTODataType, + **kwargs, + ): + """ + JSON:API resource containing a bandit's traffic summary. + + :param attributes: What the bandit has observed, as of its latest saved refresh. + :type attributes: ExperimentsBanditTrafficSummaryV2DTODataAttributes + + :param id: The bandit ID. + :type id: UUID + + :param type: Bandit traffic summary resource type. + :type type: ExperimentsBanditTrafficSummaryV2DTODataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto_data_attributes.py b/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto_data_attributes.py new file mode 100644 index 0000000000..82a6706a1a --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto_data_attributes.py @@ -0,0 +1,90 @@ +# 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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_daily_traffic_v2 import ExperimentsBanditDailyTrafficV2 + from datadog_api_client.v2.model.experiments_bandit_observation_counts_v2 import ( + ExperimentsBanditObservationCountsV2, + ) + from datadog_api_client.v2.model.experiments_bandit_traffic_variant_v2 import ExperimentsBanditTrafficVariantV2 + + +class ExperimentsBanditTrafficSummaryV2DTODataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_daily_traffic_v2 import ExperimentsBanditDailyTrafficV2 + from datadog_api_client.v2.model.experiments_bandit_observation_counts_v2 import ( + ExperimentsBanditObservationCountsV2, + ) + from datadog_api_client.v2.model.experiments_bandit_traffic_variant_v2 import ExperimentsBanditTrafficVariantV2 + + return { + "daily": ([ExperimentsBanditDailyTrafficV2],), + "data_as_of": (datetime, none_type), + "observation_counts": (ExperimentsBanditObservationCountsV2,), + "refresh_id": (UUID, none_type), + "total_subjects": (int,), + "variants": ([ExperimentsBanditTrafficVariantV2],), + } + + attribute_map = { + "daily": "daily", + "data_as_of": "data_as_of", + "observation_counts": "observation_counts", + "refresh_id": "refresh_id", + "total_subjects": "total_subjects", + "variants": "variants", + } + + def __init__( + self_, + daily: List[ExperimentsBanditDailyTrafficV2], + data_as_of: Union[datetime, none_type], + observation_counts: Union[ExperimentsBanditObservationCountsV2, none_type], + refresh_id: Union[UUID, none_type], + total_subjects: int, + variants: List[ExperimentsBanditTrafficVariantV2], + **kwargs, + ): + """ + What the bandit has observed, as of its latest saved refresh. + + :param daily: Valid observations per arm, grouped by the UTC day of their anchor time. Includes each day from the bandit's start to the data cutoff that overlaps the requested range. Days without observations have zero counts. Empty before the first saved refresh. + :type daily: [ExperimentsBanditDailyTrafficV2] + + :param data_as_of: The timestamp of the most recent warehouse data that the latest saved refresh read. + :type data_as_of: datetime, none_type + + :param observation_counts: How many observations the latest saved refresh saw, regardless of the requested range. ``null`` when its counts can't be read. + :type observation_counts: ExperimentsBanditObservationCountsV2, none_type + + :param refresh_id: The latest refresh that saved results. The counts come from it. + :type refresh_id: UUID, none_type + + :param total_subjects: Distinct subjects with a valid observation, regardless of the requested range. + :type total_subjects: int + + :param variants: One row per arm, regardless of the requested range. + :type variants: [ExperimentsBanditTrafficVariantV2] + """ + super().__init__(kwargs) + + self_.daily = daily + self_.data_as_of = data_as_of + self_.observation_counts = observation_counts + self_.refresh_id = refresh_id + self_.total_subjects = total_subjects + self_.variants = variants diff --git a/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto_data_type.py b/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto_data_type.py new file mode 100644 index 0000000000..338935c1ec --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_traffic_summary_v2_dto_data_type.py @@ -0,0 +1,37 @@ +# 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 ExperimentsBanditTrafficSummaryV2DTODataType(ModelSimple): + """ + Bandit traffic summary resource type. + + :param value: If omitted defaults to "bandit-traffic-summary". Must be one of ["bandit-traffic-summary"]. + :type value: str + """ + + allowed_values = { + "bandit-traffic-summary", + } + BANDIT_TRAFFIC_SUMMARY: ClassVar["ExperimentsBanditTrafficSummaryV2DTODataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditTrafficSummaryV2DTODataType.BANDIT_TRAFFIC_SUMMARY = ExperimentsBanditTrafficSummaryV2DTODataType( + "bandit-traffic-summary" +) diff --git a/src/datadog_api_client/v2/model/experiments_bandit_traffic_variant_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_traffic_variant_v2.py new file mode 100644 index 0000000000..2460de6e52 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_traffic_variant_v2.py @@ -0,0 +1,61 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + UUID, +) + + +class ExperimentsBanditTrafficVariantV2(ModelNormal): + @cached_property + def openapi_types(_): + return { + "feature_flag_variant_id": (UUID,), + "observations": (int,), + "subjects": (int,), + "variant_key": (str, none_type), + } + + attribute_map = { + "feature_flag_variant_id": "feature_flag_variant_id", + "observations": "observations", + "subjects": "subjects", + "variant_key": "variant_key", + } + + def __init__( + self_, + feature_flag_variant_id: UUID, + observations: int, + subjects: int, + variant_key: Union[str, none_type], + **kwargs, + ): + """ + An arm's observations and subjects in total. + + :param feature_flag_variant_id: The arm's variant ID on the flag. + :type feature_flag_variant_id: UUID + + :param observations: The arm's valid observations, regardless of whether their aggregation windows have closed. + :type observations: int + + :param subjects: Subjects whose first valid observation is on this arm. A subject counts once, on the arm its reward goes to. + :type subjects: int + + :param variant_key: The arm's variant key. + :type variant_key: str, none_type + """ + super().__init__(kwargs) + + self_.feature_flag_variant_id = feature_flag_variant_id + self_.observations = observations + self_.subjects = subjects + self_.variant_key = variant_key diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_dto.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_dto.py new file mode 100644 index 0000000000..730ac2cc1f --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_dto.py @@ -0,0 +1,56 @@ +# 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, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_v2_dto_data import ExperimentsBanditV2DTOData + from datadog_api_client.v2.model.experiments_bandit_v2_read_meta_dto import ExperimentsBanditV2ReadMetaDTO + + +class ExperimentsBanditV2DTO(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_v2_dto_data import ExperimentsBanditV2DTOData + from datadog_api_client.v2.model.experiments_bandit_v2_read_meta_dto import ExperimentsBanditV2ReadMetaDTO + + return { + "data": (ExperimentsBanditV2DTOData,), + "meta": (ExperimentsBanditV2ReadMetaDTO,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: ExperimentsBanditV2DTOData, + meta: Union[ExperimentsBanditV2ReadMetaDTO, UnsetType] = unset, + **kwargs, + ): + """ + Response containing a bandit. + + :param data: JSON:API resource containing a bandit. + :type data: ExperimentsBanditV2DTOData + + :param meta: Information about the bandit response. + :type meta: ExperimentsBanditV2ReadMetaDTO, optional + """ + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_dto_data.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_dto_data.py new file mode 100644 index 0000000000..ed8edfd544 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_dto_data.py @@ -0,0 +1,65 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_v2_dto_data_attributes import ( + ExperimentsBanditV2DTODataAttributes, + ) + from datadog_api_client.v2.model.experiments_bandit_v2_dto_data_type import ExperimentsBanditV2DTODataType + + +class ExperimentsBanditV2DTOData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_v2_dto_data_attributes import ( + ExperimentsBanditV2DTODataAttributes, + ) + from datadog_api_client.v2.model.experiments_bandit_v2_dto_data_type import ExperimentsBanditV2DTODataType + + return { + "attributes": (ExperimentsBanditV2DTODataAttributes,), + "id": (UUID,), + "type": (ExperimentsBanditV2DTODataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: ExperimentsBanditV2DTODataAttributes, + id: UUID, + type: ExperimentsBanditV2DTODataType, + **kwargs, + ): + """ + JSON:API resource containing a bandit. + + :param attributes: A bandit's setup, the policy it serves, and its latest refresh. + :type attributes: ExperimentsBanditV2DTODataAttributes + + :param id: The bandit ID. + :type id: UUID + + :param type: Bandit resource type. + :type type: ExperimentsBanditV2DTODataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_dto_data_attributes.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_dto_data_attributes.py new file mode 100644 index 0000000000..d8f06ea236 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_dto_data_attributes.py @@ -0,0 +1,253 @@ +# 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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_policy_v2 import ExperimentsBanditPolicyV2 + from datadog_api_client.v2.model.experiments_bandit_bayesian_prior_v2 import ExperimentsBanditBayesianPriorV2 + from datadog_api_client.v2.model.experiments_bandit_flag_configuration_v2 import ( + ExperimentsBanditFlagConfigurationV2, + ) + from datadog_api_client.v2.model.experiments_bandit_refresh_v2 import ExperimentsBanditRefreshV2 + from datadog_api_client.v2.model.experiments_bandit_optimal_variant_unavailable_reason import ( + ExperimentsBanditOptimalVariantUnavailableReason, + ) + from datadog_api_client.v2.model.experiments_bandit_scheduled_end_failure_v2 import ( + ExperimentsBanditScheduledEndFailureV2, + ) + from datadog_api_client.v2.model.experiments_bandit_status import ExperimentsBanditStatus + from datadog_api_client.v2.model.experiments_bandit_variant_v2 import ExperimentsBanditVariantV2 + + +class ExperimentsBanditV2DTODataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_policy_v2 import ExperimentsBanditPolicyV2 + from datadog_api_client.v2.model.experiments_bandit_bayesian_prior_v2 import ExperimentsBanditBayesianPriorV2 + from datadog_api_client.v2.model.experiments_bandit_flag_configuration_v2 import ( + ExperimentsBanditFlagConfigurationV2, + ) + from datadog_api_client.v2.model.experiments_bandit_refresh_v2 import ExperimentsBanditRefreshV2 + from datadog_api_client.v2.model.experiments_bandit_optimal_variant_unavailable_reason import ( + ExperimentsBanditOptimalVariantUnavailableReason, + ) + from datadog_api_client.v2.model.experiments_bandit_scheduled_end_failure_v2 import ( + ExperimentsBanditScheduledEndFailureV2, + ) + from datadog_api_client.v2.model.experiments_bandit_status import ExperimentsBanditStatus + from datadog_api_client.v2.model.experiments_bandit_variant_v2 import ExperimentsBanditVariantV2 + + return { + "active_policy": (ExperimentsBanditPolicyV2,), + "aggregation_window_seconds": (int,), + "bayesian_prior": (ExperimentsBanditBayesianPriorV2,), + "config_version": (int,), + "created_at": (datetime,), + "datadog_flag_configuration": (ExperimentsBanditFlagConfigurationV2,), + "description": (str,), + "ended_at": (datetime, none_type), + "exposure_sql_model_id": (UUID, none_type), + "latest_refresh": (ExperimentsBanditRefreshV2,), + "lookback_seconds": (int,), + "metric_id": (UUID, none_type), + "name": (str,), + "optimal_variant_key": (str, none_type), + "optimal_variant_unavailable_reason": (ExperimentsBanditOptimalVariantUnavailableReason,), + "refresh_schedule_id": (str, none_type), + "scheduled_end_at": (datetime, none_type), + "scheduled_end_failure": (ExperimentsBanditScheduledEndFailureV2,), + "started_at": (datetime, none_type), + "status": (ExperimentsBanditStatus,), + "subject_type_id": (UUID, none_type), + "tags": ([str],), + "teams": ([str],), + "updated_at": (datetime,), + "variants": ([ExperimentsBanditVariantV2],), + "warmup_seconds": (int, none_type), + } + + attribute_map = { + "active_policy": "active_policy", + "aggregation_window_seconds": "aggregation_window_seconds", + "bayesian_prior": "bayesian_prior", + "config_version": "config_version", + "created_at": "created_at", + "datadog_flag_configuration": "datadog_flag_configuration", + "description": "description", + "ended_at": "ended_at", + "exposure_sql_model_id": "exposure_sql_model_id", + "latest_refresh": "latest_refresh", + "lookback_seconds": "lookback_seconds", + "metric_id": "metric_id", + "name": "name", + "optimal_variant_key": "optimal_variant_key", + "optimal_variant_unavailable_reason": "optimal_variant_unavailable_reason", + "refresh_schedule_id": "refresh_schedule_id", + "scheduled_end_at": "scheduled_end_at", + "scheduled_end_failure": "scheduled_end_failure", + "started_at": "started_at", + "status": "status", + "subject_type_id": "subject_type_id", + "tags": "tags", + "teams": "teams", + "updated_at": "updated_at", + "variants": "variants", + "warmup_seconds": "warmup_seconds", + } + + def __init__( + self_, + active_policy: Union[ExperimentsBanditPolicyV2, none_type], + aggregation_window_seconds: int, + bayesian_prior: ExperimentsBanditBayesianPriorV2, + config_version: int, + created_at: datetime, + description: str, + ended_at: Union[datetime, none_type], + exposure_sql_model_id: Union[UUID, none_type], + latest_refresh: Union[ExperimentsBanditRefreshV2, none_type], + lookback_seconds: int, + metric_id: Union[UUID, none_type], + name: str, + optimal_variant_key: Union[str, none_type], + refresh_schedule_id: Union[str, none_type], + scheduled_end_at: Union[datetime, none_type], + started_at: Union[datetime, none_type], + status: ExperimentsBanditStatus, + subject_type_id: Union[UUID, none_type], + tags: List[str], + teams: List[str], + updated_at: datetime, + variants: List[ExperimentsBanditVariantV2], + warmup_seconds: Union[int, none_type], + datadog_flag_configuration: Union[ExperimentsBanditFlagConfigurationV2, UnsetType] = unset, + optimal_variant_unavailable_reason: Union[ExperimentsBanditOptimalVariantUnavailableReason, UnsetType] = unset, + scheduled_end_failure: Union[ExperimentsBanditScheduledEndFailureV2, UnsetType] = unset, + **kwargs, + ): + """ + A bandit's setup, the policy it serves, and its latest refresh. + + :param active_policy: The policy the bandit serves. ``null`` until the bandit starts. + :type active_policy: ExperimentsBanditPolicyV2, none_type + + :param aggregation_window_seconds: The aggregation window: how long after an exposure the bandit keeps counting its reward, in seconds. + :type aggregation_window_seconds: int + + :param bayesian_prior: The prior the bandit's estimates start from. + :type bayesian_prior: ExperimentsBanditBayesianPriorV2 + + :param config_version: The version of the bandit's configuration. Each saved change adds one. + :type config_version: int + + :param created_at: When the bandit was created. + :type created_at: datetime + + :param datadog_flag_configuration: The flag rule the bandit serves through. Absent until a draft is added to a flag. Also absent when the caller lacks feature flag or environment read permissions, in which case ``meta.warnings`` includes ``datadog_flag_configuration_omitted``. + :type datadog_flag_configuration: ExperimentsBanditFlagConfigurationV2, optional + + :param description: The bandit's description. + :type description: str + + :param ended_at: When the bandit was stopped or reached its scheduled end. ``null`` while it hasn't ended. + :type ended_at: datetime, none_type + + :param exposure_sql_model_id: The exposure SQL model the bandit reads its exposures from. ``null`` until set on a draft. + :type exposure_sql_model_id: UUID, none_type + + :param latest_refresh: The most recently started refresh. ``null`` until one starts. + :type latest_refresh: ExperimentsBanditRefreshV2, none_type + + :param lookback_seconds: How far back each refresh reads observations, in seconds. + :type lookback_seconds: int + + :param metric_id: The metric the bandit optimizes. ``null`` until set on a draft. + :type metric_id: UUID, none_type + + :param name: The bandit's name. + :type name: str + + :param optimal_variant_key: The key of the arm most likely to be best, when one arm leads and the bandit is outside warmup. ``null`` otherwise. Matches Get bandit results. + :type optimal_variant_key: str, none_type + + :param optimal_variant_unavailable_reason: Why no optimal variant is reported. Absent when one is, or when the cause isn't known. + :type optimal_variant_unavailable_reason: ExperimentsBanditOptimalVariantUnavailableReason, optional + + :param refresh_schedule_id: The schedule the bandit refreshes on. + :type refresh_schedule_id: str, none_type + + :param scheduled_end_at: When the bandit ends and serves its fallback. ``null`` when it has no scheduled end. + :type scheduled_end_at: datetime, none_type + + :param scheduled_end_failure: Why the scheduled end couldn't run. It isn't retried until the end date or fallback changes. Absent when there's no failure. + :type scheduled_end_failure: ExperimentsBanditScheduledEndFailureV2, optional + + :param started_at: When the bandit started. ``null`` until it starts. + :type started_at: datetime, none_type + + :param status: The bandit's status. ``STOPPED`` means the bandit was stopped and serves the variant chosen then. ``COMPLETED`` means it reached its scheduled end and serves its fallback. + :type status: ExperimentsBanditStatus + + :param subject_type_id: The subject type the bandit randomizes and measures by. ``null`` until set on a draft. + :type subject_type_id: UUID, none_type + + :param tags: The bandit's tags, without team tags. + :type tags: [str] + + :param teams: Handles of the teams that own the bandit. + :type teams: [str] + + :param updated_at: When the bandit was last changed. + :type updated_at: datetime + + :param variants: The flag variants the bandit uses: its arms in arm order, then its fallback when the fallback isn't an arm. + :type variants: [ExperimentsBanditVariantV2] + + :param warmup_seconds: How long the bandit serves its arms equally after it starts, in seconds. ``null`` when it has no warmup. + :type warmup_seconds: int, none_type + """ + if datadog_flag_configuration is not unset: + kwargs["datadog_flag_configuration"] = datadog_flag_configuration + if optimal_variant_unavailable_reason is not unset: + kwargs["optimal_variant_unavailable_reason"] = optimal_variant_unavailable_reason + if scheduled_end_failure is not unset: + kwargs["scheduled_end_failure"] = scheduled_end_failure + super().__init__(kwargs) + + self_.active_policy = active_policy + self_.aggregation_window_seconds = aggregation_window_seconds + self_.bayesian_prior = bayesian_prior + self_.config_version = config_version + self_.created_at = created_at + self_.description = description + self_.ended_at = ended_at + self_.exposure_sql_model_id = exposure_sql_model_id + self_.latest_refresh = latest_refresh + self_.lookback_seconds = lookback_seconds + self_.metric_id = metric_id + self_.name = name + self_.optimal_variant_key = optimal_variant_key + self_.refresh_schedule_id = refresh_schedule_id + self_.scheduled_end_at = scheduled_end_at + self_.started_at = started_at + self_.status = status + self_.subject_type_id = subject_type_id + self_.tags = tags + self_.teams = teams + self_.updated_at = updated_at + self_.variants = variants + self_.warmup_seconds = warmup_seconds diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_dto_data_type.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_dto_data_type.py new file mode 100644 index 0000000000..3ea836ef96 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_dto_data_type.py @@ -0,0 +1,35 @@ +# 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 ExperimentsBanditV2DTODataType(ModelSimple): + """ + Bandit resource type. + + :param value: If omitted defaults to "bandits". Must be one of ["bandits"]. + :type value: str + """ + + allowed_values = { + "bandits", + } + BANDITS: ClassVar["ExperimentsBanditV2DTODataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditV2DTODataType.BANDITS = ExperimentsBanditV2DTODataType("bandits") diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_list_dto_array.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_list_dto_array.py new file mode 100644 index 0000000000..c823135bfe --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_list_dto_array.py @@ -0,0 +1,62 @@ +# 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_bandit_v2_list_dto_data import ExperimentsBanditV2ListDTOData + from datadog_api_client.v2.model.experiments_offset_links import ExperimentsOffsetLinks + from datadog_api_client.v2.model.experiments_offset_meta import ExperimentsOffsetMeta + + +class ExperimentsBanditV2ListDTOArray(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_v2_list_dto_data import ExperimentsBanditV2ListDTOData + from datadog_api_client.v2.model.experiments_offset_links import ExperimentsOffsetLinks + from datadog_api_client.v2.model.experiments_offset_meta import ExperimentsOffsetMeta + + return { + "data": ([ExperimentsBanditV2ListDTOData],), + "links": (ExperimentsOffsetLinks,), + "meta": (ExperimentsOffsetMeta,), + } + + attribute_map = { + "data": "data", + "links": "links", + "meta": "meta", + } + + def __init__( + self_, + data: List[ExperimentsBanditV2ListDTOData], + links: ExperimentsOffsetLinks, + meta: ExperimentsOffsetMeta, + **kwargs, + ): + """ + Response containing a page of bandit summaries. + + :param data: Bandits on this page. + :type data: [ExperimentsBanditV2ListDTOData] + + :param links: Links for navigating a paginated result set. + :type links: ExperimentsOffsetLinks + + :param meta: Pagination information for a list response. + :type meta: ExperimentsOffsetMeta + """ + super().__init__(kwargs) + + self_.data = data + self_.links = links + self_.meta = meta diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_list_dto_data.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_list_dto_data.py new file mode 100644 index 0000000000..5269198722 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_list_dto_data.py @@ -0,0 +1,65 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_v2_list_dto_data_attributes import ( + ExperimentsBanditV2ListDTODataAttributes, + ) + from datadog_api_client.v2.model.experiments_bandit_v2_dto_data_type import ExperimentsBanditV2DTODataType + + +class ExperimentsBanditV2ListDTOData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_v2_list_dto_data_attributes import ( + ExperimentsBanditV2ListDTODataAttributes, + ) + from datadog_api_client.v2.model.experiments_bandit_v2_dto_data_type import ExperimentsBanditV2DTODataType + + return { + "attributes": (ExperimentsBanditV2ListDTODataAttributes,), + "id": (UUID,), + "type": (ExperimentsBanditV2DTODataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: ExperimentsBanditV2ListDTODataAttributes, + id: UUID, + type: ExperimentsBanditV2DTODataType, + **kwargs, + ): + """ + JSON:API resource containing a bandit summary. + + :param attributes: Summary of a bandit. Use Get bandit for its setup, active policy, and latest refresh. + :type attributes: ExperimentsBanditV2ListDTODataAttributes + + :param id: The bandit ID. + :type id: UUID + + :param type: Bandit resource type. + :type type: ExperimentsBanditV2DTODataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_list_dto_data_attributes.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_list_dto_data_attributes.py new file mode 100644 index 0000000000..e7c7790fdd --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_list_dto_data_attributes.py @@ -0,0 +1,140 @@ +# 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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_optimal_variant_unavailable_reason import ( + ExperimentsBanditOptimalVariantUnavailableReason, + ) + from datadog_api_client.v2.model.experiments_bandit_status import ExperimentsBanditStatus + + +class ExperimentsBanditV2ListDTODataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_optimal_variant_unavailable_reason import ( + ExperimentsBanditOptimalVariantUnavailableReason, + ) + from datadog_api_client.v2.model.experiments_bandit_status import ExperimentsBanditStatus + + return { + "created_at": (datetime,), + "description": (str,), + "ended_at": (datetime, none_type), + "metric_id": (UUID, none_type), + "name": (str,), + "optimal_variant_key": (str, none_type), + "optimal_variant_unavailable_reason": (ExperimentsBanditOptimalVariantUnavailableReason,), + "started_at": (datetime, none_type), + "status": (ExperimentsBanditStatus,), + "subject_type_id": (UUID, none_type), + "tags": ([str],), + "teams": ([str],), + "updated_at": (datetime,), + } + + attribute_map = { + "created_at": "created_at", + "description": "description", + "ended_at": "ended_at", + "metric_id": "metric_id", + "name": "name", + "optimal_variant_key": "optimal_variant_key", + "optimal_variant_unavailable_reason": "optimal_variant_unavailable_reason", + "started_at": "started_at", + "status": "status", + "subject_type_id": "subject_type_id", + "tags": "tags", + "teams": "teams", + "updated_at": "updated_at", + } + + def __init__( + self_, + created_at: datetime, + description: str, + ended_at: Union[datetime, none_type], + metric_id: Union[UUID, none_type], + name: str, + optimal_variant_key: Union[str, none_type], + started_at: Union[datetime, none_type], + status: ExperimentsBanditStatus, + subject_type_id: Union[UUID, none_type], + tags: List[str], + teams: List[str], + updated_at: datetime, + optimal_variant_unavailable_reason: Union[ExperimentsBanditOptimalVariantUnavailableReason, UnsetType] = unset, + **kwargs, + ): + """ + Summary of a bandit. Use Get bandit for its setup, active policy, and latest refresh. + + :param created_at: When the bandit was created. + :type created_at: datetime + + :param description: The bandit's description. + :type description: str + + :param ended_at: When the bandit was stopped or reached its scheduled end. ``null`` while it hasn't ended. + :type ended_at: datetime, none_type + + :param metric_id: The metric the bandit optimizes. ``null`` until set on a draft. + :type metric_id: UUID, none_type + + :param name: The bandit's name. + :type name: str + + :param optimal_variant_key: The key of the arm most likely to be best, when one arm leads and the bandit is outside warmup. ``null`` otherwise. + :type optimal_variant_key: str, none_type + + :param optimal_variant_unavailable_reason: Why no optimal variant is reported. Absent when one is, or when the cause isn't known. + :type optimal_variant_unavailable_reason: ExperimentsBanditOptimalVariantUnavailableReason, optional + + :param started_at: When the bandit started. ``null`` until it starts. + :type started_at: datetime, none_type + + :param status: The bandit's status. ``STOPPED`` means the bandit was stopped and serves the variant chosen then. ``COMPLETED`` means it reached its scheduled end and serves its fallback. + :type status: ExperimentsBanditStatus + + :param subject_type_id: The subject type the bandit randomizes and measures by. ``null`` until set on a draft. + :type subject_type_id: UUID, none_type + + :param tags: The bandit's tags, without team tags. + :type tags: [str] + + :param teams: Handles of the teams that own the bandit. + :type teams: [str] + + :param updated_at: When the bandit was last changed. + :type updated_at: datetime + """ + if optimal_variant_unavailable_reason is not unset: + kwargs["optimal_variant_unavailable_reason"] = optimal_variant_unavailable_reason + super().__init__(kwargs) + + self_.created_at = created_at + self_.description = description + self_.ended_at = ended_at + self_.metric_id = metric_id + self_.name = name + self_.optimal_variant_key = optimal_variant_key + self_.started_at = started_at + self_.status = status + self_.subject_type_id = subject_type_id + self_.tags = tags + self_.teams = teams + self_.updated_at = updated_at diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_read_meta_dto.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_read_meta_dto.py new file mode 100644 index 0000000000..15c891a36e --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_read_meta_dto.py @@ -0,0 +1,42 @@ +# 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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_v2_warning_dto import ExperimentsBanditV2WarningDTO + + +class ExperimentsBanditV2ReadMetaDTO(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_v2_warning_dto import ExperimentsBanditV2WarningDTO + + return { + "warnings": ([ExperimentsBanditV2WarningDTO],), + } + + attribute_map = { + "warnings": "warnings", + } + + def __init__(self_, warnings: Union[List[ExperimentsBanditV2WarningDTO], UnsetType] = unset, **kwargs): + """ + Information about the bandit response. + + :param warnings: Warnings about the response. Absent when there are none. + :type warnings: [ExperimentsBanditV2WarningDTO], optional + """ + if warnings is not unset: + kwargs["warnings"] = warnings + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_warning_code.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_warning_code.py new file mode 100644 index 0000000000..b6d5a29042 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_warning_code.py @@ -0,0 +1,37 @@ +# 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 ExperimentsBanditV2WarningCode(ModelSimple): + """ + Code that identifies the warning. `datadog_flag_configuration_omitted` means the caller lacks feature flag or environment read permissions, so the response leaves out `datadog_flag_configuration`. + + :param value: If omitted defaults to "datadog_flag_configuration_omitted". Must be one of ["datadog_flag_configuration_omitted"]. + :type value: str + """ + + allowed_values = { + "datadog_flag_configuration_omitted", + } + DATADOG_FLAG_CONFIGURATION_OMITTED: ClassVar["ExperimentsBanditV2WarningCode"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ExperimentsBanditV2WarningCode.DATADOG_FLAG_CONFIGURATION_OMITTED = ExperimentsBanditV2WarningCode( + "datadog_flag_configuration_omitted" +) diff --git a/src/datadog_api_client/v2/model/experiments_bandit_v2_warning_dto.py b/src/datadog_api_client/v2/model/experiments_bandit_v2_warning_dto.py new file mode 100644 index 0000000000..8f84de19b5 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_v2_warning_dto.py @@ -0,0 +1,46 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_v2_warning_code import ExperimentsBanditV2WarningCode + + +class ExperimentsBanditV2WarningDTO(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_v2_warning_code import ExperimentsBanditV2WarningCode + + return { + "code": (ExperimentsBanditV2WarningCode,), + "detail": (str,), + } + + attribute_map = { + "code": "code", + "detail": "detail", + } + + def __init__(self_, code: ExperimentsBanditV2WarningCode, detail: str, **kwargs): + """ + A warning about the response that isn't an error. + + :param code: Code that identifies the warning. ``datadog_flag_configuration_omitted`` means the caller lacks feature flag or environment read permissions, so the response leaves out ``datadog_flag_configuration``. + :type code: ExperimentsBanditV2WarningCode + + :param detail: Explanation of the warning. + :type detail: str + """ + super().__init__(kwargs) + + self_.code = code + self_.detail = detail diff --git a/src/datadog_api_client/v2/model/experiments_bandit_variant_result_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_variant_result_v2.py new file mode 100644 index 0000000000..82c3235e86 --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_variant_result_v2.py @@ -0,0 +1,118 @@ +# 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, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.experiments_bandit_nullable_confidence_interval_v2 import ( + ExperimentsBanditNullableConfidenceIntervalV2, + ) + from datadog_api_client.v2.model.experiments_bandit_arm_data_status import ExperimentsBanditArmDataStatus + from datadog_api_client.v2.model.experiments_bandit_posterior_unavailable_reason import ( + ExperimentsBanditPosteriorUnavailableReason, + ) + + +class ExperimentsBanditVariantResultV2(ModelNormal): + validations = { + "probability_of_being_optimal": { + "inclusive_maximum": 1, + "inclusive_minimum": 0, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.experiments_bandit_nullable_confidence_interval_v2 import ( + ExperimentsBanditNullableConfidenceIntervalV2, + ) + from datadog_api_client.v2.model.experiments_bandit_arm_data_status import ExperimentsBanditArmDataStatus + from datadog_api_client.v2.model.experiments_bandit_posterior_unavailable_reason import ( + ExperimentsBanditPosteriorUnavailableReason, + ) + + return { + "confidence_interval": (ExperimentsBanditNullableConfidenceIntervalV2,), + "data_status": (ExperimentsBanditArmDataStatus,), + "feature_flag_variant_id": (UUID,), + "mature_observations": (int,), + "point_estimate": (float, none_type), + "posterior_unavailable_reason": (ExperimentsBanditPosteriorUnavailableReason,), + "probability_of_being_optimal": (float, none_type), + "variant_key": (str, none_type), + } + + attribute_map = { + "confidence_interval": "confidence_interval", + "data_status": "data_status", + "feature_flag_variant_id": "feature_flag_variant_id", + "mature_observations": "mature_observations", + "point_estimate": "point_estimate", + "posterior_unavailable_reason": "posterior_unavailable_reason", + "probability_of_being_optimal": "probability_of_being_optimal", + "variant_key": "variant_key", + } + + def __init__( + self_, + confidence_interval: Union[ExperimentsBanditNullableConfidenceIntervalV2, none_type], + feature_flag_variant_id: UUID, + mature_observations: int, + point_estimate: Union[float, none_type], + probability_of_being_optimal: Union[float, none_type], + variant_key: Union[str, none_type], + data_status: Union[ExperimentsBanditArmDataStatus, UnsetType] = unset, + posterior_unavailable_reason: Union[ExperimentsBanditPosteriorUnavailableReason, UnsetType] = unset, + **kwargs, + ): + """ + An arm's estimates from the latest saved refresh. + + :param confidence_interval: A central interval around point_estimate at confidence_level. ``null`` when the estimate is unavailable. + :type confidence_interval: ExperimentsBanditNullableConfidenceIntervalV2, none_type + + :param data_status: Where the arm's reward variance came from, or why it's unavailable. + :type data_status: ExperimentsBanditArmDataStatus, optional + + :param feature_flag_variant_id: The arm's variant ID on the flag. + :type feature_flag_variant_id: UUID + + :param mature_observations: The arm's valid observations whose aggregation window has closed. The estimate uses these. + :type mature_observations: int + + :param point_estimate: The arm's estimated mean of the metric, in the metric's units. It isn't a lift. + :type point_estimate: float, none_type + + :param posterior_unavailable_reason: Why the arm's estimate and interval are unavailable. Absent when they are available. + :type posterior_unavailable_reason: ExperimentsBanditPosteriorUnavailableReason, optional + + :param probability_of_being_optimal: The probability that this arm is the best. + :type probability_of_being_optimal: float, none_type + + :param variant_key: The arm's variant key. + :type variant_key: str, none_type + """ + if data_status is not unset: + kwargs["data_status"] = data_status + if posterior_unavailable_reason is not unset: + kwargs["posterior_unavailable_reason"] = posterior_unavailable_reason + super().__init__(kwargs) + + self_.confidence_interval = confidence_interval + self_.feature_flag_variant_id = feature_flag_variant_id + self_.mature_observations = mature_observations + self_.point_estimate = point_estimate + self_.probability_of_being_optimal = probability_of_being_optimal + self_.variant_key = variant_key diff --git a/src/datadog_api_client/v2/model/experiments_bandit_variant_v2.py b/src/datadog_api_client/v2/model/experiments_bandit_variant_v2.py new file mode 100644 index 0000000000..6275dd55fd --- /dev/null +++ b/src/datadog_api_client/v2/model/experiments_bandit_variant_v2.py @@ -0,0 +1,68 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + UUID, +) + + +class ExperimentsBanditVariantV2(ModelNormal): + @cached_property + def openapi_types(_): + return { + "feature_flag_variant_id": (UUID,), + "is_active": (bool,), + "is_fallback": (bool,), + "key": (str, none_type), + "name": (str, none_type), + } + + attribute_map = { + "feature_flag_variant_id": "feature_flag_variant_id", + "is_active": "is_active", + "is_fallback": "is_fallback", + "key": "key", + "name": "name", + } + + def __init__( + self_, + feature_flag_variant_id: UUID, + is_active: bool, + is_fallback: bool, + key: Union[str, none_type], + name: Union[str, none_type], + **kwargs, + ): + """ + A flag variant the bandit uses. + + :param feature_flag_variant_id: The variant's ID on the flag. + :type feature_flag_variant_id: UUID + + :param is_active: Whether the variant is one of the arms the bandit chooses between. + :type is_active: bool + + :param is_fallback: Whether the variant is served when the bandit reaches its scheduled end. At most one variant is the fallback. + :type is_fallback: bool + + :param key: The variant's key. An arm keeps the key it had when it was added, because exposures are matched on it. ``null`` only for a fallback deleted from the flag. + :type key: str, none_type + + :param name: The variant's name on the flag. ``null`` when it is no longer on the flag. + :type name: str, none_type + """ + super().__init__(kwargs) + + self_.feature_flag_variant_id = feature_flag_variant_id + self_.is_active = is_active + self_.is_fallback = is_fallback + self_.key = key + self_.name = name diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index f64e232c78..c071f8daad 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3857,6 +3857,68 @@ from datadog_api_client.v2.model.experiments_analysis_plan_write_v2_request_data_type import ( ExperimentsAnalysisPlanWriteV2RequestDataType, ) +from datadog_api_client.v2.model.experiments_bandit_arm_data_status import ExperimentsBanditArmDataStatus +from datadog_api_client.v2.model.experiments_bandit_bayesian_prior_v2 import ExperimentsBanditBayesianPriorV2 +from datadog_api_client.v2.model.experiments_bandit_confidence_interval_v2 import ExperimentsBanditConfidenceIntervalV2 +from datadog_api_client.v2.model.experiments_bandit_daily_traffic_v2 import ExperimentsBanditDailyTrafficV2 +from datadog_api_client.v2.model.experiments_bandit_desired_change import ExperimentsBanditDesiredChange +from datadog_api_client.v2.model.experiments_bandit_flag_configuration_v2 import ExperimentsBanditFlagConfigurationV2 +from datadog_api_client.v2.model.experiments_bandit_nullable_confidence_interval_v2 import ( + ExperimentsBanditNullableConfidenceIntervalV2, +) +from datadog_api_client.v2.model.experiments_bandit_observation_counts_v2 import ExperimentsBanditObservationCountsV2 +from datadog_api_client.v2.model.experiments_bandit_optimal_variant_unavailable_reason import ( + ExperimentsBanditOptimalVariantUnavailableReason, +) +from datadog_api_client.v2.model.experiments_bandit_point_estimate_v2 import ExperimentsBanditPointEstimateV2 +from datadog_api_client.v2.model.experiments_bandit_policy_kind import ExperimentsBanditPolicyKind +from datadog_api_client.v2.model.experiments_bandit_policy_reason import ExperimentsBanditPolicyReason +from datadog_api_client.v2.model.experiments_bandit_policy_v2 import ExperimentsBanditPolicyV2 +from datadog_api_client.v2.model.experiments_bandit_policy_variant_v2 import ExperimentsBanditPolicyVariantV2 +from datadog_api_client.v2.model.experiments_bandit_posterior_unavailable_reason import ( + ExperimentsBanditPosteriorUnavailableReason, +) +from datadog_api_client.v2.model.experiments_bandit_refresh_status import ExperimentsBanditRefreshStatus +from datadog_api_client.v2.model.experiments_bandit_refresh_v2 import ExperimentsBanditRefreshV2 +from datadog_api_client.v2.model.experiments_bandit_results_state import ExperimentsBanditResultsState +from datadog_api_client.v2.model.experiments_bandit_results_v2_dto import ExperimentsBanditResultsV2DTO +from datadog_api_client.v2.model.experiments_bandit_results_v2_dto_data import ExperimentsBanditResultsV2DTOData +from datadog_api_client.v2.model.experiments_bandit_results_v2_dto_data_attributes import ( + ExperimentsBanditResultsV2DTODataAttributes, +) +from datadog_api_client.v2.model.experiments_bandit_results_v2_dto_data_type import ( + ExperimentsBanditResultsV2DTODataType, +) +from datadog_api_client.v2.model.experiments_bandit_scheduled_end_failure_v2 import ( + ExperimentsBanditScheduledEndFailureV2, +) +from datadog_api_client.v2.model.experiments_bandit_statistics_status import ExperimentsBanditStatisticsStatus +from datadog_api_client.v2.model.experiments_bandit_status import ExperimentsBanditStatus +from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto import ExperimentsBanditTrafficSummaryV2DTO +from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto_data import ( + ExperimentsBanditTrafficSummaryV2DTOData, +) +from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto_data_attributes import ( + ExperimentsBanditTrafficSummaryV2DTODataAttributes, +) +from datadog_api_client.v2.model.experiments_bandit_traffic_summary_v2_dto_data_type import ( + ExperimentsBanditTrafficSummaryV2DTODataType, +) +from datadog_api_client.v2.model.experiments_bandit_traffic_variant_v2 import ExperimentsBanditTrafficVariantV2 +from datadog_api_client.v2.model.experiments_bandit_v2_dto import ExperimentsBanditV2DTO +from datadog_api_client.v2.model.experiments_bandit_v2_dto_data import ExperimentsBanditV2DTOData +from datadog_api_client.v2.model.experiments_bandit_v2_dto_data_attributes import ExperimentsBanditV2DTODataAttributes +from datadog_api_client.v2.model.experiments_bandit_v2_dto_data_type import ExperimentsBanditV2DTODataType +from datadog_api_client.v2.model.experiments_bandit_v2_list_dto_array import ExperimentsBanditV2ListDTOArray +from datadog_api_client.v2.model.experiments_bandit_v2_list_dto_data import ExperimentsBanditV2ListDTOData +from datadog_api_client.v2.model.experiments_bandit_v2_list_dto_data_attributes import ( + ExperimentsBanditV2ListDTODataAttributes, +) +from datadog_api_client.v2.model.experiments_bandit_v2_read_meta_dto import ExperimentsBanditV2ReadMetaDTO +from datadog_api_client.v2.model.experiments_bandit_v2_warning_code import ExperimentsBanditV2WarningCode +from datadog_api_client.v2.model.experiments_bandit_v2_warning_dto import ExperimentsBanditV2WarningDTO +from datadog_api_client.v2.model.experiments_bandit_variant_result_v2 import ExperimentsBanditVariantResultV2 +from datadog_api_client.v2.model.experiments_bandit_variant_v2 import ExperimentsBanditVariantV2 from datadog_api_client.v2.model.experiments_cancel_experiment_v2_request import ExperimentsCancelExperimentV2Request from datadog_api_client.v2.model.experiments_cancel_experiment_v2_request_data import ( ExperimentsCancelExperimentV2RequestData, @@ -16799,6 +16861,48 @@ "ExperimentsAnalysisPlanWriteV2RequestDataAttributes", "ExperimentsAnalysisPlanWriteV2RequestDataAttributesBayesianPrior", "ExperimentsAnalysisPlanWriteV2RequestDataType", + "ExperimentsBanditArmDataStatus", + "ExperimentsBanditBayesianPriorV2", + "ExperimentsBanditConfidenceIntervalV2", + "ExperimentsBanditDailyTrafficV2", + "ExperimentsBanditDesiredChange", + "ExperimentsBanditFlagConfigurationV2", + "ExperimentsBanditNullableConfidenceIntervalV2", + "ExperimentsBanditObservationCountsV2", + "ExperimentsBanditOptimalVariantUnavailableReason", + "ExperimentsBanditPointEstimateV2", + "ExperimentsBanditPolicyKind", + "ExperimentsBanditPolicyReason", + "ExperimentsBanditPolicyV2", + "ExperimentsBanditPolicyVariantV2", + "ExperimentsBanditPosteriorUnavailableReason", + "ExperimentsBanditRefreshStatus", + "ExperimentsBanditRefreshV2", + "ExperimentsBanditResultsState", + "ExperimentsBanditResultsV2DTO", + "ExperimentsBanditResultsV2DTOData", + "ExperimentsBanditResultsV2DTODataAttributes", + "ExperimentsBanditResultsV2DTODataType", + "ExperimentsBanditScheduledEndFailureV2", + "ExperimentsBanditStatisticsStatus", + "ExperimentsBanditStatus", + "ExperimentsBanditTrafficSummaryV2DTO", + "ExperimentsBanditTrafficSummaryV2DTOData", + "ExperimentsBanditTrafficSummaryV2DTODataAttributes", + "ExperimentsBanditTrafficSummaryV2DTODataType", + "ExperimentsBanditTrafficVariantV2", + "ExperimentsBanditV2DTO", + "ExperimentsBanditV2DTOData", + "ExperimentsBanditV2DTODataAttributes", + "ExperimentsBanditV2DTODataType", + "ExperimentsBanditV2ListDTOArray", + "ExperimentsBanditV2ListDTOData", + "ExperimentsBanditV2ListDTODataAttributes", + "ExperimentsBanditV2ReadMetaDTO", + "ExperimentsBanditV2WarningCode", + "ExperimentsBanditV2WarningDTO", + "ExperimentsBanditVariantResultV2", + "ExperimentsBanditVariantV2", "ExperimentsCancelExperimentV2Request", "ExperimentsCancelExperimentV2RequestData", "ExperimentsCancelExperimentV2RequestDataAttributes", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index 4f0bdf135b..578a7351ed 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -6083,6 +6083,27 @@ "scenario": "Delete subject type returns \"No Content\" response", "version": "v2" }, + { + "feature": "Experiments", + "feature_file": "../../v2/features/experiments.feature", + "file": "v2/experiments/get-bandit-results-returns-no-bandit-with-this-id-exists-for-the-organization-response.json", + "scenario": "Get bandit results returns \"No bandit with this ID exists for the organization.\" response", + "version": "v2" + }, + { + "feature": "Experiments", + "feature_file": "../../v2/features/experiments.feature", + "file": "v2/experiments/get-bandit-returns-no-bandit-with-this-id-exists-for-the-organization-response.json", + "scenario": "Get bandit returns \"No bandit with this ID exists for the organization.\" response", + "version": "v2" + }, + { + "feature": "Experiments", + "feature_file": "../../v2/features/experiments.feature", + "file": "v2/experiments/get-bandit-traffic-summary-returns-no-bandit-with-this-id-exists-for-the-organization-response.json", + "scenario": "Get bandit traffic summary returns \"No bandit with this ID exists for the organization.\" response", + "version": "v2" + }, { "feature": "Experiments", "feature_file": "../../v2/features/experiments.feature", @@ -6139,6 +6160,13 @@ "scenario": "Get subject type returns \"OK\" response", "version": "v2" }, + { + "feature": "Experiments", + "feature_file": "../../v2/features/experiments.feature", + "file": "v2/experiments/list-bandits-returns-ok-response.json", + "scenario": "List bandits returns \"OK\" response", + "version": "v2" + }, { "feature": "Experiments", "feature_file": "../../v2/features/experiments.feature", diff --git a/tests/generated-test/test-runner-data/v2/experiments/get-bandit-results-returns-no-bandit-with-this-id-exists-for-the-organization-response.json b/tests/generated-test/test-runner-data/v2/experiments/get-bandit-results-returns-no-bandit-with-this-id-exists-for-the-organization-response.json new file mode 100644 index 0000000000..97781e86e6 --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/experiments/get-bandit-results-returns-no-bandit-with-this-id-exists-for-the-organization-response.json @@ -0,0 +1,35 @@ +{ + "api": "Experiments", + "expected_status": 404, + "feature": "Experiments", + "id": "v2/Experiments/Get bandit results returns \"No bandit with this ID exists for the organization.\" response", + "operation_id": "GetBanditResults", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "bandit_id", + "required": true, + "schema": { + "format": "uuid", + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "00000000-0000-4000-8000-000000000000" + }, + "style": null + } + ], + "path": "/api/v2/experiments/bandits/{bandit_id}/results" + }, + "scenario": "Get bandit results returns \"No bandit with this ID exists for the organization.\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-runner-data/v2/experiments/get-bandit-returns-no-bandit-with-this-id-exists-for-the-organization-response.json b/tests/generated-test/test-runner-data/v2/experiments/get-bandit-returns-no-bandit-with-this-id-exists-for-the-organization-response.json new file mode 100644 index 0000000000..9ff14cf5c6 --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/experiments/get-bandit-returns-no-bandit-with-this-id-exists-for-the-organization-response.json @@ -0,0 +1,35 @@ +{ + "api": "Experiments", + "expected_status": 404, + "feature": "Experiments", + "id": "v2/Experiments/Get bandit returns \"No bandit with this ID exists for the organization.\" response", + "operation_id": "GetBandit", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "bandit_id", + "required": true, + "schema": { + "format": "uuid", + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "00000000-0000-4000-8000-000000000000" + }, + "style": null + } + ], + "path": "/api/v2/experiments/bandits/{bandit_id}" + }, + "scenario": "Get bandit returns \"No bandit with this ID exists for the organization.\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-runner-data/v2/experiments/get-bandit-traffic-summary-returns-no-bandit-with-this-id-exists-for-the-organization-response.json b/tests/generated-test/test-runner-data/v2/experiments/get-bandit-traffic-summary-returns-no-bandit-with-this-id-exists-for-the-organization-response.json new file mode 100644 index 0000000000..9a25e9a4a8 --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/experiments/get-bandit-traffic-summary-returns-no-bandit-with-this-id-exists-for-the-organization-response.json @@ -0,0 +1,35 @@ +{ + "api": "Experiments", + "expected_status": 404, + "feature": "Experiments", + "id": "v2/Experiments/Get bandit traffic summary returns \"No bandit with this ID exists for the organization.\" response", + "operation_id": "GetBanditTrafficSummary", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "bandit_id", + "required": true, + "schema": { + "format": "uuid", + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "00000000-0000-4000-8000-000000000000" + }, + "style": null + } + ], + "path": "/api/v2/experiments/bandits/{bandit_id}/traffic-summary" + }, + "scenario": "Get bandit traffic summary returns \"No bandit with this ID exists for the organization.\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-runner-data/v2/experiments/list-bandits-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/experiments/list-bandits-returns-ok-response.json new file mode 100644 index 0000000000..ed8eaed400 --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/experiments/list-bandits-returns-ok-response.json @@ -0,0 +1,18 @@ +{ + "api": "Experiments", + "expected_status": 200, + "feature": "Experiments", + "id": "v2/Experiments/List bandits returns \"OK\" response", + "operation_id": "ListBandits", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [], + "path": "/api/v2/experiments/bandits" + }, + "scenario": "List bandits returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-server-data/v2/experiments.json b/tests/generated-test/test-server-data/v2/experiments.json index c70c16f199..9f001dbf18 100644 --- a/tests/generated-test/test-server-data/v2/experiments.json +++ b/tests/generated-test/test-server-data/v2/experiments.json @@ -1563,6 +1563,99 @@ "scenario": "Delete subject type returns \"No Content\" response", "version": "v2" }, + { + "feature": "Experiments", + "frozen_at": "2026-11-13T12:21:33.645Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/experiments/bandits/00000000-0000-4000-8000-000000000000/results", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"No bandit with this ID exists for the organization.\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Not Found", + "status": 404 + } + } + ], + "scenario": "Get bandit results returns \"No bandit with this ID exists for the organization.\" response", + "version": "v2" + }, + { + "feature": "Experiments", + "frozen_at": "2026-11-13T12:21:35.097Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/experiments/bandits/00000000-0000-4000-8000-000000000000", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"No bandit with this ID exists for the organization.\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Not Found", + "status": 404 + } + } + ], + "scenario": "Get bandit returns \"No bandit with this ID exists for the organization.\" response", + "version": "v2" + }, + { + "feature": "Experiments", + "frozen_at": "2026-11-13T12:21:35.230Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/experiments/bandits/00000000-0000-4000-8000-000000000000/traffic-summary", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"No bandit with this ID exists for the organization.\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Not Found", + "status": 404 + } + } + ], + "scenario": "Get bandit traffic summary returns \"No bandit with this ID exists for the organization.\" response", + "version": "v2" + }, { "feature": "Experiments", "frozen_at": "2026-09-29T01:19:14.875Z", @@ -2235,6 +2328,37 @@ "scenario": "Get subject type returns \"OK\" response", "version": "v2" }, + { + "feature": "Experiments", + "frozen_at": "2026-11-13T12:21:35.390Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/experiments/bandits", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":[],\"meta\":{\"page\":{\"type\":\"offset_limit\",\"offset\":0,\"limit\":25,\"total\":0,\"first_offset\":0,\"prev_offset\":null,\"next_offset\":null,\"last_offset\":0}},\"links\":{\"self\":\"https://api.datadoghq.com/api/v2/experiments/bandits\",\"first\":\"https://api.datadoghq.com/api/v2/experiments/bandits?page%5Blimit%5D=25\\u0026page%5Boffset%5D=0\",\"last\":\"https://api.datadoghq.com/api/v2/experiments/bandits?page%5Blimit%5D=25\\u0026page%5Boffset%5D=0\"}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "List bandits returns \"OK\" response", + "version": "v2" + }, { "feature": "Experiments", "frozen_at": "2026-11-11T15:51:16.342Z", diff --git a/tests/v2/features/experiments.feature b/tests/v2/features/experiments.feature index d0741a1475..b77178d8fc 100644 --- a/tests/v2/features/experiments.feature +++ b/tests/v2/features/experiments.feature @@ -590,6 +590,78 @@ Feature: Experiments When the request is sent Then the response status is 204 The subject type was deleted. + @generated @skip @team:ddoghq/experimentation + Scenario: Get bandit results returns "Malformed bandit ID (not a valid UUID), or start or end isn't an RFC3339 timestamp, or start isn't before end." response + Given operation "GetBanditResults" enabled + And new "GetBanditResults" request + And request contains "bandit_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Malformed bandit ID (not a valid UUID), or start or end isn't an RFC3339 timestamp, or start isn't before end. + + @team:ddoghq/experimentation + Scenario: Get bandit results returns "No bandit with this ID exists for the organization." response + Given operation "GetBanditResults" enabled + And new "GetBanditResults" request + And request contains "bandit_id" parameter with value "00000000-0000-4000-8000-000000000000" + When the request is sent + Then the response status is 404 No bandit with this ID exists for the organization. + + @generated @skip @team:ddoghq/experimentation + Scenario: Get bandit results returns "OK" response + Given operation "GetBanditResults" enabled + And new "GetBanditResults" request + And request contains "bandit_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/experimentation + Scenario: Get bandit returns "Malformed bandit ID (not a valid UUID)." response + Given operation "GetBandit" enabled + And new "GetBandit" request + And request contains "bandit_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Malformed bandit ID (not a valid UUID). + + @team:ddoghq/experimentation + Scenario: Get bandit returns "No bandit with this ID exists for the organization." response + Given operation "GetBandit" enabled + And new "GetBandit" request + And request contains "bandit_id" parameter with value "00000000-0000-4000-8000-000000000000" + When the request is sent + Then the response status is 404 No bandit with this ID exists for the organization. + + @generated @skip @team:ddoghq/experimentation + Scenario: Get bandit returns "OK" response + Given operation "GetBandit" enabled + And new "GetBandit" request + And request contains "bandit_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/experimentation + Scenario: Get bandit traffic summary returns "Malformed bandit ID (not a valid UUID), or start or end isn't an RFC3339 timestamp, or start isn't before end." response + Given operation "GetBanditTrafficSummary" enabled + And new "GetBanditTrafficSummary" request + And request contains "bandit_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Malformed bandit ID (not a valid UUID), or start or end isn't an RFC3339 timestamp, or start isn't before end. + + @team:ddoghq/experimentation + Scenario: Get bandit traffic summary returns "No bandit with this ID exists for the organization." response + Given operation "GetBanditTrafficSummary" enabled + And new "GetBanditTrafficSummary" request + And request contains "bandit_id" parameter with value "00000000-0000-4000-8000-000000000000" + When the request is sent + Then the response status is 404 No bandit with this ID exists for the organization. + + @generated @skip @team:ddoghq/experimentation + Scenario: Get bandit traffic summary returns "OK" response + Given operation "GetBanditTrafficSummary" enabled + And new "GetBanditTrafficSummary" request + And request contains "bandit_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/experimentation Scenario: Get experiment analysis plan returns "Malformed experiment ID." response Given new "GetExperimentAnalysisPlan" request @@ -861,6 +933,20 @@ Feature: Experiments When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/experimentation + Scenario: List bandits returns "Invalid query parameter: an unknown status or sort field, a subject_type_id that isn't a UUID, a search over 1024 characters, or a malformed page parameter." response + Given operation "ListBandits" enabled + And new "ListBandits" request + When the request is sent + Then the response status is 400 Invalid query parameter: an unknown status or sort field, a subject_type_id that isn't a UUID, a search over 1024 characters, or a malformed page parameter. + + @team:ddoghq/experimentation + Scenario: List bandits returns "OK" response + Given operation "ListBandits" enabled + And new "ListBandits" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/experimentation Scenario: List experiment holdouts returns "Malformed experiment ID (not a valid UUID)." response Given new "ListExperimentHoldouts" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 0d9b33aa46..6c374f5e61 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2867,6 +2867,30 @@ "type": "unsafe" } }, + "ListBandits": { + "tag": "Experiments", + "undo": { + "type": "safe" + } + }, + "GetBandit": { + "tag": "Experiments", + "undo": { + "type": "safe" + } + }, + "GetBanditResults": { + "tag": "Experiments", + "undo": { + "type": "safe" + } + }, + "GetBanditTrafficSummary": { + "tag": "Experiments", + "undo": { + "type": "safe" + } + }, "ListExposureSQLModels": { "tag": "Experiments", "undo": {