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 missing fields in overrides API merged response #3018

Merged
merged 3 commits into from
Oct 13, 2023

Conversation

yvrhdn
Copy link
Member

@yvrhdn yvrhdn commented Oct 12, 2023

What this PR does:

While reviewing #3012 I noticed some fields weren't being populated correctly. This was a massive oversight on my part as the PR adding the merge logic (#2915) was merged during the same time window as PRs adding extending the limits struct (#2899, #2928, #2945, ).
When merged the code got merged without issues but the merge function wasn't updated.

Fields that weren't being populated:

  • metrics_generator.collection_interval
  • metrics_generator.service_graphs.histogram_buckets
  • metrics_generator.span_metrics.histogram_buckets
  • metrics_generator.span_metrics.target_info_excluded_dimensions

Before this change they would always be returned from the result even though a value would be set.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copy link
Contributor

@mdisibio mdisibio left a comment

Choose a reason for hiding this comment

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

Left one question and I think the answer is yes and lgtm.

Need changelog?

limitsJson, err := json.MarshalIndent(limits, "", " ")
assert.NoError(t, err)

expectedJson := `{
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this test pick up if we forget to add a new field to limitsFromOverrides ? I think it does since the output json will get a null but just checking.

Copy link
Member Author

Choose a reason for hiding this comment

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

It does because overrides.MetricsGeneratorOverrides will set the new value to the zero value which will be omitted in the json and you get a diff.

This what happens if I remove collection_interval from both the input overrides and the expected result:

        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -9,2 +9,3 @@
        	            	     "disable_collection": true,
        	            	+    "collection_interval": "0s",
        	            	     "processor": {
        	Test:       	Test_limitsFromOverrides
--- FAIL: Test_limitsFromOverrides (0.00s)

@yvrhdn yvrhdn merged commit 5aaef7d into grafana:main Oct 13, 2023
13 checks passed
@yvrhdn yvrhdn deleted the kvrhdn/overrides-merged branch October 13, 2023 14:47
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.

2 participants