Repository navigation
feat: add initial metric publisher - #47
Conversation
|
Let me know if you'd like to go a different direction with this. It is in line with the java and go plugins. |
|
Thanks for this contribution! Just a few test errors in the build. You can reproduce the test failures locally by running; Once those are passing we can look at merging this in. |
|
Yea I forgot to install the precommit. I’m working through the errors now and I’ll circle back when I get them fixed. Thanks! |
|
@rjlohan i've pushed updates here and the tests should pass now. I updated the .gitignore as it was disallowing new tests being added, and i added a test for the metric publisher. Let me know if you like this approach for the publisher. I haven't added in any of the calls to actual handler yet, this is just the class. If we like this direction then i can add the calls into the actual handler. |
|
Hey, thanks for the PR, it's nice and clean! We're working pretty hard getting some more stuff ready and wanted to get the Python stuff out there to let people know we're working on it and it's a priority. Apologies if it takes me a bit to get to this! |
|
@tobywf take your time no worries! |
|
looks good 😄 Is the intent to wire this up to |
|
@jaymccon that was my thinking yes. I originally had it on this pr, but removed it as it changed a lot of function signatures in the other tests. I think it'll be a quicker pr in that case. |
tobywf
left a comment
There was a problem hiding this comment.
Awesome work. Great adaptation of the Java one. I'm not super familiar with CloudWatch, but the boto docs indicate some of the types don't quite match, so maybe we can work on tightening that part up. Happy to do some investigation myself if you need it.
|
I could use some feedback on the first test that should make sure that an exception during the put_metric_data call is logged. I attempted to mock the LOG variable for awhile and don’t have a ton of luck. Do you see anything obvious that would make that easy to check? Currently the test does nothing. That’s the last main TODO here. |
patching @patch("cloudformation_cli_python_lib.metrics.LOG", autospec=True)
def test_put_metric_catches_error(mock_log):
...
mock_log.error.assert_called_once() |
|
I had tried that and don't know what I was doing wrong, but it works now. This PR should be up to date now with requested changes. |
tobywf
left a comment
There was a problem hiding this comment.
This is great. Currently on-call, so a bit short on time to test it fully. Let's merge it and iterate! 🚢
Issue #, if available:
#22
Description of changes:
Adds an initial metrics publisher
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.