Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[__meta_azure_machine_resource_group] returns the value in lowercase #4756
Comments
simonpasquier
added
the
component/service discovery
label
Oct 18, 2018
This comment has been minimized.
This comment has been minimized.
|
Looking at the code, the resource group is explicitly lower-cased: prometheus/discovery/azure/azure.go Lines 230 to 233 in 5824d69 The (lower-case) value is used later on to query Azure: prometheus/discovery/azure/azure.go Line 415 in 5824d69 I can't say what would happen if the resource group is kept as-is (would the 2nd query fail?). Also people are probably relying on the value being lower-case so it might be better to just update the Azure SD documentation to state that the label value is always lower-case? |
This comment has been minimized.
This comment has been minimized.
|
Thanks for your quick response.
It’s not clear to me why the resource group is explicitly lower-cased.
Other meta labels such as __meta_azure_machine_name are not explicitly lower-cased, so why treat resource group differently?
Seems like a bug to me.
(Although Azure doesn’t let you create 2 resource groups with same name but different case. for example if I have a resource group named “test” I cannot create another group named “Test”)
|
This comment has been minimized.
This comment has been minimized.
|
It's been like that since the Azure SD support has been added to Prometheus: 0988e3b#diff-7e618b6815f2ec80ed046c215305bb13R131 Again I can't explain why it is this way but changing it might have side effects. |
This comment has been minimized.
This comment has been minimized.
|
We are permitted to make breaking changes to SDs such as if we discover we didn't get something right, or the underlying SD has changed in some way. |
This comment has been minimized.
This comment has been minimized.
|
@yanivroz if you can, feel free to test what happens if |
This comment has been minimized.
This comment has been minimized.
|
@simonpasquier
To:
But that didn't work, the instances were not discovered regardless which case I used in the regex (not sure why) So to work around this problem I just added the case-insensitive flag into the regex: |
This comment has been minimized.
This comment has been minimized.
|
@yanivroz thanks for the follow-up. In that case, you can close the issue. |
yanivroz commentedOct 18, 2018
Bug Report
What did you do?
Tried to scrape instances from a specific resource group in azure that contains uppercase characters in the resource group name
What did you expect to see?
Intances in the resource group are discovered
What did you see instead? Under which circumstances?
Instances were not discovered.
Only when I typed the resource group in all lowercase under the regex it was matched (even though the actual value contains both upper and lower case characters)
Environment
Azure
Linux 4.15.0-34-generic x86_64with regex all in lowercase (
regex: 'myresourcegroupname').you can see 2 instances were discovered in the bottom 2 lines
With regex set as the actual resource group name case (
regex: 'myResourceGroupName')no instances were discovered
Using azure cli you can see the actual resource group does contain uppercase characters