Skip to content

Fix metric_custom_indicator's good and total metrics array #545

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

Merged
merged 7 commits into from
Jan 31, 2024

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented Jan 29, 2024

Ensure that the all metrics specified in the array are applied to the SLO resource

Close #544

@@ -541,6 +542,17 @@ func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostic
}

case "metric_custom_indicator":
goodMetricsRaw := d.Get(indicatorType + ".0.good.0.metrics").([]interface{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that in the SLO UI the total can also accept an array of metrics. Should we also support an array of metrics for it?

Screenshot 2024-01-29 at 11 11 02 AM

cnasikas
cnasikas previously approved these changes Jan 29, 2024
@tobio
Copy link
Member

tobio commented Jan 30, 2024

@wandergeek are you able to take a look over this one?

@jloleysens jloleysens marked this pull request as ready for review January 30, 2024 09:14
indicator = slo.SloResponseIndicator{
IndicatorPropertiesCustomMetric: &slo.IndicatorPropertiesCustomMetric{
Type: indicatorAddressToType[indicatorType],
Params: slo.IndicatorPropertiesCustomMetricParams{
Filter: getOrNilString(indicatorType+".0.filter", d),
Index: d.Get(indicatorType + ".0.index").(string),
TimestampField: d.Get(indicatorType + ".0.timestamp_field").(string),
Total: slo.IndicatorPropertiesCustomMetricParamsTotal{
Equation: d.Get(indicatorType + ".0.total.0.equation").(string),
Metrics: []slo.IndicatorPropertiesCustomMetricParamsTotalMetricsInner{ //are there actually instances where there are more than one 'good' / 'total'? Need to build array if so.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes there are 😄

@jloleysens jloleysens changed the title Fix metric_custom_indicator's good metrics array Fix metric_custom_indicator's good and total metrics array Jan 30, 2024
Copy link
Contributor

@wandergeek wandergeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, man! Thanks for the contribution.

@jloleysens jloleysens merged commit d6d32a4 into elastic:main Jan 31, 2024
@jloleysens jloleysens deleted the fix-slo-custom-metric-good branch January 31, 2024 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] More than one good metrics in a custom metric SLO
4 participants