-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Azure] [Billing] Switch to Consumption API 1.1.0 with patches #37158
[Azure] [Billing] Switch to Consumption API 1.1.0 with patches #37158
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
The changes here look good. I'll take a look at the patches. |
This pull request is now in conflicts. Could you fix it? 🙏
|
I did replicate this by setting {"log.level":"error","@timestamp":"2023-11-28T00:32:41.751+0200","log.origin":{"file.name":"module/wrapper.go","file.line":256},"message":"Error fetching data for metricset azure.billing: error retrieving usage information: retrieving usage details failed in client: GET https://management.azure.com/subscriptions/REDACTED/providers/Microsoft.Consumption/usageDetails\n--------------------------------------------------------------------------------\nRESPONSE 400: 400 Bad Request\nERROR CODE: MissingApiVersionParameter\n--------------------------------------------------------------------------------\n{\n \"error\": {\n \"code\": \"MissingApiVersionParameter\",\n \"message\": \"The api-version query parameter (?api-version=) is required for all requests.\"\n }\n}\n--------------------------------------------------------------------------------\n","service.name":"metricbeat","ecs.version":"1.6.0"} I tried setting the |
@gpop63 - Thanks for verifying the changes.
|
@muthu-mps this fix is great, I was saying I was able to replicate this issue (using the main branch). So the changes here fix it. |
Thanks @gpop63 |
Azure Billing MetricsVerified the following scenarios
Issue Replication
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Hey friends at @elastic/beats-tech-leads, we need your review on this change because it affects |
We're tageting the upcoming 8.12.0 and 8.11.2. |
This pull request is now in conflicts. Could you fix it? 🙏
|
💚 Build Succeeded
Expand to view the summary
Build stats
❕ Flaky test reportNo test was executed to be analysed. 🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
thanks @zmoog ! i would like to tidy up the tag on the fork so the version is a little better defined in the go.mod here. |
On it! |
The Consumption SDK does not URL encode the query parameters in the next link when the response requires more than one page to fetch all the usage details items. Our Azure SDK for Go fork contains a small patch to URL encode the next link value and avoid the 400 error. We also upgraded the azcore package to use the standard URL helper for the Azure SDK.
I replaced the original commit with a new one with a better comment.
Tidy up the go.mod file by targeting the tag `v1.1.0-elastic` on the Azure SDK fork instead of the commit.
8dbccb7
to
cfa82f2
Compare
Yes, again.
❕ Build Aborted
Expand to view the summary
Build stats
🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
@tommyers-elastic, I made the following changes:
You now can:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Switch to consumption 1.1.0 with patches The Consumption SDK does not URL encode the query parameters in the next link when the response requires more than one page to fetch all the usage details items. Our Azure SDK for Go fork contains a small patch to URL encode the next link value and avoid the 400 error. We also upgraded the azcore package to use the standard URL helper for the Azure SDK. * Update NOTICE.txt * Target tag v1.1.0-elastic instead of the commit Tidy up the go.mod file by targeting the tag `v1.1.0-elastic` on the Azure SDK fork instead of the commit. (cherry picked from commit 9de3307)
* Switch to consumption 1.1.0 with patches The Consumption SDK does not URL encode the query parameters in the next link when the response requires more than one page to fetch all the usage details items. Our Azure SDK for Go fork contains a small patch to URL encode the next link value and avoid the 400 error. We also upgraded the azcore package to use the standard URL helper for the Azure SDK. * Update NOTICE.txt * Target tag v1.1.0-elastic instead of the commit Tidy up the go.mod file by targeting the tag `v1.1.0-elastic` on the Azure SDK fork instead of the commit. (cherry picked from commit 9de3307) # Conflicts: # NOTICE.txt # go.mod # go.sum
… (#37242) * Switch to consumption 1.1.0 with patches The Consumption SDK does not URL encode the query parameters in the next link when the response requires more than one page to fetch all the usage details items. Our Azure SDK for Go fork contains a small patch to URL encode the next link value and avoid the 400 error. We also upgraded the azcore package to use the standard URL helper for the Azure SDK. * Update NOTICE.txt * Target tag v1.1.0-elastic instead of the commit Tidy up the go.mod file by targeting the tag `v1.1.0-elastic` on the Azure SDK fork instead of the commit. (cherry picked from commit 9de3307) Co-authored-by: Maurizio Branca <[email protected]>
…ic#37158) * Switch to consumption 1.1.0 with patches The Consumption SDK does not URL encode the query parameters in the next link when the response requires more than one page to fetch all the usage details items. Our Azure SDK for Go fork contains a small patch to URL encode the next link value and avoid the 400 error. We also upgraded the azcore package to use the standard URL helper for the Azure SDK. * Update NOTICE.txt * Target tag v1.1.0-elastic instead of the commit Tidy up the go.mod file by targeting the tag `v1.1.0-elastic` on the Azure SDK fork instead of the commit.
@zmoog I don't see any actual version tags applied to this PR. I have support case 01523048 where they are hitting this known issue. Has his fix made it into the product, and what version? |
The fix has been released in Beats and Elastic Agent version 8.11.2. |
@JuddDeaver, which tags should I apply to the PR to properly communicate this info? |
In that case I think adding the |
Yeah, it's not a common practice for this repo, but conveying this information with tags/labels or a last comment with a recap makes sense. I'll do one or the other in current and future PRs. Thanks for the heads up. |
Proposed commit message
Bump the following package versions to patch the Consumption SDK 1.1.0:
armconsumption
package version from 1.0.0+patch to 1.1.0+patchazcore
package version from 1.4.0 to 1.9.0 to use the URL encoder helper used in the Azure SDKThe Consumption SDK does not correctly handle query parameters in the 'next link' when the dataset in Azure requires pagination. See elastic/integrations#7478 (comment) for more details.
We manage the patches to the Azure SDK for Go in the repository fork. To learn more about the patches and the fork, see #37151
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Our Azure accounts does not have enough usage details items to trigger pagination; the default page size is 1000 items.
You can trigger the pagination by setting the
top
parameter to a low value (for example, 10 items) when in the pager atbeats/x-pack/metricbeat/module/azure/billing/service.go
Lines 178 to 184 in a9ac1d1
Related issues