From 89c76be52949cd09ec826c404edcf0a47e7dd033 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 21 Oct 2026 10:18:27 +0000 Subject: [PATCH] Regenerate client from commit 488020f of spec repo --- .generator/schemas/v2/openapi.yaml | 164 ++++++++++++++++ .../ValidatePipeline_3654691150.py | 137 +++++++++++++ .../ValidatePipeline_3666485614.py | 91 +++++++++ ...ability_pipeline_config_processor_group.py | 4 + ...vability_pipeline_config_processor_item.py | 26 +++ ...ity_pipeline_spike_protection_processor.py | 174 +++++++++++++++++ ...rocessor_action_when_missing_partitions.py | 44 +++++ ..._protection_processor_minimal_threshold.py | 47 +++++ ...processor_minimal_threshold_always_keep.py | 44 +++++ ...ssor_minimal_threshold_always_keep_type.py | 37 ++++ ...ction_processor_minimal_threshold_bytes.py | 52 +++++ ..._processor_minimal_threshold_bytes_type.py | 37 ++++ ...spike_protection_processor_spike_action.py | 52 +++++ ...protection_processor_threshold_override.py | 67 +++++++ ...ipeline_spike_protection_processor_type.py | 37 ++++ src/datadog_api_client/v2/models/__init__.py | 40 ++++ .../test-runner-data/manifest.json | 14 ++ ...tection-processor-returns-ok-response.json | 72 +++++++ ...reshold-overrides-returns-ok-response.json | 99 ++++++++++ .../v2/observability-pipelines.json | 181 ++++++++++++++++++ .../features/observability_pipelines.feature | 16 ++ 21 files changed, 1435 insertions(+) create mode 100644 examples/v2/observability-pipelines/ValidatePipeline_3654691150.py create mode 100644 examples/v2/observability-pipelines/ValidatePipeline_3666485614.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_action_when_missing_partitions.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_always_keep.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_always_keep_type.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_bytes.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_bytes_type.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_spike_action.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_threshold_override.py create mode 100644 src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_type.py create mode 100644 tests/generated-test/test-runner-data/v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-returns-ok-response.json create mode 100644 tests/generated-test/test-runner-data/v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-threshold-overrides-returns-ok-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index a76195ae98..d8e17ba56d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -84707,6 +84707,7 @@ components: - $ref: "#/components/schemas/ObservabilityPipelineRenameFieldsProcessor" - $ref: "#/components/schemas/ObservabilityPipelineSampleProcessor" - $ref: "#/components/schemas/ObservabilityPipelineSensitiveDataScannerProcessor" + - $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessor" - $ref: "#/components/schemas/ObservabilityPipelineSplitArrayProcessor" - $ref: "#/components/schemas/ObservabilityPipelineThrottleProcessor" - $ref: "#/components/schemas/ObservabilityPipelineAddMetricTagsProcessor" @@ -89159,6 +89160,169 @@ components: - type - attributes type: object + ObservabilityPipelineSpikeProtectionProcessor: + description: |- + The `spike_protection` processor learns the normal ingestion volume for the logs that match a specified filter and takes action when the volume spikes unexpectedly. + + **Supported pipeline types:** logs + properties: + action_when_missing_partitions: + $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions" + display_name: + $ref: "#/components/schemas/ObservabilityPipelineComponentDisplayName" + enabled: + description: Indicates whether the processor is enabled. + example: true + type: boolean + id: + description: The unique identifier for this component. Used in other parts of the pipeline to reference this component (for example, as the `input` to downstream components). + example: "spike-protection-processor" + type: string + include: + description: A Datadog search query used to determine which logs this processor targets. + example: "service:my-service" + type: string + minimal_threshold: + description: The minimum volume, in bytes, that must be observed within 24 hours before spike protection can activate. Defaults to 100 GiB. + example: 107374182400 + format: int64 + type: integer + minimal_threshold_overrides: + description: A list of per-partition overrides for the minimal threshold, identified by matching field values. Requires `partition_fields` to be set. + items: + $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessorThresholdOverride" + type: array + name: + description: Name of the spike protection rule. + example: MySpikeProtection + type: string + partition_fields: + description: A list of fields used to segment log traffic. Volume is learned and evaluated independently for each unique combination of these field values. A maximum of five fields is supported. + items: + description: The name of a log field used to partition spike detection. + maxLength: 128 + type: string + maxItems: 5 + type: array + uniqueItems: true + spike_action: + $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessorSpikeAction" + spike_threshold: + description: The number of standard deviations above the learned mean volume that must be exceeded before a spike is detected. Defaults to `5`. + example: 5 + format: double + type: number + type: + $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessorType" + required: + - id + - type + - include + - name + - spike_action + - enabled + type: object + x-pipeline-types: [logs] + ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions: + default: ignore + description: |- + How to handle logs that are missing one of the `partition_fields`. Options: + - `ignore`: Forward the event without applying spike protection. + - `default_bucket`: Assign the event to a default partition. + enum: + - ignore + - default_bucket + example: ignore + type: string + x-enum-varnames: + - IGNORE + - DEFAULT_BUCKET + ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold: + description: The minimal threshold to apply to the matching partition. + oneOf: + - $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes" + - $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep" + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep: + description: Never activates spike protection for the matching partition, regardless of volume. + properties: + type: + $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType" + required: + - type + type: object + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType: + default: always_keep + description: The minimal threshold type. The value should always be `always_keep`. + enum: + - always_keep + example: always_keep + type: string + x-enum-varnames: + - ALWAYS_KEEP + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes: + description: Sets a specific byte threshold for the matching partition. + properties: + bytes: + description: The minimal threshold, in bytes, for the matching partition. + example: 107374182400 + format: int64 + type: integer + type: + $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType" + required: + - type + - bytes + type: object + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType: + default: threshold + description: The minimal threshold type. The value should always be `threshold`. + enum: + - threshold + example: threshold + type: string + x-enum-varnames: + - THRESHOLD + ObservabilityPipelineSpikeProtectionProcessorSpikeAction: + description: |- + The action to take with matching logs while spike protection is active. Options: + - `drop`: Drop the event. + - `no_action`: Let the event pass through. + - `overflow_routing`: Route to an overflow destination. + + When `overflow_routing` is used, there must be a destination whose `inputs` reference this processor with the `.overflow_events` suffix to route the overflowing events. + enum: + - drop + - no_action + - overflow_routing + example: drop + type: string + x-enum-varnames: + - DROP + - NO_ACTION + - OVERFLOW_ROUTING + ObservabilityPipelineSpikeProtectionProcessorThresholdOverride: + description: Defines a minimal threshold that applies to a specific partition instead of the processor-wide `minimal_threshold`. + properties: + fields: + description: The set of field matchers that identifies the partition this override applies to. Every field name listed must also appear in `partition_fields`. + items: + $ref: "#/components/schemas/ObservabilityPipelineFieldValue" + type: array + minimal_threshold: + $ref: "#/components/schemas/ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold" + required: + - fields + - minimal_threshold + type: object + ObservabilityPipelineSpikeProtectionProcessorType: + default: spike_protection + description: The processor type. The value should always be `spike_protection`. + enum: + - spike_protection + example: spike_protection + type: string + x-enum-varnames: + - SPIKE_PROTECTION ObservabilityPipelineSplitArrayProcessor: description: |- The `split_array` processor splits array fields into separate events based on configured rules. diff --git a/examples/v2/observability-pipelines/ValidatePipeline_3654691150.py b/examples/v2/observability-pipelines/ValidatePipeline_3654691150.py new file mode 100644 index 0000000000..1064b90c9a --- /dev/null +++ b/examples/v2/observability-pipelines/ValidatePipeline_3654691150.py @@ -0,0 +1,137 @@ +""" +Validate an observability pipeline with spike protection processor threshold overrides returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.observability_pipelines_api import ObservabilityPipelinesApi +from datadog_api_client.v2.model.observability_pipeline_config import ObservabilityPipelineConfig +from datadog_api_client.v2.model.observability_pipeline_config_processor_group import ( + ObservabilityPipelineConfigProcessorGroup, +) +from datadog_api_client.v2.model.observability_pipeline_data_attributes import ObservabilityPipelineDataAttributes +from datadog_api_client.v2.model.observability_pipeline_datadog_agent_source import ( + ObservabilityPipelineDatadogAgentSource, +) +from datadog_api_client.v2.model.observability_pipeline_datadog_agent_source_type import ( + ObservabilityPipelineDatadogAgentSourceType, +) +from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination import ( + ObservabilityPipelineDatadogLogsDestination, +) +from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_type import ( + ObservabilityPipelineDatadogLogsDestinationType, +) +from datadog_api_client.v2.model.observability_pipeline_field_value import ObservabilityPipelineFieldValue +from datadog_api_client.v2.model.observability_pipeline_spec import ObservabilityPipelineSpec +from datadog_api_client.v2.model.observability_pipeline_spec_data import ObservabilityPipelineSpecData +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor import ( + ObservabilityPipelineSpikeProtectionProcessor, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_action_when_missing_partitions import ( + ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_always_keep import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_always_keep_type import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_bytes import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_bytes_type import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_spike_action import ( + ObservabilityPipelineSpikeProtectionProcessorSpikeAction, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_threshold_override import ( + ObservabilityPipelineSpikeProtectionProcessorThresholdOverride, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_type import ( + ObservabilityPipelineSpikeProtectionProcessorType, +) + +body = ObservabilityPipelineSpec( + data=ObservabilityPipelineSpecData( + attributes=ObservabilityPipelineDataAttributes( + config=ObservabilityPipelineConfig( + destinations=[ + ObservabilityPipelineDatadogLogsDestination( + id="datadog-logs-destination", + inputs=[ + "my-processor-group", + ], + type=ObservabilityPipelineDatadogLogsDestinationType.DATADOG_LOGS, + ), + ], + processor_groups=[ + ObservabilityPipelineConfigProcessorGroup( + enabled=True, + id="my-processor-group", + include="service:my-service", + inputs=[ + "datadog-agent-source", + ], + processors=[ + ObservabilityPipelineSpikeProtectionProcessor( + enabled=True, + id="spike-protection-processor", + include="*", + type=ObservabilityPipelineSpikeProtectionProcessorType.SPIKE_PROTECTION, + name="MyPartitionedSpikeProtection", + spike_action=ObservabilityPipelineSpikeProtectionProcessorSpikeAction.NO_ACTION, + partition_fields=[ + "service", + ], + action_when_missing_partitions=ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions.DEFAULT_BUCKET, + minimal_threshold_overrides=[ + ObservabilityPipelineSpikeProtectionProcessorThresholdOverride( + fields=[ + ObservabilityPipelineFieldValue( + name="service", + value="checkout", + ), + ], + minimal_threshold=ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes( + type=ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType.THRESHOLD, + bytes=53687091200, + ), + ), + ObservabilityPipelineSpikeProtectionProcessorThresholdOverride( + fields=[ + ObservabilityPipelineFieldValue( + name="service", + value="payments", + ), + ], + minimal_threshold=ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep( + type=ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType.ALWAYS_KEEP, + ), + ), + ], + ), + ], + ), + ], + sources=[ + ObservabilityPipelineDatadogAgentSource( + id="datadog-agent-source", + type=ObservabilityPipelineDatadogAgentSourceType.DATADOG_AGENT, + ), + ], + ), + name="Pipeline with Spike Protection Threshold Overrides", + ), + type="pipelines", + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = ObservabilityPipelinesApi(api_client) + response = api_instance.validate_pipeline(body=body) + + print(response) diff --git a/examples/v2/observability-pipelines/ValidatePipeline_3666485614.py b/examples/v2/observability-pipelines/ValidatePipeline_3666485614.py new file mode 100644 index 0000000000..fd595fd22f --- /dev/null +++ b/examples/v2/observability-pipelines/ValidatePipeline_3666485614.py @@ -0,0 +1,91 @@ +""" +Validate an observability pipeline with spike protection processor returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.observability_pipelines_api import ObservabilityPipelinesApi +from datadog_api_client.v2.model.observability_pipeline_config import ObservabilityPipelineConfig +from datadog_api_client.v2.model.observability_pipeline_config_processor_group import ( + ObservabilityPipelineConfigProcessorGroup, +) +from datadog_api_client.v2.model.observability_pipeline_data_attributes import ObservabilityPipelineDataAttributes +from datadog_api_client.v2.model.observability_pipeline_datadog_agent_source import ( + ObservabilityPipelineDatadogAgentSource, +) +from datadog_api_client.v2.model.observability_pipeline_datadog_agent_source_type import ( + ObservabilityPipelineDatadogAgentSourceType, +) +from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination import ( + ObservabilityPipelineDatadogLogsDestination, +) +from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_type import ( + ObservabilityPipelineDatadogLogsDestinationType, +) +from datadog_api_client.v2.model.observability_pipeline_spec import ObservabilityPipelineSpec +from datadog_api_client.v2.model.observability_pipeline_spec_data import ObservabilityPipelineSpecData +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor import ( + ObservabilityPipelineSpikeProtectionProcessor, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_spike_action import ( + ObservabilityPipelineSpikeProtectionProcessorSpikeAction, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_type import ( + ObservabilityPipelineSpikeProtectionProcessorType, +) + +body = ObservabilityPipelineSpec( + data=ObservabilityPipelineSpecData( + attributes=ObservabilityPipelineDataAttributes( + config=ObservabilityPipelineConfig( + destinations=[ + ObservabilityPipelineDatadogLogsDestination( + id="datadog-logs-destination", + inputs=[ + "my-processor-group", + ], + type=ObservabilityPipelineDatadogLogsDestinationType.DATADOG_LOGS, + ), + ], + processor_groups=[ + ObservabilityPipelineConfigProcessorGroup( + enabled=True, + id="my-processor-group", + include="service:my-service", + inputs=[ + "datadog-agent-source", + ], + processors=[ + ObservabilityPipelineSpikeProtectionProcessor( + enabled=True, + id="spike-protection-processor", + include="*", + type=ObservabilityPipelineSpikeProtectionProcessorType.SPIKE_PROTECTION, + name="MySpikeProtection", + spike_action=ObservabilityPipelineSpikeProtectionProcessorSpikeAction.DROP, + spike_threshold=5.0, + minimal_threshold=107374182400, + ), + ], + ), + ], + sources=[ + ObservabilityPipelineDatadogAgentSource( + id="datadog-agent-source", + type=ObservabilityPipelineDatadogAgentSourceType.DATADOG_AGENT, + ), + ], + ), + name="Pipeline with Spike Protection", + ), + type="pipelines", + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = ObservabilityPipelinesApi(api_client) + response = api_instance.validate_pipeline(body=body) + + print(response) diff --git a/src/datadog_api_client/v2/model/observability_pipeline_config_processor_group.py b/src/datadog_api_client/v2/model/observability_pipeline_config_processor_group.py index 7f0dd28faa..f15655c650 100644 --- a/src/datadog_api_client/v2/model/observability_pipeline_config_processor_group.py +++ b/src/datadog_api_client/v2/model/observability_pipeline_config_processor_group.py @@ -65,6 +65,9 @@ from datadog_api_client.v2.model.observability_pipeline_sensitive_data_scanner_processor import ( ObservabilityPipelineSensitiveDataScannerProcessor, ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor import ( + ObservabilityPipelineSpikeProtectionProcessor, + ) from datadog_api_client.v2.model.observability_pipeline_split_array_processor import ( ObservabilityPipelineSplitArrayProcessor, ) @@ -145,6 +148,7 @@ def __init__( ObservabilityPipelineRenameFieldsProcessor, ObservabilityPipelineSampleProcessor, ObservabilityPipelineSensitiveDataScannerProcessor, + ObservabilityPipelineSpikeProtectionProcessor, ObservabilityPipelineSplitArrayProcessor, ObservabilityPipelineThrottleProcessor, ObservabilityPipelineAddMetricTagsProcessor, diff --git a/src/datadog_api_client/v2/model/observability_pipeline_config_processor_item.py b/src/datadog_api_client/v2/model/observability_pipeline_config_processor_item.py index d4cb85652e..3877c41163 100644 --- a/src/datadog_api_client/v2/model/observability_pipeline_config_processor_item.py +++ b/src/datadog_api_client/v2/model/observability_pipeline_config_processor_item.py @@ -148,6 +148,28 @@ def __init__(self, **kwargs): :param percentage: The percentage of logs to sample. :type percentage: float + :param action_when_missing_partitions: How to handle logs that are missing one of the `partition_fields`. Options: + - `ignore`: Forward the event without applying spike protection. + - `default_bucket`: Assign the event to a default partition. + :type action_when_missing_partitions: ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions, optional + + :param minimal_threshold: The minimum volume, in bytes, that must be observed within 24 hours before spike protection can activate. Defaults to 100 GiB. + :type minimal_threshold: int, optional + + :param minimal_threshold_overrides: A list of per-partition overrides for the minimal threshold, identified by matching field values. Requires `partition_fields` to be set. + :type minimal_threshold_overrides: [ObservabilityPipelineSpikeProtectionProcessorThresholdOverride], optional + + :param spike_action: The action to take with matching logs while spike protection is active. Options: + - `drop`: Drop the event. + - `no_action`: Let the event pass through. + - `overflow_routing`: Route to an overflow destination. + + When `overflow_routing` is used, there must be a destination whose `inputs` reference this processor with the `.overflow_events` suffix to route the overflowing events. + :type spike_action: ObservabilityPipelineSpikeProtectionProcessorSpikeAction + + :param spike_threshold: The number of standard deviations above the learned mean volume that must be exceeded before a spike is detected. Defaults to `5`. + :type spike_threshold: float, optional + :param arrays: A list of array split configurations. :type arrays: [ObservabilityPipelineSplitArrayProcessorArrayConfig] @@ -249,6 +271,9 @@ def _composed_schemas(_): from datadog_api_client.v2.model.observability_pipeline_sensitive_data_scanner_processor import ( ObservabilityPipelineSensitiveDataScannerProcessor, ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor import ( + ObservabilityPipelineSpikeProtectionProcessor, + ) from datadog_api_client.v2.model.observability_pipeline_split_array_processor import ( ObservabilityPipelineSplitArrayProcessor, ) @@ -296,6 +321,7 @@ def _composed_schemas(_): ObservabilityPipelineRenameFieldsProcessor, ObservabilityPipelineSampleProcessor, ObservabilityPipelineSensitiveDataScannerProcessor, + ObservabilityPipelineSpikeProtectionProcessor, ObservabilityPipelineSplitArrayProcessor, ObservabilityPipelineThrottleProcessor, ObservabilityPipelineAddMetricTagsProcessor, diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor.py new file mode 100644 index 0000000000..e2a7d91644 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor.py @@ -0,0 +1,174 @@ +# 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.observability_pipeline_spike_protection_processor_action_when_missing_partitions import ( + ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions, + ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_threshold_override import ( + ObservabilityPipelineSpikeProtectionProcessorThresholdOverride, + ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_spike_action import ( + ObservabilityPipelineSpikeProtectionProcessorSpikeAction, + ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_type import ( + ObservabilityPipelineSpikeProtectionProcessorType, + ) + + +class ObservabilityPipelineSpikeProtectionProcessor(ModelNormal): + validations = { + "partition_fields": { + "max_items": 5, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_action_when_missing_partitions import ( + ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions, + ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_threshold_override import ( + ObservabilityPipelineSpikeProtectionProcessorThresholdOverride, + ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_spike_action import ( + ObservabilityPipelineSpikeProtectionProcessorSpikeAction, + ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_type import ( + ObservabilityPipelineSpikeProtectionProcessorType, + ) + + return { + "action_when_missing_partitions": ( + ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions, + ), + "display_name": (str,), + "enabled": (bool,), + "id": (str,), + "include": (str,), + "minimal_threshold": (int,), + "minimal_threshold_overrides": ([ObservabilityPipelineSpikeProtectionProcessorThresholdOverride],), + "name": (str,), + "partition_fields": ([str],), + "spike_action": (ObservabilityPipelineSpikeProtectionProcessorSpikeAction,), + "spike_threshold": (float,), + "type": (ObservabilityPipelineSpikeProtectionProcessorType,), + } + + attribute_map = { + "action_when_missing_partitions": "action_when_missing_partitions", + "display_name": "display_name", + "enabled": "enabled", + "id": "id", + "include": "include", + "minimal_threshold": "minimal_threshold", + "minimal_threshold_overrides": "minimal_threshold_overrides", + "name": "name", + "partition_fields": "partition_fields", + "spike_action": "spike_action", + "spike_threshold": "spike_threshold", + "type": "type", + } + + def __init__( + self_, + enabled: bool, + id: str, + include: str, + name: str, + spike_action: ObservabilityPipelineSpikeProtectionProcessorSpikeAction, + type: ObservabilityPipelineSpikeProtectionProcessorType, + action_when_missing_partitions: Union[ + ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions, UnsetType + ] = unset, + display_name: Union[str, UnsetType] = unset, + minimal_threshold: Union[int, UnsetType] = unset, + minimal_threshold_overrides: Union[ + List[ObservabilityPipelineSpikeProtectionProcessorThresholdOverride], UnsetType + ] = unset, + partition_fields: Union[List[str], UnsetType] = unset, + spike_threshold: Union[float, UnsetType] = unset, + **kwargs, + ): + """ + The ``spike_protection`` processor learns the normal ingestion volume for the logs that match a specified filter and takes action when the volume spikes unexpectedly. + + **Supported pipeline types:** logs + + :param action_when_missing_partitions: How to handle logs that are missing one of the ``partition_fields``. Options: + + * ``ignore`` : Forward the event without applying spike protection. + * ``default_bucket`` : Assign the event to a default partition. + :type action_when_missing_partitions: ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions, optional + + :param display_name: The display name for a component. + :type display_name: str, optional + + :param enabled: Indicates whether the processor is enabled. + :type enabled: bool + + :param id: The unique identifier for this component. Used in other parts of the pipeline to reference this component (for example, as the ``input`` to downstream components). + :type id: str + + :param include: A Datadog search query used to determine which logs this processor targets. + :type include: str + + :param minimal_threshold: The minimum volume, in bytes, that must be observed within 24 hours before spike protection can activate. Defaults to 100 GiB. + :type minimal_threshold: int, optional + + :param minimal_threshold_overrides: A list of per-partition overrides for the minimal threshold, identified by matching field values. Requires ``partition_fields`` to be set. + :type minimal_threshold_overrides: [ObservabilityPipelineSpikeProtectionProcessorThresholdOverride], optional + + :param name: Name of the spike protection rule. + :type name: str + + :param partition_fields: A list of fields used to segment log traffic. Volume is learned and evaluated independently for each unique combination of these field values. A maximum of five fields is supported. + :type partition_fields: [str], optional + + :param spike_action: The action to take with matching logs while spike protection is active. Options: + + * ``drop`` : Drop the event. + * ``no_action`` : Let the event pass through. + * ``overflow_routing`` : Route to an overflow destination. + + When ``overflow_routing`` is used, there must be a destination whose ``inputs`` reference this processor with the ``.overflow_events`` suffix to route the overflowing events. + :type spike_action: ObservabilityPipelineSpikeProtectionProcessorSpikeAction + + :param spike_threshold: The number of standard deviations above the learned mean volume that must be exceeded before a spike is detected. Defaults to ``5``. + :type spike_threshold: float, optional + + :param type: The processor type. The value should always be ``spike_protection``. + :type type: ObservabilityPipelineSpikeProtectionProcessorType + """ + if action_when_missing_partitions is not unset: + kwargs["action_when_missing_partitions"] = action_when_missing_partitions + if display_name is not unset: + kwargs["display_name"] = display_name + if minimal_threshold is not unset: + kwargs["minimal_threshold"] = minimal_threshold + if minimal_threshold_overrides is not unset: + kwargs["minimal_threshold_overrides"] = minimal_threshold_overrides + if partition_fields is not unset: + kwargs["partition_fields"] = partition_fields + if spike_threshold is not unset: + kwargs["spike_threshold"] = spike_threshold + super().__init__(kwargs) + + self_.enabled = enabled + self_.id = id + self_.include = include + self_.name = name + self_.spike_action = spike_action + self_.type = type diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_action_when_missing_partitions.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_action_when_missing_partitions.py new file mode 100644 index 0000000000..5e2a6d7145 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_action_when_missing_partitions.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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions(ModelSimple): + """ + How to handle logs that are missing one of the `partition_fields`. Options: + - `ignore`: Forward the event without applying spike protection. + - `default_bucket`: Assign the event to a default partition. + + :param value: If omitted defaults to "ignore". Must be one of ["ignore", "default_bucket"]. + :type value: str + """ + + allowed_values = { + "ignore", + "default_bucket", + } + IGNORE: ClassVar["ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions"] + DEFAULT_BUCKET: ClassVar["ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions.IGNORE = ( + ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions("ignore") +) +ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions.DEFAULT_BUCKET = ( + ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions("default_bucket") +) diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold.py new file mode 100644 index 0000000000..3ac01869e1 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold.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 ( + ModelComposed, + cached_property, +) + + +class ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold(ModelComposed): + def __init__(self, **kwargs): + """ + The minimal threshold to apply to the matching partition. + + :param bytes: The minimal threshold, in bytes, for the matching partition. + :type bytes: int + + :param type: The minimal threshold type. The value should always be `threshold`. + :type type: ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_bytes import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes, + ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_always_keep import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep, + ) + + return { + "oneOf": [ + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes, + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep, + ], + } diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_always_keep.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_always_keep.py new file mode 100644 index 0000000000..509e5cf103 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_always_keep.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.observability_pipeline_spike_protection_processor_minimal_threshold_always_keep_type import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType, + ) + + +class ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_always_keep_type import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType, + ) + + return { + "type": (ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType,), + } + + attribute_map = { + "type": "type", + } + + def __init__(self_, type: ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType, **kwargs): + """ + Never activates spike protection for the matching partition, regardless of volume. + + :param type: The minimal threshold type. The value should always be ``always_keep``. + :type type: ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType + """ + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_always_keep_type.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_always_keep_type.py new file mode 100644 index 0000000000..5ca1be3d17 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_always_keep_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 ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType(ModelSimple): + """ + The minimal threshold type. The value should always be `always_keep`. + + :param value: If omitted defaults to "always_keep". Must be one of ["always_keep"]. + :type value: str + """ + + allowed_values = { + "always_keep", + } + ALWAYS_KEEP: ClassVar["ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType.ALWAYS_KEEP = ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType("always_keep") +) diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_bytes.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_bytes.py new file mode 100644 index 0000000000..cc8696ba8d --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_bytes.py @@ -0,0 +1,52 @@ +# 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.observability_pipeline_spike_protection_processor_minimal_threshold_bytes_type import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType, + ) + + +class ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_bytes_type import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType, + ) + + return { + "bytes": (int,), + "type": (ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType,), + } + + attribute_map = { + "bytes": "bytes", + "type": "type", + } + + def __init__( + self_, bytes: int, type: ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType, **kwargs + ): + """ + Sets a specific byte threshold for the matching partition. + + :param bytes: The minimal threshold, in bytes, for the matching partition. + :type bytes: int + + :param type: The minimal threshold type. The value should always be ``threshold``. + :type type: ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType + """ + super().__init__(kwargs) + + self_.bytes = bytes + self_.type = type diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_bytes_type.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_bytes_type.py new file mode 100644 index 0000000000..d37cb32683 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_minimal_threshold_bytes_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 ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType(ModelSimple): + """ + The minimal threshold type. The value should always be `threshold`. + + :param value: If omitted defaults to "threshold". Must be one of ["threshold"]. + :type value: str + """ + + allowed_values = { + "threshold", + } + THRESHOLD: ClassVar["ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType.THRESHOLD = ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType("threshold") +) diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_spike_action.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_spike_action.py new file mode 100644 index 0000000000..f0a1d0bc63 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_spike_action.py @@ -0,0 +1,52 @@ +# 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 ObservabilityPipelineSpikeProtectionProcessorSpikeAction(ModelSimple): + """ + The action to take with matching logs while spike protection is active. Options: + - `drop`: Drop the event. + - `no_action`: Let the event pass through. + - `overflow_routing`: Route to an overflow destination. + + When `overflow_routing` is used, there must be a destination whose `inputs` reference this processor with the `.overflow_events` suffix to route the overflowing events. + + :param value: Must be one of ["drop", "no_action", "overflow_routing"]. + :type value: str + """ + + allowed_values = { + "drop", + "no_action", + "overflow_routing", + } + DROP: ClassVar["ObservabilityPipelineSpikeProtectionProcessorSpikeAction"] + NO_ACTION: ClassVar["ObservabilityPipelineSpikeProtectionProcessorSpikeAction"] + OVERFLOW_ROUTING: ClassVar["ObservabilityPipelineSpikeProtectionProcessorSpikeAction"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ObservabilityPipelineSpikeProtectionProcessorSpikeAction.DROP = ( + ObservabilityPipelineSpikeProtectionProcessorSpikeAction("drop") +) +ObservabilityPipelineSpikeProtectionProcessorSpikeAction.NO_ACTION = ( + ObservabilityPipelineSpikeProtectionProcessorSpikeAction("no_action") +) +ObservabilityPipelineSpikeProtectionProcessorSpikeAction.OVERFLOW_ROUTING = ( + ObservabilityPipelineSpikeProtectionProcessorSpikeAction("overflow_routing") +) diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_threshold_override.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_threshold_override.py new file mode 100644 index 0000000000..db449a92e3 --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_threshold_override.py @@ -0,0 +1,67 @@ +# 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, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.observability_pipeline_field_value import ObservabilityPipelineFieldValue + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold, + ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_bytes import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes, + ) + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_always_keep import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep, + ) + + +class ObservabilityPipelineSpikeProtectionProcessorThresholdOverride(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.observability_pipeline_field_value import ObservabilityPipelineFieldValue + from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold, + ) + + return { + "fields": ([ObservabilityPipelineFieldValue],), + "minimal_threshold": (ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold,), + } + + attribute_map = { + "fields": "fields", + "minimal_threshold": "minimal_threshold", + } + + def __init__( + self_, + fields: List[ObservabilityPipelineFieldValue], + minimal_threshold: Union[ + ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold, + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes, + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep, + ], + **kwargs, + ): + """ + Defines a minimal threshold that applies to a specific partition instead of the processor-wide ``minimal_threshold``. + + :param fields: The set of field matchers that identifies the partition this override applies to. Every field name listed must also appear in ``partition_fields``. + :type fields: [ObservabilityPipelineFieldValue] + + :param minimal_threshold: The minimal threshold to apply to the matching partition. + :type minimal_threshold: ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold + """ + super().__init__(kwargs) + + self_.fields = fields + self_.minimal_threshold = minimal_threshold diff --git a/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_type.py b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_type.py new file mode 100644 index 0000000000..0235520f4a --- /dev/null +++ b/src/datadog_api_client/v2/model/observability_pipeline_spike_protection_processor_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 ObservabilityPipelineSpikeProtectionProcessorType(ModelSimple): + """ + The processor type. The value should always be `spike_protection`. + + :param value: If omitted defaults to "spike_protection". Must be one of ["spike_protection"]. + :type value: str + """ + + allowed_values = { + "spike_protection", + } + SPIKE_PROTECTION: ClassVar["ObservabilityPipelineSpikeProtectionProcessorType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ObservabilityPipelineSpikeProtectionProcessorType.SPIKE_PROTECTION = ObservabilityPipelineSpikeProtectionProcessorType( + "spike_protection" +) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 543921c8a7..c688be34b3 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -7708,6 +7708,36 @@ ) from datadog_api_client.v2.model.observability_pipeline_spec import ObservabilityPipelineSpec from datadog_api_client.v2.model.observability_pipeline_spec_data import ObservabilityPipelineSpecData +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor import ( + ObservabilityPipelineSpikeProtectionProcessor, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_action_when_missing_partitions import ( + ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_always_keep import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_always_keep_type import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_bytes import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_minimal_threshold_bytes_type import ( + ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_spike_action import ( + ObservabilityPipelineSpikeProtectionProcessorSpikeAction, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_threshold_override import ( + ObservabilityPipelineSpikeProtectionProcessorThresholdOverride, +) +from datadog_api_client.v2.model.observability_pipeline_spike_protection_processor_type import ( + ObservabilityPipelineSpikeProtectionProcessorType, +) from datadog_api_client.v2.model.observability_pipeline_split_array_processor import ( ObservabilityPipelineSplitArrayProcessor, ) @@ -18008,6 +18038,16 @@ "ObservabilityPipelineSourceValidTokenFieldToAdd", "ObservabilityPipelineSpec", "ObservabilityPipelineSpecData", + "ObservabilityPipelineSpikeProtectionProcessor", + "ObservabilityPipelineSpikeProtectionProcessorActionWhenMissingPartitions", + "ObservabilityPipelineSpikeProtectionProcessorMinimalThreshold", + "ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeep", + "ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdAlwaysKeepType", + "ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytes", + "ObservabilityPipelineSpikeProtectionProcessorMinimalThresholdBytesType", + "ObservabilityPipelineSpikeProtectionProcessorSpikeAction", + "ObservabilityPipelineSpikeProtectionProcessorThresholdOverride", + "ObservabilityPipelineSpikeProtectionProcessorType", "ObservabilityPipelineSplitArrayProcessor", "ObservabilityPipelineSplitArrayProcessorArrayConfig", "ObservabilityPipelineSplitArrayProcessorType", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index dce8e01f02..9d28cde147 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -8827,6 +8827,20 @@ "scenario": "Validate an observability pipeline with source secret key returns \"OK\" response", "version": "v2" }, + { + "feature": "Observability Pipelines", + "feature_file": "../../v2/features/observability_pipelines.feature", + "file": "v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-returns-ok-response.json", + "scenario": "Validate an observability pipeline with spike protection processor returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Observability Pipelines", + "feature_file": "../../v2/features/observability_pipelines.feature", + "file": "v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-threshold-overrides-returns-ok-response.json", + "scenario": "Validate an observability pipeline with spike protection processor threshold overrides returns \"OK\" response", + "version": "v2" + }, { "feature": "Observability Pipelines", "feature_file": "../../v2/features/observability_pipelines.feature", diff --git a/tests/generated-test/test-runner-data/v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-returns-ok-response.json new file mode 100644 index 0000000000..34802ba881 --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-returns-ok-response.json @@ -0,0 +1,72 @@ +{ + "api": "ObservabilityPipelines", + "expected_status": 200, + "feature": "Observability Pipelines", + "id": "v2/Observability Pipelines/Validate an observability pipeline with spike protection processor returns \"OK\" response", + "operation_id": "ValidatePipeline", + "request": { + "body": { + "schema": { + "format": null, + "ref": "ObservabilityPipelineSpec", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "config": { + "destinations": [ + { + "id": "datadog-logs-destination", + "inputs": [ + "my-processor-group" + ], + "type": "datadog_logs" + } + ], + "processor_groups": [ + { + "enabled": true, + "id": "my-processor-group", + "include": "service:my-service", + "inputs": [ + "datadog-agent-source" + ], + "processors": [ + { + "enabled": true, + "id": "spike-protection-processor", + "include": "*", + "minimal_threshold": 107374182400, + "name": "MySpikeProtection", + "spike_action": "drop", + "spike_threshold": 5, + "type": "spike_protection" + } + ] + } + ], + "sources": [ + { + "id": "datadog-agent-source", + "type": "datadog_agent" + } + ] + }, + "name": "Pipeline with Spike Protection" + }, + "type": "pipelines" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/obs-pipelines/pipelines/validate" + }, + "scenario": "Validate an observability pipeline with spike protection processor returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-runner-data/v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-threshold-overrides-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-threshold-overrides-returns-ok-response.json new file mode 100644 index 0000000000..146fd07526 --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/observability-pipelines/validate-an-observability-pipeline-with-spike-protection-processor-threshold-overrides-returns-ok-response.json @@ -0,0 +1,99 @@ +{ + "api": "ObservabilityPipelines", + "expected_status": 200, + "feature": "Observability Pipelines", + "id": "v2/Observability Pipelines/Validate an observability pipeline with spike protection processor threshold overrides returns \"OK\" response", + "operation_id": "ValidatePipeline", + "request": { + "body": { + "schema": { + "format": null, + "ref": "ObservabilityPipelineSpec", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "config": { + "destinations": [ + { + "id": "datadog-logs-destination", + "inputs": [ + "my-processor-group" + ], + "type": "datadog_logs" + } + ], + "processor_groups": [ + { + "enabled": true, + "id": "my-processor-group", + "include": "service:my-service", + "inputs": [ + "datadog-agent-source" + ], + "processors": [ + { + "action_when_missing_partitions": "default_bucket", + "enabled": true, + "id": "spike-protection-processor", + "include": "*", + "minimal_threshold_overrides": [ + { + "fields": [ + { + "name": "service", + "value": "checkout" + } + ], + "minimal_threshold": { + "bytes": 53687091200, + "type": "threshold" + } + }, + { + "fields": [ + { + "name": "service", + "value": "payments" + } + ], + "minimal_threshold": { + "type": "always_keep" + } + } + ], + "name": "MyPartitionedSpikeProtection", + "partition_fields": [ + "service" + ], + "spike_action": "no_action", + "type": "spike_protection" + } + ] + } + ], + "sources": [ + { + "id": "datadog-agent-source", + "type": "datadog_agent" + } + ] + }, + "name": "Pipeline with Spike Protection Threshold Overrides" + }, + "type": "pipelines" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/obs-pipelines/pipelines/validate" + }, + "scenario": "Validate an observability pipeline with spike protection processor threshold overrides returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-server-data/v2/observability-pipelines.json b/tests/generated-test/test-server-data/v2/observability-pipelines.json index 5211f2b1d1..17a9a68dec 100644 --- a/tests/generated-test/test-server-data/v2/observability-pipelines.json +++ b/tests/generated-test/test-server-data/v2/observability-pipelines.json @@ -3296,6 +3296,187 @@ "scenario": "Validate an observability pipeline with source secret key returns \"OK\" response", "version": "v2" }, + { + "feature": "Observability Pipelines", + "frozen_at": "2026-10-21T09:12:44.167Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "config": { + "destinations": [ + { + "id": "datadog-logs-destination", + "inputs": [ + "my-processor-group" + ], + "type": "datadog_logs" + } + ], + "processor_groups": [ + { + "enabled": true, + "id": "my-processor-group", + "include": "service:my-service", + "inputs": [ + "datadog-agent-source" + ], + "processors": [ + { + "enabled": true, + "id": "spike-protection-processor", + "include": "*", + "minimal_threshold": 107374182400, + "name": "MySpikeProtection", + "spike_action": "drop", + "spike_threshold": 5, + "type": "spike_protection" + } + ] + } + ], + "sources": [ + { + "id": "datadog-agent-source", + "type": "datadog_agent" + } + ] + }, + "name": "Pipeline with Spike Protection" + }, + "type": "pipelines" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/obs-pipelines/pipelines/validate", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[]}\n" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Validate an observability pipeline with spike protection processor returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Observability Pipelines", + "frozen_at": "2026-10-21T09:12:44.469Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "config": { + "destinations": [ + { + "id": "datadog-logs-destination", + "inputs": [ + "my-processor-group" + ], + "type": "datadog_logs" + } + ], + "processor_groups": [ + { + "enabled": true, + "id": "my-processor-group", + "include": "service:my-service", + "inputs": [ + "datadog-agent-source" + ], + "processors": [ + { + "action_when_missing_partitions": "default_bucket", + "enabled": true, + "id": "spike-protection-processor", + "include": "*", + "minimal_threshold_overrides": [ + { + "fields": [ + { + "name": "service", + "value": "checkout" + } + ], + "minimal_threshold": { + "bytes": 53687091200, + "type": "threshold" + } + }, + { + "fields": [ + { + "name": "service", + "value": "payments" + } + ], + "minimal_threshold": { + "type": "always_keep" + } + } + ], + "name": "MyPartitionedSpikeProtection", + "partition_fields": [ + "service" + ], + "spike_action": "no_action", + "type": "spike_protection" + } + ] + } + ], + "sources": [ + { + "id": "datadog-agent-source", + "type": "datadog_agent" + } + ] + }, + "name": "Pipeline with Spike Protection Threshold Overrides" + }, + "type": "pipelines" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/obs-pipelines/pipelines/validate", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[]}\n" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Validate an observability pipeline with spike protection processor threshold overrides returns \"OK\" response", + "version": "v2" + }, { "feature": "Observability Pipelines", "frozen_at": "2026-06-22T19:51:31.598Z", diff --git a/tests/v2/features/observability_pipelines.feature b/tests/v2/features/observability_pipelines.feature index 261e6f4bd6..09472e4ecb 100644 --- a/tests/v2/features/observability_pipelines.feature +++ b/tests/v2/features/observability_pipelines.feature @@ -351,6 +351,22 @@ Feature: Observability Pipelines Then the response status is 200 OK And the response "errors" has length 0 + @team:ddoghq/observability-pipelines + Scenario: Validate an observability pipeline with spike protection processor returns "OK" response + Given new "ValidatePipeline" request + And body with value {"data": {"attributes": {"config": {"destinations": [{"id": "datadog-logs-destination", "inputs": ["my-processor-group"], "type": "datadog_logs"}], "processor_groups": [{"enabled": true, "id": "my-processor-group", "include": "service:my-service", "inputs": ["datadog-agent-source"], "processors": [{"enabled": true, "id": "spike-protection-processor", "include": "*", "type": "spike_protection", "name": "MySpikeProtection", "spike_action": "drop", "spike_threshold": 5, "minimal_threshold": 107374182400}]}], "sources": [{"id": "datadog-agent-source", "type": "datadog_agent"}]}, "name": "Pipeline with Spike Protection"}, "type": "pipelines"}} + When the request is sent + Then the response status is 200 OK + And the response "errors" has length 0 + + @team:ddoghq/observability-pipelines + Scenario: Validate an observability pipeline with spike protection processor threshold overrides returns "OK" response + Given new "ValidatePipeline" request + And body with value {"data": {"attributes": {"config": {"destinations": [{"id": "datadog-logs-destination", "inputs": ["my-processor-group"], "type": "datadog_logs"}], "processor_groups": [{"enabled": true, "id": "my-processor-group", "include": "service:my-service", "inputs": ["datadog-agent-source"], "processors": [{"enabled": true, "id": "spike-protection-processor", "include": "*", "type": "spike_protection", "name": "MyPartitionedSpikeProtection", "spike_action": "no_action", "partition_fields": ["service"], "action_when_missing_partitions": "default_bucket", "minimal_threshold_overrides": [{"fields": [{"name": "service", "value": "checkout"}], "minimal_threshold": {"type": "threshold", "bytes": 53687091200}}, {"fields": [{"name": "service", "value": "payments"}], "minimal_threshold": {"type": "always_keep"}}]}]}], "sources": [{"id": "datadog-agent-source", "type": "datadog_agent"}]}, "name": "Pipeline with Spike Protection Threshold Overrides"}, "type": "pipelines"}} + When the request is sent + Then the response status is 200 OK + And the response "errors" has length 0 + @team:ddoghq/observability-pipelines Scenario: Validate an observability pipeline with websocket source bearer auth returns "OK" response Given new "ValidatePipeline" request