-
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
[Metricbeat] [Azure] Fix monitor namespace empty string #36295
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
|
This pull request is now in conflicts. Could you fix it? 🙏
|
Relates to #36181 |
I understand all integrations have always set a namespace; @gpop63, are you aware of any not using it? In what use cases do we not set the namespace? |
From what I saw, all data streams that use the Without this fix it is indeed not working properly since a client could decide to not use any namespace but we still send |
Yeah, I can see your point about extending the Azure Monitor metricset; this would allow the metricset to support new use cases where users do not want to set a namespace. However, this change only partially resolves the root problem creating #36181. The issue #36181 happens because a user made a mistake in writing the configuration, and a blank namespace value slipped into the request causing the status 400. Before this change, there was an implicit assumption the If we change the metricset requirements and handle nil |
So I think this is more of a "Add support for the blank namespace in the Azure Monitor metricset" than a "Fix X". Fixing the error 400 is a (welcome) side-effect of this change. But we're not sure about what can happen when users unintentionally set |
The change seems sound, but I want to address potential problems. @gpop63, are there risks in allowing empty namespaces, like an increase in API costs or pulling too many records? |
These errors/behaviors would only happen with the generic There might be cost differences when not using a namespace since the request will be broader and not targeting specific resources. The primary cost is related to the volume of data collected, rather than the use of a namespace. Are you suggesting enforcing a rule so the namespace is always required? In the Azure Monitor API the namespace is an optional parameter, users might have different use cases - wouldn't we limit them? @zmoog |
@zmoog From my point of view these are 2 different issues, this one is simply fixing the behavior of the metricset so it works just like before the SDK upgrade (1). Then, we can add additional checks/validation for the config to see if namespace is sent and formatted properly. I might be wrong or missing something. (1) Before the SDK upgrade no namespaces were allowed, right? |
From my testing, the older SDK version targeted an older API version that was tolerant of empty namespaces. It accepted empty values instead of sending "400 Bad Request" as a response. |
What's the behaviour of the Old SDK version with an empty namespace? If it returns the same values as the New SDK with a @gpop63, do you have time to give these scenarios a try? |
@zmoog just tested both SDKs
|
Okay. I am primarily interested in the Old SDK vs. (New SDK + fix) behavior with an empty namespace; the fix allows the New SDK to run without errors. Will these two return the same data? |
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.
We need to check the Old SDK vs. (New SDK + fix) behaviour with an empty namespace; the fix allows the New SDK to run without errors.
Will these two return the same data?
@zmoog Yes, from my tests Old SDK vs New SDK (+fix) behave the exact same way with an empty namespace. |
* add monitor fix * add changelog entry
Proposed commit message
Metricnamespace
was always being sent to the Azure Monitor API in the following functions:GetMetricDefinitions
GetMetricValues
The problem is that the Monitor API does not expect empty strings, if there is no namespace it should be sent as
nil
. This can cause unexpected behaviors. Conditionally sending it fixes this problem.Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
azure.monitor
metricset #36181Use cases
Screenshots
Logs