-
Notifications
You must be signed in to change notification settings - Fork 188
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
Route53 HostedZone metrics #345
Conversation
@julienduchesne This looks like a great starting point, thanks so much! I'm incredibly busy at work this week and going to be away this weekend, so I most likely won't get a chance to look this over in detail until the weekend or early next week. I did notice that the TravisCI tests are failing for the Python 2.6 environment only. That can be ignored; per #317 I announced EOL of py26 and py33 support in 3.0.0 in December, so I think I'll drop tests and official support for those in the next release. I did notice one other thing though... the code needs to be broken up a bit differently. Right now Again, thanks so so much for the contribution! |
The reason get_limits returns nothing is that, for the HostedZone metrics, the limit is actually for each HostedZone individually (like EC2 instance types). However, we cannot get the limits without fetching all the zones since they do not have fixed ids like the EC2 instance types. Also, the limit is returned in the same API call as the current value. I thought it a waste, for these metrics, to fetch all the limits from the API and then do another call to fetch the value when both of these are fetched in the same call. Therefore, I see get_limits as more of a placeholder for further metrics such as the Maximum number of hostedzones. Does this make sense? I did not find any other limits in the app where the limit is actually fetched at the same time as the value so I did not have any examples from which to derive my code. |
@julienduchesne I still haven't been able to review this in depth, but I wanted to respond to your comment: Ok, that all makes sense, but then we need to switch where we do the actual API calls from find_usage to get_limits. The problem here is that there is both an API call and a command-line option to print the current limits without calculating usage. When this is done, Overall, I'm not entirely sure about the current implementation of having an AwsLimit for each hosted zone - I'm not sure that really fits with the API and usual use case of awslimitchecker. I'll pull your branch down locally and play around with it a bit within the next week, but I'm thinking that I may opt to make some changes to the internals of AwsLimit to allow it to work better with limits where each AwsLimitUsage has its own threshold, if that makes sense... |
Codecov Report
@@ Coverage Diff @@
## develop #345 +/- ##
======================================
Coverage 100% 100%
======================================
Files 27 28 +1
Lines 2057 2107 +50
Branches 309 318 +9
======================================
+ Hits 2057 2107 +50
Continue to review full report at Codecov.
|
I tried switching the API calls from So I put the code in |
@julienduchesne Apologies for letting this sit so long. My personal life has been really busy lately, and I haven't had much time to dedicate to working on projects. You're right, I think I'm still a bit torn on the implementation of this. Right now, the actual set of limits that awslimitchecker returns in its output is a fixed, known set. With the current implementation, the number of limits we return will be increased by the number of hosted zones in an account. This also makes it significantly more difficult to suppress some checks (i.e. all hosted zone checks) or to programmatically work with check results across multiple accounts. This is a problem that awslimitchecker hasn't had to deal with before, because this is the first limit we monitor that doesn't have a fixed set of limits (i.e. even for the instance type limits, we know in the source code what instance types there are and what the default limits for them are). I'm sort of thinking of perhaps implementing a subclass of AwsLimit (or AwsLimitUsage) for this, which would allow having one hosted zone VPCs limit and one rrsets limit, and then storing usage much like we do for things like subnets per vpc. i.e. I'm thinking of something that would store usage/threshold pairs for each hosted zone. But that would require some changes to the public API of how limits and usage work. Alternatively we could just subclass AwsLimit without any actual changes, i.e. just an empty wrapper class, called something like |
@nadlerjessie @spulec @hltbra As far as I know, yipit/awslimits is the only public non-trivial consumer of the awslimitchecker Python API. This PR adds support for the Route53 Hosted Zone limits, which differ from all other limits we handle to date because the actual limit/threshold is specific to each Hosted Zone. The current implementation here means that if an account had 30 hosted zones, we'd be adding potentially 60 limits: "foo.com Record Sets" for each zone and and "foo.com VPC Associations" for each Private zone. Any thoughts from your perspective on:
|
Hey @jantman. Have you started working on something? If not, I can take a stab at it this week or next one when I get the time. Let me know. Thanks. |
I have not, sorry. I really feel bad for letting something sit this long, but work has been really busy lately (this project is personal-time-only for me) and I'm also moving at the end of the month, so most of my personal time has been taken up with organizing that... If you have time, that would be wonderful! If not, the most realistic timeframe for me would be some time after the first or second week of June. |
Hey, @jantman. Finally took some time to work on this. I took a very simple approach which is to add a Let me know what you think. |
@julienduchesne I'm really sorry, but I'm probably not going to get a chance to seriously look this over for a few weeks. I'm moving on June 1st and still have a lot to get straightened out before and the week after. Glancing over the code it looks good to me, but I really don't have more time than that for now. I'm sorry. |
PS - If all else fails, I added an item to my calendar on June 9th to look at this. I should be done with the move, settled in, and ready to get back to my F/OSS projects by then. |
@jantman: Any movement on this front since your last comment? (I'd also very much like to see support for route53 limits in this module 🙏.) |
@jeffwecan and @julienduchesne Apologies. I've had a really busy few months and took a bit of a sabbatical from my F/OSS work to focus on some personal stuff. Most of that has wound down, so I'll take another look at this sometime this week and get it dealt with. |
I'm so sorry that it took so long to get this merged. I'm doing so now. The build failure was because of py26 and py33 failures, but support for both of those is being dropped anyway. I'll update again when this is released. Thanks so much to everyone who contributed to this PR. |
No problem @jantman. Thanks for your help with this PR! |
This was released in 5.0.0 just now, and should be live on PyPI. |
Summary
This adds support to HostedZone limits. The ones in this request: https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetHostedZoneLimit.html
Pull Request Checklist
writing tests for the code, that's fine, just mention that in the summary and either
ask for assistance, or clarify that you'd like someone else to handle the tests. PRs that
include complete test coverage will usually be merged faster.
tox -e docs
connect()
andconnect_resource()
methods, inherited fromawslimitchecker.connectable.Connectable
if you're working on a GitHub issue (i.e. "issue #x - "). Please
refrain from using the "fixes #x" notation unless you are sure that the
the issue is fixed in that commit.
Contributor License Agreement
By submitting this work for inclusion in awslimitchecker, I agree to the following terms:
is being made under the same license as the awslimitchecker project (the Affero GPL v3,
or any subsequent version of that license if adopted by awslimitchecker).
this pull request grants a perpetual, global, unlimited license for it to be used and distributed
under the terms of awslimitchecker's license.