|
| 1 | +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 2 | +# This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 3 | +# Copyright 2019-Present Datadog, Inc. |
| 4 | +from __future__ import annotations |
| 5 | + |
| 6 | +from typing import List, Union, TYPE_CHECKING |
| 7 | + |
| 8 | +from datadog_api_client.model_utils import ( |
| 9 | + ModelNormal, |
| 10 | + cached_property, |
| 11 | + unset, |
| 12 | + UnsetType, |
| 13 | +) |
| 14 | + |
| 15 | + |
| 16 | +if TYPE_CHECKING: |
| 17 | + from datadog_api_client.v2.model.observability_pipeline_generated_metric import ObservabilityPipelineGeneratedMetric |
| 18 | + from datadog_api_client.v2.model.observability_pipeline_generate_metrics_v2_processor_type import ( |
| 19 | + ObservabilityPipelineGenerateMetricsV2ProcessorType, |
| 20 | + ) |
| 21 | + |
| 22 | + |
| 23 | +class ObservabilityPipelineGenerateMetricsV2Processor(ModelNormal): |
| 24 | + @cached_property |
| 25 | + def openapi_types(_): |
| 26 | + from datadog_api_client.v2.model.observability_pipeline_generated_metric import ( |
| 27 | + ObservabilityPipelineGeneratedMetric, |
| 28 | + ) |
| 29 | + from datadog_api_client.v2.model.observability_pipeline_generate_metrics_v2_processor_type import ( |
| 30 | + ObservabilityPipelineGenerateMetricsV2ProcessorType, |
| 31 | + ) |
| 32 | + |
| 33 | + return { |
| 34 | + "display_name": (str,), |
| 35 | + "enabled": (bool,), |
| 36 | + "id": (str,), |
| 37 | + "include": (str,), |
| 38 | + "metrics": ([ObservabilityPipelineGeneratedMetric],), |
| 39 | + "type": (ObservabilityPipelineGenerateMetricsV2ProcessorType,), |
| 40 | + } |
| 41 | + |
| 42 | + attribute_map = { |
| 43 | + "display_name": "display_name", |
| 44 | + "enabled": "enabled", |
| 45 | + "id": "id", |
| 46 | + "include": "include", |
| 47 | + "metrics": "metrics", |
| 48 | + "type": "type", |
| 49 | + } |
| 50 | + |
| 51 | + def __init__( |
| 52 | + self_, |
| 53 | + enabled: bool, |
| 54 | + id: str, |
| 55 | + type: ObservabilityPipelineGenerateMetricsV2ProcessorType, |
| 56 | + display_name: Union[str, UnsetType] = unset, |
| 57 | + include: Union[str, UnsetType] = unset, |
| 58 | + metrics: Union[List[ObservabilityPipelineGeneratedMetric], UnsetType] = unset, |
| 59 | + **kwargs, |
| 60 | + ): |
| 61 | + """ |
| 62 | + The ``generate_metrics`` processor creates custom metrics from logs. |
| 63 | + Metrics can be counters, gauges, or distributions and optionally grouped by log fields. |
| 64 | + The generated metrics must be routed to a metrics destination using the input ``<processor-id>.metrics``. |
| 65 | +
|
| 66 | + **Supported pipeline types:** logs |
| 67 | +
|
| 68 | + :param display_name: The display name for a component. |
| 69 | + :type display_name: str, optional |
| 70 | +
|
| 71 | + :param enabled: Indicates whether the processor is enabled. |
| 72 | + :type enabled: bool |
| 73 | +
|
| 74 | + :param id: The unique identifier for this component. Used to reference this component in other parts of the pipeline. |
| 75 | + :type id: str |
| 76 | +
|
| 77 | + :param include: A Datadog search query used to determine which logs this processor targets. |
| 78 | + :type include: str, optional |
| 79 | +
|
| 80 | + :param metrics: Configuration for generating individual metrics. |
| 81 | + :type metrics: [ObservabilityPipelineGeneratedMetric], optional |
| 82 | +
|
| 83 | + :param type: The processor type. Always ``generate_metrics``. |
| 84 | + :type type: ObservabilityPipelineGenerateMetricsV2ProcessorType |
| 85 | + """ |
| 86 | + if display_name is not unset: |
| 87 | + kwargs["display_name"] = display_name |
| 88 | + if include is not unset: |
| 89 | + kwargs["include"] = include |
| 90 | + if metrics is not unset: |
| 91 | + kwargs["metrics"] = metrics |
| 92 | + super().__init__(kwargs) |
| 93 | + |
| 94 | + self_.enabled = enabled |
| 95 | + self_.id = id |
| 96 | + self_.type = type |
0 commit comments