diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2d470c8f2f02..2247ca8cc59c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -59823,6 +59823,7 @@ components: - $ref: "#/components/schemas/ObservabilityPipelineDedupeProcessor" - $ref: "#/components/schemas/ObservabilityPipelineEnrichmentTableProcessor" - $ref: "#/components/schemas/ObservabilityPipelineGenerateMetricsProcessor" + - $ref: "#/components/schemas/ObservabilityPipelineGenerateMetricsV2Processor" - $ref: "#/components/schemas/ObservabilityPipelineOcsfMapperProcessor" - $ref: "#/components/schemas/ObservabilityPipelineParseGrokProcessor" - $ref: "#/components/schemas/ObservabilityPipelineParseJSONProcessor" @@ -60962,6 +60963,50 @@ components: type: string x-enum-varnames: - GENERATE_DATADOG_METRICS + ObservabilityPipelineGenerateMetricsV2Processor: + description: |- + The `generate_metrics` processor creates custom metrics from logs. + Metrics can be counters, gauges, or distributions and optionally grouped by log fields. + The generated metrics must be routed to a metrics destination using the input `.metrics`. + + **Supported pipeline types:** logs + properties: + 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 to reference this component in other parts of the pipeline. + example: generate-metrics-processor + type: string + include: + description: A Datadog search query used to determine which logs this processor targets. + example: "service:my-service" + type: string + metrics: + description: Configuration for generating individual metrics. + items: + $ref: "#/components/schemas/ObservabilityPipelineGeneratedMetric" + type: array + type: + $ref: "#/components/schemas/ObservabilityPipelineGenerateMetricsV2ProcessorType" + required: + - id + - type + - enabled + type: object + x-pipeline-types: [logs] + ObservabilityPipelineGenerateMetricsV2ProcessorType: + default: generate_metrics + description: The processor type. Always `generate_metrics`. + enum: + - generate_metrics + example: generate_metrics + type: string + x-enum-varnames: + - GENERATE_METRICS ObservabilityPipelineGeneratedMetric: description: |- Defines a log-based custom metric, including its name, type, filter, value computation strategy, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6bcb0f8a7651..ed0a434c2b41 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -4771,6 +4771,8 @@ def overrides "v2.observability_pipeline_generated_metric_metric_type" => "ObservabilityPipelineGeneratedMetricMetricType", "v2.observability_pipeline_generate_metrics_processor" => "ObservabilityPipelineGenerateMetricsProcessor", "v2.observability_pipeline_generate_metrics_processor_type" => "ObservabilityPipelineGenerateMetricsProcessorType", + "v2.observability_pipeline_generate_metrics_v2_processor" => "ObservabilityPipelineGenerateMetricsV2Processor", + "v2.observability_pipeline_generate_metrics_v2_processor_type" => "ObservabilityPipelineGenerateMetricsV2ProcessorType", "v2.observability_pipeline_google_chronicle_destination" => "ObservabilityPipelineGoogleChronicleDestination", "v2.observability_pipeline_google_chronicle_destination_encoding" => "ObservabilityPipelineGoogleChronicleDestinationEncoding", "v2.observability_pipeline_google_chronicle_destination_type" => "ObservabilityPipelineGoogleChronicleDestinationType", diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_config_processor_item.rb b/lib/datadog_api_client/v2/models/observability_pipeline_config_processor_item.rb index 402c3e6e483b..2dacb572fc85 100644 --- a/lib/datadog_api_client/v2/models/observability_pipeline_config_processor_item.rb +++ b/lib/datadog_api_client/v2/models/observability_pipeline_config_processor_item.rb @@ -35,6 +35,7 @@ def openapi_one_of :'ObservabilityPipelineDedupeProcessor', :'ObservabilityPipelineEnrichmentTableProcessor', :'ObservabilityPipelineGenerateMetricsProcessor', + :'ObservabilityPipelineGenerateMetricsV2Processor', :'ObservabilityPipelineOcsfMapperProcessor', :'ObservabilityPipelineParseGrokProcessor', :'ObservabilityPipelineParseJSONProcessor', diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_generate_metrics_v2_processor.rb b/lib/datadog_api_client/v2/models/observability_pipeline_generate_metrics_v2_processor.rb new file mode 100644 index 000000000000..edbf7209aede --- /dev/null +++ b/lib/datadog_api_client/v2/models/observability_pipeline_generate_metrics_v2_processor.rb @@ -0,0 +1,201 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The `generate_metrics` processor creates custom metrics from logs. + # Metrics can be counters, gauges, or distributions and optionally grouped by log fields. + # The generated metrics must be routed to a metrics destination using the input `.metrics`. + # + # **Supported pipeline types:** logs + class ObservabilityPipelineGenerateMetricsV2Processor + include BaseGenericModel + + # The display name for a component. + attr_accessor :display_name + + # Indicates whether the processor is enabled. + attr_reader :enabled + + # The unique identifier for this component. Used to reference this component in other parts of the pipeline. + attr_reader :id + + # A Datadog search query used to determine which logs this processor targets. + attr_accessor :include + + # Configuration for generating individual metrics. + attr_accessor :metrics + + # The processor type. Always `generate_metrics`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'display_name' => :'display_name', + :'enabled' => :'enabled', + :'id' => :'id', + :'include' => :'include', + :'metrics' => :'metrics', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'display_name' => :'String', + :'enabled' => :'Boolean', + :'id' => :'String', + :'include' => :'String', + :'metrics' => :'Array', + :'type' => :'ObservabilityPipelineGenerateMetricsV2ProcessorType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ObservabilityPipelineGenerateMetricsV2Processor` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'include') + self.include = attributes[:'include'] + end + + if attributes.key?(:'metrics') + if (value = attributes[:'metrics']).is_a?(Array) + self.metrics = value + end + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @enabled.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + display_name == o.display_name && + enabled == o.enabled && + id == o.id && + include == o.include && + metrics == o.metrics && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [display_name, enabled, id, include, metrics, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_generate_metrics_v2_processor_type.rb b/lib/datadog_api_client/v2/models/observability_pipeline_generate_metrics_v2_processor_type.rb new file mode 100644 index 000000000000..9195e43a0c2e --- /dev/null +++ b/lib/datadog_api_client/v2/models/observability_pipeline_generate_metrics_v2_processor_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The processor type. Always `generate_metrics`. + class ObservabilityPipelineGenerateMetricsV2ProcessorType + include BaseEnumModel + + GENERATE_METRICS = "generate_metrics".freeze + end +end