Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add include_percentiles field in Logs Custom Metrics #1740

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2022-11-21 18:48:16.085581",
"spec_repo_commit": "9015efdd"
"regenerated": "2022-11-21 20:01:49.387099",
"spec_repo_commit": "4ca2c235"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2022-11-21 18:48:16.097311",
"spec_repo_commit": "9015efdd"
"regenerated": "2022-11-21 20:01:49.399231",
"spec_repo_commit": "4ca2c235"
}
}
}
21 changes: 20 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5012,6 +5012,8 @@ components:
properties:
aggregation_type:
$ref: '#/components/schemas/LogsMetricComputeAggregationType'
include_percentiles:
$ref: '#/components/schemas/LogsMetricComputeIncludePercentiles'
path:
description: The path to the value the log-based metric will aggregate on
(only used if the aggregation type is a "distribution").
Expand All @@ -5030,6 +5032,13 @@ components:
x-enum-varnames:
- COUNT
- DISTRIBUTION
LogsMetricComputeIncludePercentiles:
description: 'Toggle to include or exclude percentile aggregations for distribution
metrics.

Only present when the `aggregation_type` is `distribution`.'
example: true
type: boolean
LogsMetricCreateAttributes:
description: The object describing the Datadog log-based metric to create.
properties:
Expand Down Expand Up @@ -5121,6 +5130,8 @@ components:
properties:
aggregation_type:
$ref: '#/components/schemas/LogsMetricResponseComputeAggregationType'
include_percentiles:
$ref: '#/components/schemas/LogsMetricComputeIncludePercentiles'
path:
description: The path to the value the log-based metric will aggregate on
(only used if the aggregation type is a "distribution").
Expand Down Expand Up @@ -5182,6 +5193,8 @@ components:
LogsMetricUpdateAttributes:
description: The log-based metric properties that will be updated.
properties:
compute:
$ref: '#/components/schemas/LogsMetricUpdateCompute'
filter:
$ref: '#/components/schemas/LogsMetricFilter'
group_by:
Expand All @@ -5190,6 +5203,12 @@ components:
$ref: '#/components/schemas/LogsMetricGroupBy'
type: array
type: object
LogsMetricUpdateCompute:
description: The compute rule to compute the log-based metric.
properties:
include_percentiles:
$ref: '#/components/schemas/LogsMetricComputeIncludePercentiles'
type: object
LogsMetricUpdateData:
description: The new log-based metric properties.
properties:
Expand Down Expand Up @@ -5978,7 +5997,7 @@ components:
format: date-time
type: string
include_percentiles:
description: 'Toggle to turn on/off percentile aggregations for distribution
description: 'Toggle to include or exclude percentile aggregations for distribution
metrics.

Only present when the `metric_type` is `distribution`.'
Expand Down
40 changes: 38 additions & 2 deletions api/datadogV2/model_logs_metric_compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
type LogsMetricCompute struct {
// The type of aggregation to use.
AggregationType LogsMetricComputeAggregationType `json:"aggregation_type"`
// Toggle to include or exclude percentile aggregations for distribution metrics.
// Only present when the `aggregation_type` is `distribution`.
IncludePercentiles *bool `json:"include_percentiles,omitempty"`
// The path to the value the log-based metric will aggregate on (only used if the aggregation type is a "distribution").
Path *string `json:"path,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand Down Expand Up @@ -61,6 +64,34 @@ func (o *LogsMetricCompute) SetAggregationType(v LogsMetricComputeAggregationTyp
o.AggregationType = v
}

// GetIncludePercentiles returns the IncludePercentiles field value if set, zero value otherwise.
func (o *LogsMetricCompute) GetIncludePercentiles() bool {
if o == nil || o.IncludePercentiles == nil {
var ret bool
return ret
}
return *o.IncludePercentiles
}

// GetIncludePercentilesOk returns a tuple with the IncludePercentiles field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsMetricCompute) GetIncludePercentilesOk() (*bool, bool) {
if o == nil || o.IncludePercentiles == nil {
return nil, false
}
return o.IncludePercentiles, true
}

// HasIncludePercentiles returns a boolean if a field has been set.
func (o *LogsMetricCompute) HasIncludePercentiles() bool {
return o != nil && o.IncludePercentiles != nil
}

// SetIncludePercentiles gets a reference to the given bool and assigns it to the IncludePercentiles field.
func (o *LogsMetricCompute) SetIncludePercentiles(v bool) {
o.IncludePercentiles = &v
}

// GetPath returns the Path field value if set, zero value otherwise.
func (o *LogsMetricCompute) GetPath() string {
if o == nil || o.Path == nil {
Expand Down Expand Up @@ -96,6 +127,9 @@ func (o LogsMetricCompute) MarshalJSON() ([]byte, error) {
return json.Marshal(o.UnparsedObject)
}
toSerialize["aggregation_type"] = o.AggregationType
if o.IncludePercentiles != nil {
toSerialize["include_percentiles"] = o.IncludePercentiles
}
if o.Path != nil {
toSerialize["path"] = o.Path
}
Expand All @@ -113,8 +147,9 @@ func (o *LogsMetricCompute) UnmarshalJSON(bytes []byte) (err error) {
AggregationType *LogsMetricComputeAggregationType `json:"aggregation_type"`
}{}
all := struct {
AggregationType LogsMetricComputeAggregationType `json:"aggregation_type"`
Path *string `json:"path,omitempty"`
AggregationType LogsMetricComputeAggregationType `json:"aggregation_type"`
IncludePercentiles *bool `json:"include_percentiles,omitempty"`
Path *string `json:"path,omitempty"`
}{}
err = json.Unmarshal(bytes, &required)
if err != nil {
Expand All @@ -141,6 +176,7 @@ func (o *LogsMetricCompute) UnmarshalJSON(bytes []byte) (err error) {
return nil
}
o.AggregationType = all.AggregationType
o.IncludePercentiles = all.IncludePercentiles
o.Path = all.Path
return nil
}
40 changes: 38 additions & 2 deletions api/datadogV2/model_logs_metric_response_compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
type LogsMetricResponseCompute struct {
// The type of aggregation to use.
AggregationType *LogsMetricResponseComputeAggregationType `json:"aggregation_type,omitempty"`
// Toggle to include or exclude percentile aggregations for distribution metrics.
// Only present when the `aggregation_type` is `distribution`.
IncludePercentiles *bool `json:"include_percentiles,omitempty"`
// The path to the value the log-based metric will aggregate on (only used if the aggregation type is a "distribution").
Path *string `json:"path,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand Down Expand Up @@ -64,6 +67,34 @@ func (o *LogsMetricResponseCompute) SetAggregationType(v LogsMetricResponseCompu
o.AggregationType = &v
}

// GetIncludePercentiles returns the IncludePercentiles field value if set, zero value otherwise.
func (o *LogsMetricResponseCompute) GetIncludePercentiles() bool {
if o == nil || o.IncludePercentiles == nil {
var ret bool
return ret
}
return *o.IncludePercentiles
}

// GetIncludePercentilesOk returns a tuple with the IncludePercentiles field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsMetricResponseCompute) GetIncludePercentilesOk() (*bool, bool) {
if o == nil || o.IncludePercentiles == nil {
return nil, false
}
return o.IncludePercentiles, true
}

// HasIncludePercentiles returns a boolean if a field has been set.
func (o *LogsMetricResponseCompute) HasIncludePercentiles() bool {
return o != nil && o.IncludePercentiles != nil
}

// SetIncludePercentiles gets a reference to the given bool and assigns it to the IncludePercentiles field.
func (o *LogsMetricResponseCompute) SetIncludePercentiles(v bool) {
o.IncludePercentiles = &v
}

// GetPath returns the Path field value if set, zero value otherwise.
func (o *LogsMetricResponseCompute) GetPath() string {
if o == nil || o.Path == nil {
Expand Down Expand Up @@ -101,6 +132,9 @@ func (o LogsMetricResponseCompute) MarshalJSON() ([]byte, error) {
if o.AggregationType != nil {
toSerialize["aggregation_type"] = o.AggregationType
}
if o.IncludePercentiles != nil {
toSerialize["include_percentiles"] = o.IncludePercentiles
}
if o.Path != nil {
toSerialize["path"] = o.Path
}
Expand All @@ -115,8 +149,9 @@ func (o LogsMetricResponseCompute) MarshalJSON() ([]byte, error) {
func (o *LogsMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
all := struct {
AggregationType *LogsMetricResponseComputeAggregationType `json:"aggregation_type,omitempty"`
Path *string `json:"path,omitempty"`
AggregationType *LogsMetricResponseComputeAggregationType `json:"aggregation_type,omitempty"`
IncludePercentiles *bool `json:"include_percentiles,omitempty"`
Path *string `json:"path,omitempty"`
}{}
err = json.Unmarshal(bytes, &all)
if err != nil {
Expand All @@ -136,6 +171,7 @@ func (o *LogsMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) {
return nil
}
o.AggregationType = all.AggregationType
o.IncludePercentiles = all.IncludePercentiles
o.Path = all.Path
return nil
}
46 changes: 44 additions & 2 deletions api/datadogV2/model_logs_metric_update_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

// LogsMetricUpdateAttributes The log-based metric properties that will be updated.
type LogsMetricUpdateAttributes struct {
// The compute rule to compute the log-based metric.
Compute *LogsMetricUpdateCompute `json:"compute,omitempty"`
// The log-based metric filter. Logs matching this filter will be aggregated in this metric.
Filter *LogsMetricFilter `json:"filter,omitempty"`
// The rules for the group by.
Expand All @@ -36,6 +38,34 @@ func NewLogsMetricUpdateAttributesWithDefaults() *LogsMetricUpdateAttributes {
return &this
}

// GetCompute returns the Compute field value if set, zero value otherwise.
func (o *LogsMetricUpdateAttributes) GetCompute() LogsMetricUpdateCompute {
if o == nil || o.Compute == nil {
var ret LogsMetricUpdateCompute
return ret
}
return *o.Compute
}

// GetComputeOk returns a tuple with the Compute field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsMetricUpdateAttributes) GetComputeOk() (*LogsMetricUpdateCompute, bool) {
if o == nil || o.Compute == nil {
return nil, false
}
return o.Compute, true
}

// HasCompute returns a boolean if a field has been set.
func (o *LogsMetricUpdateAttributes) HasCompute() bool {
return o != nil && o.Compute != nil
}

// SetCompute gets a reference to the given LogsMetricUpdateCompute and assigns it to the Compute field.
func (o *LogsMetricUpdateAttributes) SetCompute(v LogsMetricUpdateCompute) {
o.Compute = &v
}

// GetFilter returns the Filter field value if set, zero value otherwise.
func (o *LogsMetricUpdateAttributes) GetFilter() LogsMetricFilter {
if o == nil || o.Filter == nil {
Expand Down Expand Up @@ -98,6 +128,9 @@ func (o LogsMetricUpdateAttributes) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return json.Marshal(o.UnparsedObject)
}
if o.Compute != nil {
toSerialize["compute"] = o.Compute
}
if o.Filter != nil {
toSerialize["filter"] = o.Filter
}
Expand All @@ -115,8 +148,9 @@ func (o LogsMetricUpdateAttributes) MarshalJSON() ([]byte, error) {
func (o *LogsMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
all := struct {
Filter *LogsMetricFilter `json:"filter,omitempty"`
GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"`
Compute *LogsMetricUpdateCompute `json:"compute,omitempty"`
Filter *LogsMetricFilter `json:"filter,omitempty"`
GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"`
}{}
err = json.Unmarshal(bytes, &all)
if err != nil {
Expand All @@ -127,6 +161,14 @@ func (o *LogsMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) {
o.UnparsedObject = raw
return nil
}
if all.Compute != nil && all.Compute.UnparsedObject != nil && o.UnparsedObject == nil {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
}
o.Compute = all.Compute
if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil {
err = json.Unmarshal(bytes, &raw)
if err != nil {
Expand Down
Loading