)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"b5d4fe92713bd35737b102d734ed49f1c8cc70b4","unresolved":true,"context_lines":[{"line_number":9,"context_line":"Related Spec at [1]"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"[1] https://review.opendev.org/c/openstack/watcher-specs/+/933300"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Change-Id: I6a70c4acc70a864c418cf347f5f6951cb92ec906"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"88c6f10d_788340d8","line":12,"updated":"2024-11-08 13:44:59.000000000","message":"Implements: blueprint prometheus-datasource","commit_id":"90d114aebadb67d74dc4e5e789f801fde80e5b0a"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":9,"context_line":"Related Spec at [1]"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"[1] https://review.opendev.org/c/openstack/watcher-specs/+/933300"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Change-Id: I6a70c4acc70a864c418cf347f5f6951cb92ec906"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"2406881b_f5cc2b05","line":12,"in_reply_to":"88c6f10d_788340d8","updated":"2024-11-15 14:33:35.000000000","message":"Done","commit_id":"90d114aebadb67d74dc4e5e789f801fde80e5b0a"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Related Spec at [1]"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Implements: blueprint prometheus-datasource"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"[1] https://review.opendev.org/c/openstack/watcher-specs/+/933300"},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"125422d3_d040c5a5","line":11,"updated":"2024-11-25 16:28:29.000000000","message":"this is getting closer to being mergable.\n\ni think the main todos are:\n- a release note\n- docs\n-- contributro docs (devstack local.conf examples)\n-- installer docs\n-- extention of the datasouce docs.\n\nI need too review the unit test coverage again\nbut over all this is looking promising.\n\nthe final critia i think we would want to see is a tempest job to validate this end to end. that is in progress in a diffent patch but we will likely want ot see that\npass before proceeding with this.\n\ni think most/all of that is doable in then next few weeks.\n\nmore comments inline but nothing too concerning.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"dded3ad64a928b080bc80e98539de8a5315dad1e","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Related Spec at [1]"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Implements: blueprint prometheus-datasource"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"[1] https://review.opendev.org/c/openstack/watcher-specs/+/933300"},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"6f02b415_0b0f14c5","line":11,"in_reply_to":"125422d3_d040c5a5","updated":"2024-12-11 18:58:26.000000000","message":"most of my comments have been adressed in the latest version so ill consider this resovled.\n\nSeparately, we discussed making follow-up changes to complete the feature, but I\u0027m more or less happy to proceed with this as the initial baseline.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"}],"/PATCHSET_LEVEL":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"a01075967a09d118a960dca78ec1bd6fa11d2e6b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"68d9e836_149d206c","updated":"2024-11-08 13:43:45.000000000","message":"just skiming this quickly this is a good start.\n\nwe obvioulsy will need some addtional itmes like doc, a release note and a ci job to test this but thanks for pushing up the inital poc","commit_id":"90d114aebadb67d74dc4e5e789f801fde80e5b0a"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8878fb878fb536fcd4ea96c9a12bfa413bb61b01","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"4667e733_da1fdb4f","updated":"2024-11-13 11:30:59.000000000","message":"thanks for reviewing and for your suggestions","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":12,"id":"efcd391a_a9cc4f22","updated":"2024-11-26 12:40:45.000000000","message":"thank you for reviews i\u0027ll update for your comments","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"60327ac8f558e1b4d721d52433883b95e68441e6","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":12,"id":"9050e0da_c4035d27","updated":"2024-11-25 16:48:27.000000000","message":"thanks for your review @sean I will check your comments tomorrow","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"1f0149779f3db8425944bb57e8e94d876d795177","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"b2e16798_7b140a45","updated":"2024-11-26 16:30:25.000000000","message":"No blocking issues, just a couple of comments.","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"dd4811f48bfce6ee9829f1ee213afc3f500a2fb1","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"c552a1b5_a780d53f","updated":"2024-11-26 18:54:05.000000000","message":"i didn\u0027t have time to fully review today but ill try and check in again later this week.","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"747e2e9f53355ba344af1831627588cb286f7c34","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"99637af3_e149023c","in_reply_to":"c552a1b5_a780d53f","updated":"2024-11-27 11:51:35.000000000","message":"thank you for ongoing reviews","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"dded3ad64a928b080bc80e98539de8a5315dad1e","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":18,"id":"37db9ede_e850581d","updated":"2024-12-11 18:58:26.000000000","message":"alfredo has raised some imporant points and we will need to revist exactly what config options we expose. we proably shoudl not proceed with this until we make that descison as once we merge the config option we are basically locked in to supproteing it with a deprecation period.\n\nlooking at how aodh integrates im wondering if they are regestering prometious as a keyston end point or how that is working so prehaps we should talk to telemetery folks about that.\n\ni am not seeing any configuraiton in aodh for the endpoint or any direct handeling of http vs https.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8f8cc5ecf2cde19b742f81b7ee272a39add047a4","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":18,"id":"2439c521_0483ebbb","updated":"2024-12-12 08:43:13.000000000","message":"thanks for reviews !","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8546f4801f347b345f811a5d4b2f6f5e2f853304","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":18,"id":"a254c9dd_355fa8b1","in_reply_to":"37db9ede_e850581d","updated":"2024-12-18 09:08:32.000000000","message":"(there is another unresolved thread with similar themes)... we now have client options for passing user/pass in basic auth or tls certs/keys if those are set. i think those should be safe bets to merge on first version.\n\nkeystone integration options can come in following iterations. wdyt?","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"7bb83ad68f046cfdcef58ff537bc774e6f72b88a","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":19,"id":"db30e1cd_65a08656","updated":"2024-12-12 10:46:17.000000000","message":"I\u0027ve tested get_host_cpu_usage and get_host_cpu_usage as in PS19 and it returns the right values:\n\n- For a 4cpus machine with 1 of them fully loaded:\n  helper.get_host_cpu_usage(server) -\u003e 25.439814814836367\n- For a host using 2850 MB as seen in \"free -m\":\n  helper.get_host_ram_usage(server, aggregate\u003d\"mean\") -\u003e 2846.920703125\n  \nHowever, I have a doubt with data types. According to https://github.com/openstack/watcher/blob/master/watcher/decision_engine/datasources/base.py , they should return float but I\u0027d say it\u0027s returning strings instead.\n\n\u003e\u003e\u003e type(helper.get_host_ram_usage(server, aggregate\u003d\"mean\"))\n\u003cclass \u0027str\u0027\u003e","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":19,"id":"f0635dad_a077a730","updated":"2024-12-13 11:34:38.000000000","message":"thanks for reviews, i\u0027ll update as discussed inline. I left a couple of the tests comments unresolved because I want to settle on the code first before I start fixing up the tests again.","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"02a1bda2b20dd6f7b66b8d8fb5615138f78bdcff","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":19,"id":"435e1374_3a33f35a","updated":"2024-12-13 15:04:42.000000000","message":"tks marios, this is looking good","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"42933b70a7462c8f7c2dca9f2a11abbf47a46eb0","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":19,"id":"664c89f4_20a4357f","in_reply_to":"32205f78_27acaf0b","updated":"2024-12-16 08:27:37.000000000","message":"forgot to do this I will implement in v21","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8546f4801f347b345f811a5d4b2f6f5e2f853304","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":19,"id":"f6448ed6_0ff7f8a4","in_reply_to":"664c89f4_20a4357f","updated":"2024-12-18 09:08:32.000000000","message":"Done","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"7cbf5efe569d800eab69be54ead23476e36e4c9b","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":19,"id":"32205f78_27acaf0b","in_reply_to":"db30e1cd_65a08656","updated":"2024-12-12 10:57:21.000000000","message":"yes nice catch i can cast the result before returning\nwe get strings back from the observabilityclient so that\u0027s what is currently returned","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"d1782019dcce82ccb2b4f3d7f96658e2dfd4cf72","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":22,"id":"21fef14f_406e41a1","updated":"2024-12-17 10:19:09.000000000","message":"added the core reviewers o/\nplease have a look when you next get some review cycles\nwe think this is close to mergable","commit_id":"1bbc31e3a9c895d636c7e957f0b791d172a45e80"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"d62e04e6b3c4b4e9f315e2b58dd5d91b16a27bf7","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":22,"id":"a621e0b4_ddaba795","updated":"2024-12-17 13:22:58.000000000","message":"lgtm","commit_id":"1bbc31e3a9c895d636c7e957f0b791d172a45e80"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"cf29be709ef735d69b614104401c7e6deec4dfec","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":23,"id":"f55925e3_a548ebf3","updated":"2024-12-18 09:41:34.000000000","message":"My -1 is mainly related to the handling of ssl config options. Although, I\u0027d like to also change to use parameter by names instead of order when calling statistical_aggregation.","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"213b2efe00ef45d9778e4ed04a8421496452f9e3","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":25,"id":"7f3d6278_bedef21d","updated":"2024-12-19 11:55:59.000000000","message":"lgtm","commit_id":"7d2fcfbe722cfcf57d2e52b4deb678ddd395726c"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"3a24d929bddbeeaf105d89482b0614b41912f4b7","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":25,"id":"2ec55ad6_695253d1","updated":"2024-12-18 16:00:36.000000000","message":"recheck \n\n\nfailed watcher-tempest-strategies which hits a transient issue (i believe the same issue Sean was chasing down)","commit_id":"7d2fcfbe722cfcf57d2e52b4deb678ddd395726c"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"ef850f5c2acde1d018946149306ba960ecb192fc","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":25,"id":"903584bf_fc7f29a1","updated":"2024-12-19 12:07:49.000000000","message":"tks, LGTM","commit_id":"7d2fcfbe722cfcf57d2e52b4deb678ddd395726c"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"0a0d3779416b16b4a0a241c9af17370ea1b3fc36","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":27,"id":"aeff6604_48a4c566","updated":"2024-12-19 17:59:23.000000000","message":"We missed some details about string translations, but should be an easy fix","commit_id":"b597acdcf2ab0687c13a80bbd93ab0f460b58711"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"256a823cef63915d4526d081a582d8721338103d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":27,"id":"b19f9223_6370ce84","updated":"2024-12-20 10:11:20.000000000","message":"thanks for raising that Doug update incoming","commit_id":"b597acdcf2ab0687c13a80bbd93ab0f460b58711"},{"author":{"_account_id":34452,"name":"Joan Gilabert","display_name":"jgilaber","email":"jgilaber@redhat.com","username":"jgilaber"},"change_message_id":"961ffc1b2de6ef142113ccc897b51534e50b616f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":28,"id":"73295427_0695280f","updated":"2024-12-20 14:42:14.000000000","message":"looks great!","commit_id":"4ea20f7879e0b6d4618b165c21e5436dbfb7d9c8"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"7b54677980fc0884d35e3240caaa9b13cf160523","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":28,"id":"7d555c75_dad634df","updated":"2024-12-20 12:17:41.000000000","message":"recheck \n\ntransient strategies fail","commit_id":"4ea20f7879e0b6d4618b165c21e5436dbfb7d9c8"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"b584d826b767752a9f9a554fd9cfcf893ba8ad84","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":29,"id":"834b86ca_ad39cb4a","updated":"2025-01-07 12:25:28.000000000","message":"Thanks marios","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d78f2e474feba6be404069a87bcf0f7b063ac9ba","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":32,"id":"00946351_6fa80e3d","updated":"2025-01-09 21:03:47.000000000","message":"i need to review this again properly tomorowy but quickly skimming it i think this is now mroe or less ready to merge\ni agree with alfredo on teh statistic_aggregation return type however so please include that in a new revisions.","commit_id":"83b07fa8d308a4fbd05518f60b9d71804677d227"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"531305a57ad5b3c7097c12954bba819b26d0666e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":33,"id":"5290f66d_7ae1d291","updated":"2025-01-10 13:04:13.000000000","message":"Thanks Marios for the updates, lgtm","commit_id":"ab16c97d68aa0b015afa754b08aafa1cca1f363c"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"1b9d8ab7a3fa79403338676ae489a5fae777291d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":34,"id":"412b5c49_32e6eca3","updated":"2025-01-24 12:52:19.000000000","message":"this has been open for review for 2 weeks now with no negitive feedcback so elevating to +w","commit_id":"3f26dc47f26643f189d3fc33538868045e5c0cf3"}],"doc/source/datasources/prometheus.rst":[{"author":{"_account_id":9976,"name":"Ronelle Landy","email":"rlandy@redhat.com","username":"rlandy"},"change_message_id":"803db2cbee0e18eec006eb834487c3f42e109e6e","unresolved":true,"context_lines":[{"line_number":4,"context_line":""},{"line_number":5,"context_line":"Synopsis"},{"line_number":6,"context_line":"--------"},{"line_number":7,"context_line":"The Prometheus datasource allows watcher to use a Prometheus server as the"},{"line_number":8,"context_line":"source for collected metrics used by the Watcher decision engine. At minimum"},{"line_number":9,"context_line":"deployers must configure the ``prometheus_host_port`` to specify the host and"},{"line_number":10,"context_line":"port at which the Prometheus server is listening."}],"source_content_type":"text/x-rst","patch_set":19,"id":"7a33c3e3_8eddfff1","line":7,"updated":"2024-12-12 21:23:27.000000000","message":"nitpick: Watcher is capitalized in some places and not in others. For public facing doc, we should be consistent.","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[{"line_number":4,"context_line":""},{"line_number":5,"context_line":"Synopsis"},{"line_number":6,"context_line":"--------"},{"line_number":7,"context_line":"The Prometheus datasource allows watcher to use a Prometheus server as the"},{"line_number":8,"context_line":"source for collected metrics used by the Watcher decision engine. At minimum"},{"line_number":9,"context_line":"deployers must configure the ``prometheus_host_port`` to specify the host and"},{"line_number":10,"context_line":"port at which the Prometheus server is listening."}],"source_content_type":"text/x-rst","patch_set":19,"id":"da8f5a12_9c87f380","line":7,"in_reply_to":"7a33c3e3_8eddfff1","updated":"2024-12-13 11:34:38.000000000","message":"Done","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":9976,"name":"Ronelle Landy","email":"rlandy@redhat.com","username":"rlandy"},"change_message_id":"803db2cbee0e18eec006eb834487c3f42e109e6e","unresolved":true,"context_lines":[{"line_number":23,"context_line":"      static_configs:"},{"line_number":24,"context_line":"     - targets: [\u002710.1.2.3:9100\u0027]"},{"line_number":25,"context_line":"        labels:"},{"line_number":26,"context_line":"          fqdn: \"marios-env-again.controlplane.domain\""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"This default value can be overridden when a deployer uses a different label to"},{"line_number":29,"context_line":"identify the exporter host (for example ``hostname`` or ``host``, or any other"}],"source_content_type":"text/x-rst","patch_set":19,"id":"6ffe902a_4d6c212d","line":26,"updated":"2024-12-12 21:23:27.000000000","message":"suggestion: something less personal :) ... \nfqdn: \"test-env.controlplane.domain\"","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[{"line_number":23,"context_line":"      static_configs:"},{"line_number":24,"context_line":"     - targets: [\u002710.1.2.3:9100\u0027]"},{"line_number":25,"context_line":"        labels:"},{"line_number":26,"context_line":"          fqdn: \"marios-env-again.controlplane.domain\""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"This default value can be overridden when a deployer uses a different label to"},{"line_number":29,"context_line":"identify the exporter host (for example ``hostname`` or ``host``, or any other"}],"source_content_type":"text/x-rst","patch_set":19,"id":"a29883a0_b3981014","line":26,"in_reply_to":"6ffe902a_4d6c212d","updated":"2024-12-13 11:34:38.000000000","message":"Done","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"02a1bda2b20dd6f7b66b8d8fb5615138f78bdcff","unresolved":true,"context_lines":[{"line_number":72,"context_line":"A deployer must set the ``datasources`` parameter to include ``prometheus``"},{"line_number":73,"context_line":"under the watcher_datasources section of watcher.conf (or add ``prometheus`` in"},{"line_number":74,"context_line":"datasources for a specific strategy if preferred eg. under the"},{"line_number":75,"context_line":"``[watcher_strategies.workload_stabilization]`` section)."},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"The watcher.conf configuration file is also used to set the parameter values"},{"line_number":78,"context_line":"required by the Watcher Prometheus data source. The configuration can be"}],"source_content_type":"text/x-rst","patch_set":19,"id":"3587bad2_d4f98cbf","line":75,"range":{"start_line":75,"start_character":0,"end_line":75,"end_character":57},"updated":"2024-12-13 15:04:42.000000000","message":"note that this strategy will not work with this datasource, since we still miss instances metrics. Not sure if you want to add that note at someplace, or just ignore it since we plan to add them next","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"474df18c7b97de09bb1481f19ae601879300e59f","unresolved":true,"context_lines":[{"line_number":72,"context_line":"A deployer must set the ``datasources`` parameter to include ``prometheus``"},{"line_number":73,"context_line":"under the watcher_datasources section of watcher.conf (or add ``prometheus`` in"},{"line_number":74,"context_line":"datasources for a specific strategy if preferred eg. under the"},{"line_number":75,"context_line":"``[watcher_strategies.workload_stabilization]`` section)."},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"The watcher.conf configuration file is also used to set the parameter values"},{"line_number":78,"context_line":"required by the Watcher Prometheus data source. The configuration can be"}],"source_content_type":"text/x-rst","patch_set":19,"id":"85942170_bf6eb95e","line":75,"range":{"start_line":75,"start_character":0,"end_line":75,"end_character":57},"in_reply_to":"3587bad2_d4f98cbf","updated":"2024-12-16 10:21:30.000000000","message":"I don\u0027t know if a note belongs here since as you said, the vm level metrics will be added next.","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"d1782019dcce82ccb2b4f3d7f96658e2dfd4cf72","unresolved":false,"context_lines":[{"line_number":72,"context_line":"A deployer must set the ``datasources`` parameter to include ``prometheus``"},{"line_number":73,"context_line":"under the watcher_datasources section of watcher.conf (or add ``prometheus`` in"},{"line_number":74,"context_line":"datasources for a specific strategy if preferred eg. under the"},{"line_number":75,"context_line":"``[watcher_strategies.workload_stabilization]`` section)."},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"The watcher.conf configuration file is also used to set the parameter values"},{"line_number":78,"context_line":"required by the Watcher Prometheus data source. The configuration can be"}],"source_content_type":"text/x-rst","patch_set":19,"id":"c0dfda02_0b8bccf8","line":75,"range":{"start_line":75,"start_character":0,"end_line":75,"end_character":57},"in_reply_to":"85942170_bf6eb95e","updated":"2024-12-17 10:19:09.000000000","message":"Done","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":9816,"name":"Takashi Kajinami","email":"kajinamit@oss.nttdata.com","username":"kajinamit"},"change_message_id":"39f57e7d19f8ef6d90f20e8e8c1ffb2939df84bd","unresolved":true,"context_lines":[{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    [prometheus_client]"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    prometheus_host_port \u003d \"10.2.3.4:9090\""},{"line_number":113,"context_line":"    prometheus_fqdn_label \u003d \"fqdn\""}],"source_content_type":"text/x-rst","patch_set":21,"id":"908e9087_3d3a8924","line":112,"range":{"start_line":112,"start_character":27,"end_line":112,"end_character":28},"updated":"2024-12-16 14:58:40.000000000","message":"I can be wrong but afaik oslo.config does not strip the surrounding \"\", so you should remove these (the same is applied to the line below.)","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8ecaf9e219f51714b5d9a9018ee8eea380c5094f","unresolved":false,"context_lines":[{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    [prometheus_client]"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    prometheus_host_port \u003d \"10.2.3.4:9090\""},{"line_number":113,"context_line":"    prometheus_fqdn_label \u003d \"fqdn\""}],"source_content_type":"text/x-rst","patch_set":21,"id":"fb3530a4_6551a8ba","line":112,"range":{"start_line":112,"start_character":27,"end_line":112,"end_character":28},"in_reply_to":"908e9087_3d3a8924","updated":"2024-12-17 09:30:10.000000000","message":"Acknowledged\ni think that behaviour is configurable (?) but ok to remove the quotes","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"}],"releasenotes/notes/prometheus-datasource-e56f2f7b8f3427c2.yaml":[{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"02a1bda2b20dd6f7b66b8d8fb5615138f78bdcff","unresolved":true,"context_lines":[{"line_number":4,"context_line":"    A new Prometheus data source is added. This allows the watcher decision"},{"line_number":5,"context_line":"    engine to collect metrics from Prometheus server. For more information"},{"line_number":6,"context_line":"    about the Prometheus data source, including limitations and configuration"},{"line_number":7,"context_line":"    options see"},{"line_number":8,"context_line":"    see https://docs.openstack.org/watcher/latest/datasources/prometheus.html"}],"source_content_type":"text/x-yaml","patch_set":19,"id":"c58a9aad_926703df","line":7,"range":{"start_line":7,"start_character":12,"end_line":7,"end_character":15},"updated":"2024-12-13 15:04:42.000000000","message":"\"see\" 2x","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"474df18c7b97de09bb1481f19ae601879300e59f","unresolved":false,"context_lines":[{"line_number":4,"context_line":"    A new Prometheus data source is added. This allows the watcher decision"},{"line_number":5,"context_line":"    engine to collect metrics from Prometheus server. For more information"},{"line_number":6,"context_line":"    about the Prometheus data source, including limitations and configuration"},{"line_number":7,"context_line":"    options see"},{"line_number":8,"context_line":"    see https://docs.openstack.org/watcher/latest/datasources/prometheus.html"}],"source_content_type":"text/x-yaml","patch_set":19,"id":"b2f1d667_046eadc7","line":7,"range":{"start_line":7,"start_character":12,"end_line":7,"end_character":15},"in_reply_to":"c58a9aad_926703df","updated":"2024-12-16 10:21:30.000000000","message":"ack thanks","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"}],"watcher/common/exception.py":[{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"0a0d3779416b16b4a0a241c9af17370ea1b3fc36","unresolved":true,"context_lines":[{"line_number":155,"context_line":""},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"class MissingParameter(Invalid):"},{"line_number":158,"context_line":"    msg_fmt \u003d (\"%(parameter)s is required but missing. Check watcher.conf\")"},{"line_number":159,"context_line":""},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"class InvalidIdentity(Invalid):"}],"source_content_type":"text/x-python","patch_set":27,"id":"b006e8b4_244d3f7f","line":158,"range":{"start_line":158,"start_character":14,"end_line":158,"end_character":15},"updated":"2024-12-19 17:59:23.000000000","message":"missing `_` \nwe should use the proper funtion for string translations[1]\n\n[1] https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#using-a-marker-function","commit_id":"b597acdcf2ab0687c13a80bbd93ab0f460b58711"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"256a823cef63915d4526d081a582d8721338103d","unresolved":false,"context_lines":[{"line_number":155,"context_line":""},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"class MissingParameter(Invalid):"},{"line_number":158,"context_line":"    msg_fmt \u003d (\"%(parameter)s is required but missing. Check watcher.conf\")"},{"line_number":159,"context_line":""},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"class InvalidIdentity(Invalid):"}],"source_content_type":"text/x-python","patch_set":27,"id":"155a6503_ae649484","line":158,"range":{"start_line":158,"start_character":14,"end_line":158,"end_character":15},"in_reply_to":"b006e8b4_244d3f7f","updated":"2024-12-20 10:11:20.000000000","message":"ack","commit_id":"b597acdcf2ab0687c13a80bbd93ab0f460b58711"}],"watcher/conf/prometheus_client.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"a01075967a09d118a960dca78ec1bd6fa11d2e6b","unresolved":true,"context_lines":[{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               default\u003d\"localhost:9090\","},{"line_number":27,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":28,"context_line":"                    \"separated by :. Defaults to localhost:9090\"),]"},{"line_number":29,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7db29925_86d0cea8","line":26,"range":{"start_line":26,"start_character":15,"end_line":26,"end_character":40},"updated":"2024-11-08 13:43:45.000000000","message":"i would remove the default\nwe can then use that to detect if the data source is misconfigured or should not be active.\n\nin the devstack jobs, we can configure this instead.","commit_id":"90d114aebadb67d74dc4e5e789f801fde80e5b0a"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"0d8ef6fc7f01814288fd87436a99484f90415690","unresolved":false,"context_lines":[{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               default\u003d\"localhost:9090\","},{"line_number":27,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":28,"context_line":"                    \"separated by :. Defaults to localhost:9090\"),]"},{"line_number":29,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"335f2830_440fce66","line":26,"range":{"start_line":26,"start_character":15,"end_line":26,"end_character":40},"in_reply_to":"7db29925_86d0cea8","updated":"2024-11-22 14:21:39.000000000","message":"done in v11","commit_id":"90d114aebadb67d74dc4e5e789f801fde80e5b0a"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"d67cc8f19764adfc2d815a09c392e605be2d1ecf","unresolved":true,"context_lines":[{"line_number":18,"context_line":"prometheus_client \u003d cfg.OptGroup(name\u003d\u0027prometheus_client\u0027,"},{"line_number":19,"context_line":"                                 title\u003d\u0027Configuration Options for Prometheus\u0027,"},{"line_number":20,"context_line":"                                 help\u003d\"See https://docs.openstack.org/watcher/\""},{"line_number":21,"context_line":"                                      \"latest/datasources/pometheus.html for \""},{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["}],"source_content_type":"text/x-python","patch_set":12,"id":"bc4b9526_80b05867","line":21,"range":{"start_line":21,"start_character":58,"end_line":21,"end_character":67},"updated":"2024-11-25 19:30:28.000000000","message":"typo. I know that doesn\u0027t exit yet but... :)","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":18,"context_line":"prometheus_client \u003d cfg.OptGroup(name\u003d\u0027prometheus_client\u0027,"},{"line_number":19,"context_line":"                                 title\u003d\u0027Configuration Options for Prometheus\u0027,"},{"line_number":20,"context_line":"                                 help\u003d\"See https://docs.openstack.org/watcher/\""},{"line_number":21,"context_line":"                                      \"latest/datasources/pometheus.html for \""},{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["}],"source_content_type":"text/x-python","patch_set":12,"id":"c89c4f25_e67fdfce","line":21,"range":{"start_line":21,"start_character":58,"end_line":21,"end_character":67},"in_reply_to":"bc4b9526_80b05867","updated":"2024-11-26 12:40:45.000000000","message":"yes thanks :)","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":29,"context_line":"               default\u003d\"fqdn\","},{"line_number":30,"context_line":"               help\u003d\"The label that Prometheus uses to store the fqdn of \""},{"line_number":31,"context_line":"                    \"exporters. Defaults to \u0027fqdn\u0027.\"),"},{"line_number":32,"context_line":"]"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def register_opts(conf):"}],"source_content_type":"text/x-python","patch_set":12,"id":"aec7b550_acbcec45","line":32,"updated":"2024-11-25 16:28:29.000000000","message":"+1 for making this configurable.\nif someone has an existing prometious they may have built automation around there existing labels so we can provide a default but we should not hard code it.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":29,"context_line":"               default\u003d\"fqdn\","},{"line_number":30,"context_line":"               help\u003d\"The label that Prometheus uses to store the fqdn of \""},{"line_number":31,"context_line":"                    \"exporters. Defaults to \u0027fqdn\u0027.\"),"},{"line_number":32,"context_line":"]"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def register_opts(conf):"}],"source_content_type":"text/x-python","patch_set":12,"id":"a26dc7c2_e0ba32db","line":32,"in_reply_to":"aec7b550_acbcec45","updated":"2024-11-26 12:40:45.000000000","message":"Acknowledged","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"a6ce2663645bd02ca091ca3dfc7d4f80080052b1","unresolved":true,"context_lines":[{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"},{"line_number":28,"context_line":"    cfg.StrOpt(\u0027prometheus_fqdn_label\u0027,"},{"line_number":29,"context_line":"               default\u003d\"fqdn\","},{"line_number":30,"context_line":"               help\u003d\"The label that Prometheus uses to store the fqdn of \""}],"source_content_type":"text/x-python","patch_set":18,"id":"588b962d_357ae6f9","line":27,"range":{"start_line":25,"start_character":0,"end_line":27,"end_character":57},"updated":"2024-12-11 18:22:25.000000000","message":"we soudl proably make this a uri cofnig options instead\n\n\nhttps://github.com/openstack/oslo.config/blob/68cefad313bd03522e99b3de95f1786ebea45d4b/oslo_config/cfg.py#L1178-L1200\n\nthat might also resolve the http vs https problem\n\nthe only other conisdertion for https is that the prometious serve will need ot have a cert form a CA in our hosts trust store but that fine.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"f297b9406de064002f6a608a29cadf168af5001a","unresolved":false,"context_lines":[{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"},{"line_number":28,"context_line":"    cfg.StrOpt(\u0027prometheus_fqdn_label\u0027,"},{"line_number":29,"context_line":"               default\u003d\"fqdn\","},{"line_number":30,"context_line":"               help\u003d\"The label that Prometheus uses to store the fqdn of \""}],"source_content_type":"text/x-python","patch_set":18,"id":"c85cdace_33b37793","line":27,"range":{"start_line":25,"start_character":0,"end_line":27,"end_character":57},"in_reply_to":"588b962d_357ae6f9","updated":"2024-12-11 18:30:46.000000000","message":"the url opt wont work because fo how the client is coded ....","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":9816,"name":"Takashi Kajinami","email":"kajinamit@oss.nttdata.com","username":"kajinamit"},"change_message_id":"e00f6b4d84f1e4946a695c949d35738e99436cf6","unresolved":true,"context_lines":[{"line_number":21,"context_line":"                                      \"latest/datasources/prometheus.html for \""},{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"}],"source_content_type":"text/x-python","patch_set":21,"id":"4d02196a_e4a4799f","line":24,"range":{"start_line":24,"start_character":0,"end_line":24,"end_character":22},"updated":"2024-12-16 14:57:00.000000000","message":"These options appear under the prometheus_client section so prometheus_ prefix in the option names looks redundant to me.","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8ecaf9e219f51714b5d9a9018ee8eea380c5094f","unresolved":true,"context_lines":[{"line_number":21,"context_line":"                                      \"latest/datasources/prometheus.html for \""},{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"}],"source_content_type":"text/x-python","patch_set":21,"id":"ae0d24f2_78c49f34","line":24,"range":{"start_line":24,"start_character":0,"end_line":24,"end_character":22},"in_reply_to":"4d02196a_e4a4799f","updated":"2024-12-17 09:30:10.000000000","message":"i had a similar thought, but in the end they are all inside the same watcher.conf so i felt it makes sense to keep them explicit. Unless there is strong consensus to switch it i\u0027d rather leave as is.","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"67a793366a63caa7429da568bf6f131c4f899ff9","unresolved":true,"context_lines":[{"line_number":21,"context_line":"                                      \"latest/datasources/prometheus.html for \""},{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"}],"source_content_type":"text/x-python","patch_set":21,"id":"dbc8f27b_b21485a4","line":24,"range":{"start_line":24,"start_character":0,"end_line":24,"end_character":22},"in_reply_to":"ae0d24f2_78c49f34","updated":"2025-01-08 16:30:40.000000000","message":"i want to remove the prefix. more on that below.","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":false,"context_lines":[{"line_number":21,"context_line":"                                      \"latest/datasources/prometheus.html for \""},{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"}],"source_content_type":"text/x-python","patch_set":21,"id":"6478310a_cfb21b12","line":24,"range":{"start_line":24,"start_character":0,"end_line":24,"end_character":22},"in_reply_to":"dbc8f27b_b21485a4","updated":"2025-01-09 15:23:36.000000000","message":"ok removing prefix","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":9816,"name":"Takashi Kajinami","email":"kajinamit@oss.nttdata.com","username":"kajinamit"},"change_message_id":"e00f6b4d84f1e4946a695c949d35738e99436cf6","unresolved":true,"context_lines":[{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"},{"line_number":28,"context_line":"    cfg.StrOpt(\u0027prometheus_fqdn_label\u0027,"}],"source_content_type":"text/x-python","patch_set":21,"id":"b4f31729_15f6331b","line":25,"range":{"start_line":25,"start_character":16,"end_line":25,"end_character":36},"updated":"2024-12-16 14:57:00.000000000","message":"I wonder if having separate option for host and port makes the option simpler ?","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"67a793366a63caa7429da568bf6f131c4f899ff9","unresolved":true,"context_lines":[{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"},{"line_number":28,"context_line":"    cfg.StrOpt(\u0027prometheus_fqdn_label\u0027,"}],"source_content_type":"text/x-python","patch_set":21,"id":"df018e81_53b53e0e","line":25,"range":{"start_line":25,"start_character":16,"end_line":25,"end_character":36},"in_reply_to":"7df56766_a17c5b6b","updated":"2025-01-08 16:30:40.000000000","message":"if we have seperate option we can use the oslo.config type to validate both\n\nhttps://docs.openstack.org/oslo.config/latest/reference/api/oslo_config.html#oslo_config.cfg.HostAddressOpt\nhttps://docs.openstack.org/oslo.config/latest/reference/api/oslo_config.html#oslo_config.cfg.PortOpt\n\nso i think that would be preferable\n\nnot that in the short term (this cycle) we will also extend this to support looking up the Prometheus endpoint from the keystone catalog to bring this in line with AODH so \n\nThis is also how the gnocchi data source works by the way and how nova/ironic/glance work.\n\n\nim kind reluctant to proceed with this without that integration but given its an additive change im ok to defer the integration with Keyston to a follow-up path.\n\ni dont think it would be correct to defer it to to next cycle however.","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8ecaf9e219f51714b5d9a9018ee8eea380c5094f","unresolved":true,"context_lines":[{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"},{"line_number":28,"context_line":"    cfg.StrOpt(\u0027prometheus_fqdn_label\u0027,"}],"source_content_type":"text/x-python","patch_set":21,"id":"7df56766_a17c5b6b","line":25,"range":{"start_line":25,"start_character":16,"end_line":25,"end_character":36},"in_reply_to":"b4f31729_15f6331b","updated":"2024-12-17 09:30:10.000000000","message":"maybe? they are not ever used here independently i.e always like \u0027host:port\u0027 for the data source initialisation. imo adding options adds complexity I don\u0027t think it makes it simpler. it makes sense if the complexity is justified (like we want those two things independently) but I don\u0027t think it is here","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":true,"context_lines":[{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"},{"line_number":28,"context_line":"    cfg.StrOpt(\u0027prometheus_fqdn_label\u0027,"}],"source_content_type":"text/x-python","patch_set":21,"id":"ffa0f7bd_c11a2e35","line":25,"range":{"start_line":25,"start_character":16,"end_line":25,"end_character":36},"in_reply_to":"df018e81_53b53e0e","updated":"2025-01-09 15:23:36.000000000","message":"i will split to have host and port as distinct options. keystone integration and olso validation is deferred to followup work ok?","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d78f2e474feba6be404069a87bcf0f7b063ac9ba","unresolved":false,"context_lines":[{"line_number":22,"context_line":"                                      \"details on how these options are used.\")"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"PROMETHEUS_CLIENT_OPTS \u003d ["},{"line_number":25,"context_line":"    cfg.StrOpt(\u0027prometheus_host_port\u0027,"},{"line_number":26,"context_line":"               help\u003d\"The host and port for the prometheus server \""},{"line_number":27,"context_line":"                    \"separated by \u0027:\u0027, i.e. host:port \"),"},{"line_number":28,"context_line":"    cfg.StrOpt(\u0027prometheus_fqdn_label\u0027,"}],"source_content_type":"text/x-python","patch_set":21,"id":"2eb02696_9b6cd5da","line":25,"range":{"start_line":25,"start_character":16,"end_line":25,"end_character":36},"in_reply_to":"ffa0f7bd_c11a2e35","updated":"2025-01-09 21:03:47.000000000","message":"Acknowledged","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":9816,"name":"Takashi Kajinami","email":"kajinamit@oss.nttdata.com","username":"kajinamit"},"change_message_id":"e00f6b4d84f1e4946a695c949d35738e99436cf6","unresolved":true,"context_lines":[{"line_number":32,"context_line":"    cfg.StrOpt(\u0027prometheus_username\u0027,"},{"line_number":33,"context_line":"               help\u003d\"The basic_auth username to use to authenticate with the \""},{"line_number":34,"context_line":"                    \"Prometheus server.\"),"},{"line_number":35,"context_line":"    cfg.StrOpt(\u0027prometheus_password\u0027,"},{"line_number":36,"context_line":"               help\u003d\"The basic_auth password to use to authenticate with the \""},{"line_number":37,"context_line":"                    \"Prometheus server.\"),"},{"line_number":38,"context_line":"    cfg.StrOpt(\u0027prometheus_ca_cert\u0027,"}],"source_content_type":"text/x-python","patch_set":21,"id":"823c0b8a_0e2fed93","line":35,"range":{"start_line":35,"start_character":8,"end_line":35,"end_character":14},"updated":"2024-12-16 14:57:00.000000000","message":"This should have secret\u003dTrue, to avoid logging the value in debug log","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8ecaf9e219f51714b5d9a9018ee8eea380c5094f","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    cfg.StrOpt(\u0027prometheus_username\u0027,"},{"line_number":33,"context_line":"               help\u003d\"The basic_auth username to use to authenticate with the \""},{"line_number":34,"context_line":"                    \"Prometheus server.\"),"},{"line_number":35,"context_line":"    cfg.StrOpt(\u0027prometheus_password\u0027,"},{"line_number":36,"context_line":"               help\u003d\"The basic_auth password to use to authenticate with the \""},{"line_number":37,"context_line":"                    \"Prometheus server.\"),"},{"line_number":38,"context_line":"    cfg.StrOpt(\u0027prometheus_ca_cert\u0027,"}],"source_content_type":"text/x-python","patch_set":21,"id":"df258fd1_014b1f21","line":35,"range":{"start_line":35,"start_character":8,"end_line":35,"end_character":14},"in_reply_to":"823c0b8a_0e2fed93","updated":"2024-12-17 09:30:10.000000000","message":"yes thank you will add in next update","commit_id":"ea8169fc4ba0c51ad12b0f9d6f11858f3affceae"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"67a793366a63caa7429da568bf6f131c4f899ff9","unresolved":true,"context_lines":[{"line_number":29,"context_line":"               default\u003d\"fqdn\","},{"line_number":30,"context_line":"               help\u003d\"The label that Prometheus uses to store the fqdn of \""},{"line_number":31,"context_line":"                    \"exporters. Defaults to \u0027fqdn\u0027.\"),"},{"line_number":32,"context_line":"    cfg.StrOpt(\u0027prometheus_username\u0027,"},{"line_number":33,"context_line":"               help\u003d\"The basic_auth username to use to authenticate with the \""},{"line_number":34,"context_line":"                    \"Prometheus server.\"),"},{"line_number":35,"context_line":"    cfg.StrOpt(\u0027prometheus_password\u0027,"},{"line_number":36,"context_line":"               secret\u003dTrue,"},{"line_number":37,"context_line":"               help\u003d\"The basic_auth password to use to authenticate with the \""},{"line_number":38,"context_line":"                    \"Prometheus server.\"),"},{"line_number":39,"context_line":"    cfg.StrOpt(\u0027prometheus_ca_cert\u0027,"},{"line_number":40,"context_line":"               help\u003d\"Path to the CA certificate for establishing a TLS \""},{"line_number":41,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":42,"context_line":"    cfg.StrOpt(\u0027prometheus_client_cert\u0027,"},{"line_number":43,"context_line":"               help\u003d\"Path to the client certificate for establishing a TLS \""},{"line_number":44,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":45,"context_line":"    cfg.StrOpt(\u0027prometheus_client_key\u0027,"},{"line_number":46,"context_line":"               help\u003d\"Path to the client key for establishing a TLS \""},{"line_number":47,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":48,"context_line":"]"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""}],"source_content_type":"text/x-python","patch_set":29,"id":"c59040da_e1534ac9","line":47,"range":{"start_line":32,"start_character":4,"end_line":47,"end_character":62},"updated":"2025-01-08 16:30:40.000000000","message":"-1\nthese do not conform to the standard naming convention for the equivalent fields when using keystone auth so i do not think we shoudl merge them as is.\n\n\n\nwe shoudl drop the prometheus_ prefixes form all these options at a minium as well as use the standard names used by keystone auth for the tls parmaters.\n\nhttps://docs.openstack.org/watcher/latest/configuration/watcher.html#keystone_authtoken.certfile\nhttps://docs.openstack.org/nova/latest/configuration/config.html#neutron.cafile\nhttps://docs.openstack.org/nova/latest/configuration/config.html#neutron.username\nhttps://docs.openstack.org/nova/latest/configuration/config.html#neutron.password\n\n\n```suggestion\n    cfg.StrOpt(\u0027username\u0027,\n               help\u003d\"The basic_auth username to use to authenticate with the \"\n                    \"Prometheus server.\"),\n    cfg.StrOpt(\u0027password\u0027,\n               secret\u003dTrue,\n               help\u003d\"The basic_auth password to use to authenticate with the \"\n                    \"Prometheus server.\"),\n    cfg.StrOpt(\u0027cafile\u0027,\n               help\u003d\"Path to the CA certificate for establishing a TLS \"\n                    \"connection with the Prometheus server.\"),\n    cfg.StrOpt(\u0027certfile\u0027,\n               help\u003d\"Path to the client certificate for establishing a TLS \"\n                    \"connection with the Prometheus server.\"),\n    cfg.StrOpt(\u0027keyfile\u0027,\n               help\u003d\"Path to the client key for establishing a TLS \"\n                    \"connection with the Prometheus server.\"),\n```\n\nthis will minimise the upgrade impact when we add keyston auth integrtation as aodh uses for pormethius today.\n\n\n\naodh specifically use the service credential section \n\nservice_credentials https://docs.openstack.org/aodh/latest/configuration/aodh-config-file.html","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":false,"context_lines":[{"line_number":29,"context_line":"               default\u003d\"fqdn\","},{"line_number":30,"context_line":"               help\u003d\"The label that Prometheus uses to store the fqdn of \""},{"line_number":31,"context_line":"                    \"exporters. Defaults to \u0027fqdn\u0027.\"),"},{"line_number":32,"context_line":"    cfg.StrOpt(\u0027prometheus_username\u0027,"},{"line_number":33,"context_line":"               help\u003d\"The basic_auth username to use to authenticate with the \""},{"line_number":34,"context_line":"                    \"Prometheus server.\"),"},{"line_number":35,"context_line":"    cfg.StrOpt(\u0027prometheus_password\u0027,"},{"line_number":36,"context_line":"               secret\u003dTrue,"},{"line_number":37,"context_line":"               help\u003d\"The basic_auth password to use to authenticate with the \""},{"line_number":38,"context_line":"                    \"Prometheus server.\"),"},{"line_number":39,"context_line":"    cfg.StrOpt(\u0027prometheus_ca_cert\u0027,"},{"line_number":40,"context_line":"               help\u003d\"Path to the CA certificate for establishing a TLS \""},{"line_number":41,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":42,"context_line":"    cfg.StrOpt(\u0027prometheus_client_cert\u0027,"},{"line_number":43,"context_line":"               help\u003d\"Path to the client certificate for establishing a TLS \""},{"line_number":44,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":45,"context_line":"    cfg.StrOpt(\u0027prometheus_client_key\u0027,"},{"line_number":46,"context_line":"               help\u003d\"Path to the client key for establishing a TLS \""},{"line_number":47,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":48,"context_line":"]"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""}],"source_content_type":"text/x-python","patch_set":29,"id":"690e305d_49873ca8","line":47,"range":{"start_line":32,"start_character":4,"end_line":47,"end_character":62},"in_reply_to":"c59040da_e1534ac9","updated":"2025-01-09 15:23:36.000000000","message":"ack i\u0027ll update the names remove prefix and use the ones you suggested","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"24578057cbfba3c17e62114a5318bafd27547a52","unresolved":true,"context_lines":[{"line_number":30,"context_line":"               default\u003d\"fqdn\","},{"line_number":31,"context_line":"               help\u003d\"The label that Prometheus uses to store the fqdn of \""},{"line_number":32,"context_line":"                    \"exporters. Defaults to \u0027fqdn\u0027.\"),"},{"line_number":33,"context_line":"    cfg.StrOpt(\u0027username\u0027,"},{"line_number":34,"context_line":"               help\u003d\"The basic_auth username to use to authenticate with the \""},{"line_number":35,"context_line":"                    \"Prometheus server.\"),"},{"line_number":36,"context_line":"    cfg.StrOpt(\u0027password\u0027,"},{"line_number":37,"context_line":"               secret\u003dTrue,"},{"line_number":38,"context_line":"               help\u003d\"The basic_auth password to use to authenticate with the \""},{"line_number":39,"context_line":"                    \"Prometheus server.\"),"},{"line_number":40,"context_line":"    cfg.StrOpt(\u0027cafile\u0027,"},{"line_number":41,"context_line":"               help\u003d\"Path to the CA certificate for establishing a TLS \""},{"line_number":42,"context_line":"                    \"connection with the Prometheus server.\"),"}],"source_content_type":"text/x-python","patch_set":34,"id":"fdc8ced1_12f59bf6","line":39,"range":{"start_line":33,"start_character":3,"end_line":39,"end_character":42},"updated":"2025-01-21 19:35:04.000000000","message":"basic auth is expermintal in promentus so it wont be used in general.","commit_id":"3f26dc47f26643f189d3fc33538868045e5c0cf3"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"24578057cbfba3c17e62114a5318bafd27547a52","unresolved":true,"context_lines":[{"line_number":37,"context_line":"               secret\u003dTrue,"},{"line_number":38,"context_line":"               help\u003d\"The basic_auth password to use to authenticate with the \""},{"line_number":39,"context_line":"                    \"Prometheus server.\"),"},{"line_number":40,"context_line":"    cfg.StrOpt(\u0027cafile\u0027,"},{"line_number":41,"context_line":"               help\u003d\"Path to the CA certificate for establishing a TLS \""},{"line_number":42,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":43,"context_line":"    cfg.StrOpt(\u0027certfile\u0027,"},{"line_number":44,"context_line":"               help\u003d\"Path to the client certificate for establishing a TLS \""},{"line_number":45,"context_line":"                    \"connection with the Prometheus server.\"),"}],"source_content_type":"text/x-python","patch_set":34,"id":"738e7528_d58554b6","line":42,"range":{"start_line":40,"start_character":2,"end_line":42,"end_character":62},"updated":"2025-01-21 19:35:04.000000000","message":"this is the only requirement to use tls in general.\nwe shoudl be able to supprot this in devstack in the future via the tls proxy if we choose too.","commit_id":"3f26dc47f26643f189d3fc33538868045e5c0cf3"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"24578057cbfba3c17e62114a5318bafd27547a52","unresolved":true,"context_lines":[{"line_number":40,"context_line":"    cfg.StrOpt(\u0027cafile\u0027,"},{"line_number":41,"context_line":"               help\u003d\"Path to the CA certificate for establishing a TLS \""},{"line_number":42,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":43,"context_line":"    cfg.StrOpt(\u0027certfile\u0027,"},{"line_number":44,"context_line":"               help\u003d\"Path to the client certificate for establishing a TLS \""},{"line_number":45,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":46,"context_line":"    cfg.StrOpt(\u0027keyfile\u0027,"},{"line_number":47,"context_line":"               help\u003d\"Path to the client key for establishing a TLS \""},{"line_number":48,"context_line":"                    \"connection with the Prometheus server.\"),"},{"line_number":49,"context_line":"]"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":""}],"source_content_type":"text/x-python","patch_set":34,"id":"a80c327c_fc616f72","line":48,"range":{"start_line":43,"start_character":4,"end_line":48,"end_character":62},"updated":"2025-01-21 19:35:04.000000000","message":"note to others: this is only need for mutal tls which is not supproted in devstack or our new downstream installer, at least not yest but it nice to future proffs since the observablity clinet \"support it\"","commit_id":"3f26dc47f26643f189d3fc33538868045e5c0cf3"}],"watcher/decision_engine/datasources/manager.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":false,"context_lines":[{"line_number":100,"context_line":"    @property"},{"line_number":101,"context_line":"    def grafana(self):"},{"line_number":102,"context_line":"        if self._grafana is None:"},{"line_number":103,"context_line":"            self._grafana \u003d graf.GrafanaHelper(osc\u003dself.osc)"},{"line_number":104,"context_line":"        return self._grafana"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    @grafana.setter"}],"source_content_type":"text/x-python","patch_set":12,"id":"1ed9793b_90ea4ca5","line":103,"updated":"2024-11-25 16:28:29.000000000","message":"as an aside osc is a terible neme for this as osc si the commonly used\nshorthand for the python-openstackclient cli.\n\nthats not relevent to the current patch but i found it very confusing when first reading this code.\n\nlets avoid propagating that shorthand in the new datastore.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":111,"context_line":"    def prometheus(self):"},{"line_number":112,"context_line":"        if self._prometheus is None:"},{"line_number":113,"context_line":"            self._prometheus \u003d prom.PrometheusHelper()"},{"line_number":114,"context_line":"        return self._prometheus"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    @prometheus.setter"},{"line_number":117,"context_line":"    def prometheus(self, prometheus):"}],"source_content_type":"text/x-python","patch_set":12,"id":"eddd2384_3f8924af","line":114,"updated":"2024-11-25 16:28:29.000000000","message":"ack so by doing it this way we will lazy load the clint the first time its used.\nthat has some advatages form a testing perspect as well so +1 for following the existing pattern.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":111,"context_line":"    def prometheus(self):"},{"line_number":112,"context_line":"        if self._prometheus is None:"},{"line_number":113,"context_line":"            self._prometheus \u003d prom.PrometheusHelper()"},{"line_number":114,"context_line":"        return self._prometheus"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    @prometheus.setter"},{"line_number":117,"context_line":"    def prometheus(self, prometheus):"}],"source_content_type":"text/x-python","patch_set":12,"id":"8d24cca2_c50000d7","line":114,"in_reply_to":"eddd2384_3f8924af","updated":"2024-11-26 12:40:45.000000000","message":"Acknowledged","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"}],"watcher/decision_engine/datasources/prometheus.py":[{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"c951e9c641f1add0a48169e579303250784c20fd","unresolved":true,"context_lines":[{"line_number":83,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":84,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":85,"context_line":"        if resource_type \u003d\u003d \u0027compute_node\u0027:"},{"line_number":86,"context_line":"            instance_label \u003d \"%s:9100\" % (resource.hostname)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"            if meter_name \u003d\u003d \"host_cpu_usage\":"},{"line_number":89,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"4f863b4c_52a2e8a3","line":86,"updated":"2024-11-12 10:46:28.000000000","message":"need to sort out this bit. best I can think of is to query for the config, which exposes the targets that Prometheus is scraping (which for node_exporter that means one per node).\n\n```\n\u003e\u003e\u003e res\u003dprometheus._get(\"status/config\")\n\u003e\u003e\u003e res\n{\u0027status\u0027: \u0027success\u0027, \u0027data\u0027: {\u0027yaml\u0027: \u0027global:\\n  scrape_interval: 15s\\n  scrape_timeout: 10s\\n  scrape_protocols:\\n  - OpenMetricsText1.0.0\\n  - OpenMetricsText0.0.1\\n  - PrometheusText0.0.4\\n  evaluation_interval: 1m\\nruntime:\\n  gogc: 75\\nscrape_configs:\\n- job_name: node\\n  honor_timestamps: true\\n  track_timestamps_staleness: false\\n  scrape_interval: 15s\\n  scrape_timeout: 10s\\n  scrape_protocols:\\n  - OpenMetricsText1.0.0\\n  - OpenMetricsText0.0.1\\n  - PrometheusText0.0.4\\n  metrics_path: /metrics\\n  scheme: http\\n  enable_compression: true\\n  follow_redirects: true\\n  enable_http2: true\\n  static_configs:\\n  - targets:\\n    - localhost:9100\\n\u0027}}\n\n```\n\nWe can match on hostname to determine the port. Watcher has the hostname for each node and we can get the port from the Prometheus config.","commit_id":"c7d4809a2c3add59b5b17c744c63b99dd2a1e529"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ac7aae601aa614b0ae7343b9f063e67083a33c62","unresolved":false,"context_lines":[{"line_number":83,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":84,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":85,"context_line":"        if resource_type \u003d\u003d \u0027compute_node\u0027:"},{"line_number":86,"context_line":"            instance_label \u003d \"%s:9100\" % (resource.hostname)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"            if meter_name \u003d\u003d \"host_cpu_usage\":"},{"line_number":89,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"a2c10aa4_9bc706ff","line":86,"in_reply_to":"4f863b4c_52a2e8a3","updated":"2024-11-14 18:38:18.000000000","message":"Done","commit_id":"c7d4809a2c3add59b5b17c744c63b99dd2a1e529"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"4c1cd508d819c1aa6fbab1e956abc8eb0c92fdb1","unresolved":true,"context_lines":[{"line_number":47,"context_line":"    def _get_host_port_from_promethus_conf(self, watcher_node_name):"},{"line_number":48,"context_line":"        prom_config_yaml \u003d yaml.safe_load("},{"line_number":49,"context_line":"            self.prometheus._get(\"status/config\")[\u0027data\u0027][\u0027yaml\u0027]"},{"line_number":50,"context_line":"        )"},{"line_number":51,"context_line":"        for scrape_config in prom_config_yaml[\u0027scrape_configs\u0027]:"},{"line_number":52,"context_line":"            for target in scrape_config[\u0027static_configs\u0027]:"},{"line_number":53,"context_line":"                for host_port in target[\u0027targets\u0027]:"}],"source_content_type":"text/x-python","patch_set":3,"id":"923299cb_813956d3","line":50,"updated":"2024-11-14 14:37:17.000000000","message":"* \u003e\u003e\u003e prometheus._get(\"label/instance/values\")\n{\u0027status\u0027: \u0027success\u0027, \u0027data\u0027: [\u002710.0.79.133:9100\u0027, \u0027localhost:9100\u0027]}","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"793ee5bdc42d272f17635ddcbfaf3e3e9afc9e85","unresolved":false,"context_lines":[{"line_number":47,"context_line":"    def _get_host_port_from_promethus_conf(self, watcher_node_name):"},{"line_number":48,"context_line":"        prom_config_yaml \u003d yaml.safe_load("},{"line_number":49,"context_line":"            self.prometheus._get(\"status/config\")[\u0027data\u0027][\u0027yaml\u0027]"},{"line_number":50,"context_line":"        )"},{"line_number":51,"context_line":"        for scrape_config in prom_config_yaml[\u0027scrape_configs\u0027]:"},{"line_number":52,"context_line":"            for target in scrape_config[\u0027static_configs\u0027]:"},{"line_number":53,"context_line":"                for host_port in target[\u0027targets\u0027]:"}],"source_content_type":"text/x-python","patch_set":3,"id":"caa221bf_a2d368b4","line":50,"in_reply_to":"923299cb_813956d3","updated":"2024-11-15 14:34:37.000000000","message":"Done","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"8f509655cde3a221f11ece3944c6e088c8ed03a9","unresolved":true,"context_lines":[{"line_number":59,"context_line":"            \"node %s. Prometheus returned the following config: %s\","},{"line_number":60,"context_line":"            watcher_node_name, prom_config_yaml"},{"line_number":61,"context_line":"        )"},{"line_number":62,"context_line":"        return None"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    def check_availability(self):"},{"line_number":65,"context_line":"        \"\"\"localhost:9090/api/v1/status/runtimeinfo to check status\"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"f0e4ffa5_280c4938","line":62,"updated":"2024-11-12 16:38:13.000000000","message":"this feels kind of over-complicated \n\nyou are doing a triple nested loop and this is not cached in any way so this will not scale.","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"793ee5bdc42d272f17635ddcbfaf3e3e9afc9e85","unresolved":false,"context_lines":[{"line_number":59,"context_line":"            \"node %s. Prometheus returned the following config: %s\","},{"line_number":60,"context_line":"            watcher_node_name, prom_config_yaml"},{"line_number":61,"context_line":"        )"},{"line_number":62,"context_line":"        return None"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    def check_availability(self):"},{"line_number":65,"context_line":"        \"\"\"localhost:9090/api/v1/status/runtimeinfo to check status\"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"ceeb78e8_42441470","line":62,"in_reply_to":"498328ed_f243cf3f","updated":"2024-11-15 14:34:37.000000000","message":"Done","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8878fb878fb536fcd4ea96c9a12bfa413bb61b01","unresolved":true,"context_lines":[{"line_number":59,"context_line":"            \"node %s. Prometheus returned the following config: %s\","},{"line_number":60,"context_line":"            watcher_node_name, prom_config_yaml"},{"line_number":61,"context_line":"        )"},{"line_number":62,"context_line":"        return None"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    def check_availability(self):"},{"line_number":65,"context_line":"        \"\"\"localhost:9090/api/v1/status/runtimeinfo to check status\"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"498328ed_f243cf3f","line":62,"in_reply_to":"f0e4ffa5_280c4938","updated":"2024-11-13 11:30:59.000000000","message":"the purpose of this is to try and determine the prometheus target \u0027label\u0027 by matching the watcher node \u0027hostname\u0027. I am not sure if this will work 100% as it relies that the hostname used by watcher (determined by nova i think there https://github.com/openstack/watcher/blob/4d5022ab94ce604cd362d9f50ea0ba7deb94d0f7/watcher/decision_engine/model/collector/nova.py#L405-L409 ... which i need to dig into some more) is going to match the label used by prometheus (which by can be IP or hostname, i guess depending on how the node_exporter is setup).\n\nSo lets discuss in the call in a bit.\n\nWRT the triple nested loop, yes, but it is not a nested request. The request is only happening once to _get(\"status/config\"). The nested loop is because the data looks like this:\n\n```\n res\u003dprometheus._get(\"status/config\")\n\u003e\u003e\u003e res\n{\u0027status\u0027: \u0027success\u0027, \u0027data\u0027: {\u0027yaml\u0027: \u0027global:\\n  scrape_interval: 15s\\n  scrape_timeout: 10s\\n  scrape_protocols:\\n  - OpenMetricsText1.0.0\\n  - OpenMetricsText0.0.1\\n  - PrometheusText0.0.4\\n  evaluation_interval: 1m\\nruntime:\\n  gogc: 75\\nscrape_configs:\\n- job_name: node\\n  honor_timestamps: true\\n  track_timestamps_staleness: false\\n  scrape_interval: 15s\\n  scrape_timeout: 10s\\n  scrape_protocols:\\n  - OpenMetricsText1.0.0\\n  - OpenMetricsText0.0.1\\n  - PrometheusText0.0.4\\n  metrics_path: /metrics\\n  scheme: http\\n  enable_compression: true\\n  follow_redirects: true\\n  enable_http2: true\\n  static_configs:\\n  - targets:\\n    - localhost:9100\\n\u0027}}\n\n\n        * \u003e\u003e\u003e some_yaml\u003dyaml.safe_load(res[\u0027data\u0027][\u0027yaml\u0027])\n\n        * \u003e\u003e\u003e some_yaml[\u0027scrape_configs\u0027][0]\n{\u0027job_name\u0027: \u0027node\u0027, \u0027honor_timestamps\u0027: True, \u0027track_timestamps_staleness\u0027: False, \u0027scrape_interval\u0027: \u002715s\u0027, \u0027scrape_timeout\u0027: \u002710s\u0027, \u0027scrape_protocols\u0027: [\u0027OpenMetricsText1.0.0\u0027, \u0027OpenMetricsText0.0.1\u0027, \u0027PrometheusText0.0.4\u0027], \u0027metrics_path\u0027: \u0027/metrics\u0027, \u0027scheme\u0027: \u0027http\u0027, \u0027enable_compression\u0027: True, \u0027follow_redirects\u0027: True, \u0027enable_http2\u0027: True, \u0027static_configs\u0027: [{\u0027targets\u0027: [\u0027localhost:9100\u0027]}]}\n\n        * \u003e\u003e\u003e some_yaml[\u0027scrape_configs\u0027][0][\u0027static_configs\u0027]\n[{\u0027targets\u0027: [\u0027localhost:9100\u0027]}]\n\n        * \u003e\u003e\u003e some_yaml[\u0027scrape_configs\u0027][0][\u0027static_configs\u0027][0][\u0027targets\u0027][0]\n\u0027localhost:9100\u0027\n\n\n```\n\nFirst lets discuss if this is the right approach for the matching (i.e. trying to take it from config). Perhaps there is a better way to determine that? Otherwise, if we are going this path then yeah probably we would need to wire it up a different way. Either with caching as you suggest, or rather than calling this on every statistic_aggregation invocation, we can move it to the class __init so it gets created when the helper does?)","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"8f509655cde3a221f11ece3944c6e088c8ed03a9","unresolved":true,"context_lines":[{"line_number":101,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":102,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":103,"context_line":"        if resource_type \u003d\u003d \u0027compute_node\u0027:"},{"line_number":104,"context_line":"            instance_label \u003d self._get_host_port_from_promethus_conf("},{"line_number":105,"context_line":"                resource.hostname)"},{"line_number":106,"context_line":"            if not instance_label:"},{"line_number":107,"context_line":"                LOG.error(\"Cannot query prometheus without instance label\")"},{"line_number":108,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":3,"id":"6c9c09c8_c79920fb","line":105,"range":{"start_line":104,"start_character":12,"end_line":105,"end_character":34},"updated":"2024-11-12 16:38:13.000000000","message":"this feels a little off to me \n\ninstance in thei query should be part of resource i think\n\nwhat we likely need to do is change the algorithm\n\ni have nto tried this yet but how i woudl approch this in general is as follows\n\nfirst create a cached dict of hostname to lables\n\nif the resouce.hostname is not in the dict  we need to compute it\nto do that we would choose a sentential value that will always expect to exist for a comptue nodes and it shoudl ideally have only one messure per host. maybe cpus count?\n\nwe need to list all messuer for that metic (giving use a list of all lables.\n\nwe loop over the lables callign sting.split(\u0027:\u0027) on each\nand populate the dict of hostname to comptue node lable.\n\n\nwe then retry the lookup in teh dict, if its not found the we log an error and raise an exepction.\n\nthat way we pay the cost of the lookup onece on the first query and we will auto heal if new nodes are added.\n\nsince the lable cache is only stored in a dict in memory it will be invlaidated on a restart of watcher.","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":false,"context_lines":[{"line_number":101,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":102,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":103,"context_line":"        if resource_type \u003d\u003d \u0027compute_node\u0027:"},{"line_number":104,"context_line":"            instance_label \u003d self._get_host_port_from_promethus_conf("},{"line_number":105,"context_line":"                resource.hostname)"},{"line_number":106,"context_line":"            if not instance_label:"},{"line_number":107,"context_line":"                LOG.error(\"Cannot query prometheus without instance label\")"},{"line_number":108,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":3,"id":"35d3c8c4_52ad1ce5","line":105,"range":{"start_line":104,"start_character":12,"end_line":105,"end_character":34},"in_reply_to":"43f2c8d4_b5248b45","updated":"2024-11-25 16:28:29.000000000","message":"Acknowledged","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8878fb878fb536fcd4ea96c9a12bfa413bb61b01","unresolved":true,"context_lines":[{"line_number":101,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":102,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":103,"context_line":"        if resource_type \u003d\u003d \u0027compute_node\u0027:"},{"line_number":104,"context_line":"            instance_label \u003d self._get_host_port_from_promethus_conf("},{"line_number":105,"context_line":"                resource.hostname)"},{"line_number":106,"context_line":"            if not instance_label:"},{"line_number":107,"context_line":"                LOG.error(\"Cannot query prometheus without instance label\")"},{"line_number":108,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":3,"id":"43f2c8d4_b5248b45","line":105,"range":{"start_line":104,"start_character":12,"end_line":105,"end_character":34},"in_reply_to":"6c9c09c8_c79920fb","updated":"2024-11-13 11:30:59.000000000","message":"lets discuss this in our sync in a few minutes \nthe hostname is the compute nodes hostname as known by watcher.\nthe label is the node_exporter label/instance/scrape target for prometheus, so we expect that each compute node will have node_exporter running on it, so for each there will be an entry in the prometheus config as a target (either by IP or hostname).","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"8f509655cde3a221f11ece3944c6e088c8ed03a9","unresolved":true,"context_lines":[{"line_number":107,"context_line":"                LOG.error(\"Cannot query prometheus without instance label\")"},{"line_number":108,"context_line":"                return"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"            if meter_name \u003d\u003d \"host_cpu_usage\":"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                query_args \u003d ("},{"line_number":113,"context_line":"                    \"100 - (%s by (instance)(rate(%s\""},{"line_number":114,"context_line":"                    \"{mode\u003d\u0027idle\u0027,instance\u003d\u0027%s\u0027}[%ss])) * 100)\" %"},{"line_number":115,"context_line":"                    (promql_aggregate, meter, instance_label, period)"},{"line_number":116,"context_line":"                )"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            elif meter_name \u003d\u003d \"host_ram_usage\":"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"                query_args \u003d ("},{"line_number":121,"context_line":"                    \"(node_memory_MemTotal_bytes{instance\u003d\u0027%s\u0027} \""},{"line_number":122,"context_line":"                    \" - %s_over_time(%s{instance\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":123,"context_line":"                    \" / 1024 / 1024\" %"},{"line_number":124,"context_line":"                    (instance_label, promql_aggregate, meter,"},{"line_number":125,"context_line":"                     instance_label, period)"},{"line_number":126,"context_line":"                )"},{"line_number":127,"context_line":"            else:"},{"line_number":128,"context_line":"                LOG.warning("},{"line_number":129,"context_line":"                    \"Prometheus data source does not currently support \""},{"line_number":130,"context_line":"                    \" meter %s\", meter_name"},{"line_number":131,"context_line":"                )"},{"line_number":132,"context_line":"                return"},{"line_number":133,"context_line":"        else:"},{"line_number":134,"context_line":"            LOG.warning("},{"line_number":135,"context_line":"                \"Prometheus data source does not currently support \""}],"source_content_type":"text/x-python","patch_set":3,"id":"32e408d2_c5f788ca","line":132,"range":{"start_line":110,"start_character":9,"end_line":132,"end_character":22},"updated":"2024-11-12 16:38:13.000000000","message":"this is also not great form a maintainability point of view.\n\nat a menium i woudl pull branch into a seperate function that requted the query arg string\n\nideally i would try an normalise the partmaeres into a context struct and replace the if else chain with a dict of meter_name -\u003e funciton\n\n\nim kind of disappointed that the observability client does not provide an api abstraction over this already but i would prefer to add more structure to this.\n\nthis will both make it simpler to test but also to reasonabout.\n\n\ne.g.\n```\n# this would be created on the instnace or as a class var.\nmetric_quereis \u003d { \n\"host_cpu_usage\": host_ram_usage_query,\n\"host_ram_usage\": host_ram_usage_query,\n}\n...\n\nquery_context \u003d ...\nquery_builder \u003d self.metric_quereis.get(meter_name)\nif query_builder is None:\n   LOG.warning(\n                    \"Prometheus data source does not currently support \"\n                    \" meter %s\", meter_name\n                )\n   return\nquery_args \u003d query_builder(query_context)\n\n```","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":107,"context_line":"                LOG.error(\"Cannot query prometheus without instance label\")"},{"line_number":108,"context_line":"                return"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"            if meter_name \u003d\u003d \"host_cpu_usage\":"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                query_args \u003d ("},{"line_number":113,"context_line":"                    \"100 - (%s by (instance)(rate(%s\""},{"line_number":114,"context_line":"                    \"{mode\u003d\u0027idle\u0027,instance\u003d\u0027%s\u0027}[%ss])) * 100)\" %"},{"line_number":115,"context_line":"                    (promql_aggregate, meter, instance_label, period)"},{"line_number":116,"context_line":"                )"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            elif meter_name \u003d\u003d \"host_ram_usage\":"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"                query_args \u003d ("},{"line_number":121,"context_line":"                    \"(node_memory_MemTotal_bytes{instance\u003d\u0027%s\u0027} \""},{"line_number":122,"context_line":"                    \" - %s_over_time(%s{instance\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":123,"context_line":"                    \" / 1024 / 1024\" %"},{"line_number":124,"context_line":"                    (instance_label, promql_aggregate, meter,"},{"line_number":125,"context_line":"                     instance_label, period)"},{"line_number":126,"context_line":"                )"},{"line_number":127,"context_line":"            else:"},{"line_number":128,"context_line":"                LOG.warning("},{"line_number":129,"context_line":"                    \"Prometheus data source does not currently support \""},{"line_number":130,"context_line":"                    \" meter %s\", meter_name"},{"line_number":131,"context_line":"                )"},{"line_number":132,"context_line":"                return"},{"line_number":133,"context_line":"        else:"},{"line_number":134,"context_line":"            LOG.warning("},{"line_number":135,"context_line":"                \"Prometheus data source does not currently support \""}],"source_content_type":"text/x-python","patch_set":3,"id":"21c8c92f_79387c9f","line":132,"range":{"start_line":110,"start_character":9,"end_line":132,"end_character":22},"in_reply_to":"199f0477_d2f4f73b","updated":"2024-11-14 18:55:14.000000000","message":"i guess we can harden this later.\n\nfor now, i see you have factored this out into its own method which helps with testing.\n\ni would still like to revisit one function per query later but this is the minimal change that helps testability so I\u0027m ok with that as a first step.","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"793ee5bdc42d272f17635ddcbfaf3e3e9afc9e85","unresolved":false,"context_lines":[{"line_number":107,"context_line":"                LOG.error(\"Cannot query prometheus without instance label\")"},{"line_number":108,"context_line":"                return"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"            if meter_name \u003d\u003d \"host_cpu_usage\":"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                query_args \u003d ("},{"line_number":113,"context_line":"                    \"100 - (%s by (instance)(rate(%s\""},{"line_number":114,"context_line":"                    \"{mode\u003d\u0027idle\u0027,instance\u003d\u0027%s\u0027}[%ss])) * 100)\" %"},{"line_number":115,"context_line":"                    (promql_aggregate, meter, instance_label, period)"},{"line_number":116,"context_line":"                )"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            elif meter_name \u003d\u003d \"host_ram_usage\":"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"                query_args \u003d ("},{"line_number":121,"context_line":"                    \"(node_memory_MemTotal_bytes{instance\u003d\u0027%s\u0027} \""},{"line_number":122,"context_line":"                    \" - %s_over_time(%s{instance\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":123,"context_line":"                    \" / 1024 / 1024\" %"},{"line_number":124,"context_line":"                    (instance_label, promql_aggregate, meter,"},{"line_number":125,"context_line":"                     instance_label, period)"},{"line_number":126,"context_line":"                )"},{"line_number":127,"context_line":"            else:"},{"line_number":128,"context_line":"                LOG.warning("},{"line_number":129,"context_line":"                    \"Prometheus data source does not currently support \""},{"line_number":130,"context_line":"                    \" meter %s\", meter_name"},{"line_number":131,"context_line":"                )"},{"line_number":132,"context_line":"                return"},{"line_number":133,"context_line":"        else:"},{"line_number":134,"context_line":"            LOG.warning("},{"line_number":135,"context_line":"                \"Prometheus data source does not currently support \""}],"source_content_type":"text/x-python","patch_set":3,"id":"51aea85c_a96f820d","line":132,"range":{"start_line":110,"start_character":9,"end_line":132,"end_character":22},"in_reply_to":"21c8c92f_79387c9f","updated":"2024-11-15 14:34:37.000000000","message":"Done","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8878fb878fb536fcd4ea96c9a12bfa413bb61b01","unresolved":true,"context_lines":[{"line_number":107,"context_line":"                LOG.error(\"Cannot query prometheus without instance label\")"},{"line_number":108,"context_line":"                return"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"            if meter_name \u003d\u003d \"host_cpu_usage\":"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"                query_args \u003d ("},{"line_number":113,"context_line":"                    \"100 - (%s by (instance)(rate(%s\""},{"line_number":114,"context_line":"                    \"{mode\u003d\u0027idle\u0027,instance\u003d\u0027%s\u0027}[%ss])) * 100)\" %"},{"line_number":115,"context_line":"                    (promql_aggregate, meter, instance_label, period)"},{"line_number":116,"context_line":"                )"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            elif meter_name \u003d\u003d \"host_ram_usage\":"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"                query_args \u003d ("},{"line_number":121,"context_line":"                    \"(node_memory_MemTotal_bytes{instance\u003d\u0027%s\u0027} \""},{"line_number":122,"context_line":"                    \" - %s_over_time(%s{instance\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":123,"context_line":"                    \" / 1024 / 1024\" %"},{"line_number":124,"context_line":"                    (instance_label, promql_aggregate, meter,"},{"line_number":125,"context_line":"                     instance_label, period)"},{"line_number":126,"context_line":"                )"},{"line_number":127,"context_line":"            else:"},{"line_number":128,"context_line":"                LOG.warning("},{"line_number":129,"context_line":"                    \"Prometheus data source does not currently support \""},{"line_number":130,"context_line":"                    \" meter %s\", meter_name"},{"line_number":131,"context_line":"                )"},{"line_number":132,"context_line":"                return"},{"line_number":133,"context_line":"        else:"},{"line_number":134,"context_line":"            LOG.warning("},{"line_number":135,"context_line":"                \"Prometheus data source does not currently support \""}],"source_content_type":"text/x-python","patch_set":3,"id":"199f0477_d2f4f73b","line":132,"range":{"start_line":110,"start_character":9,"end_line":132,"end_character":22},"in_reply_to":"32e408d2_c5f788ca","updated":"2024-11-13 11:30:59.000000000","message":"ack looks good let me try and work that in.\n\nhonestly this is what all the other data sources look like so i basically started coding \u0027as i saw them\u0027. i like your suggestion though this will make it neater.","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"4e8da4dd9cfa6d37790bf5f83595dd6e1ff91ad8","unresolved":true,"context_lines":[{"line_number":150,"context_line":"                         meter_name\u003dNone, start_time\u003dNone, end_time\u003dNone,"},{"line_number":151,"context_line":"                         granularity\u003d300):"},{"line_number":152,"context_line":"        raise NotImplementedError("},{"line_number":153,"context_line":"            _(\u0027Prometheus helper does not currently support statistic_series.\u0027"},{"line_number":154,"context_line":"              \u0027This can be considered for future enhancement.\u0027))"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def get_host_cpu_usage(self, resource, period\u003d300,"}],"source_content_type":"text/x-python","patch_set":3,"id":"bf2bd156_9ece74b9","line":153,"updated":"2024-11-13 11:45:01.000000000","message":"i actually want to revisit this too i think we can implement it with time start/end on the prom queries","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"a1abce8b8f39aa2ab7ca5682503e01aabda130da","unresolved":true,"context_lines":[{"line_number":150,"context_line":"                         meter_name\u003dNone, start_time\u003dNone, end_time\u003dNone,"},{"line_number":151,"context_line":"                         granularity\u003d300):"},{"line_number":152,"context_line":"        raise NotImplementedError("},{"line_number":153,"context_line":"            _(\u0027Prometheus helper does not currently support statistic_series.\u0027"},{"line_number":154,"context_line":"              \u0027This can be considered for future enhancement.\u0027))"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def get_host_cpu_usage(self, resource, period\u003d300,"}],"source_content_type":"text/x-python","patch_set":3,"id":"8af5516a_247fea7b","line":153,"in_reply_to":"12a7c312_58cb35cf","updated":"2024-11-20 08:52:47.000000000","message":"yeah  I think so and honestly I\u0027m not sure on the priority of it as mentioned to you a few days ago. I question the utility of historical data for a tool like watcher.\nthe statistic_aggregation should be enough I think (where we always start from time.now and go backwards for the specified period).","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":false,"context_lines":[{"line_number":150,"context_line":"                         meter_name\u003dNone, start_time\u003dNone, end_time\u003dNone,"},{"line_number":151,"context_line":"                         granularity\u003d300):"},{"line_number":152,"context_line":"        raise NotImplementedError("},{"line_number":153,"context_line":"            _(\u0027Prometheus helper does not currently support statistic_series.\u0027"},{"line_number":154,"context_line":"              \u0027This can be considered for future enhancement.\u0027))"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def get_host_cpu_usage(self, resource, period\u003d300,"}],"source_content_type":"text/x-python","patch_set":3,"id":"b39eafa8_47c0d450","line":153,"in_reply_to":"8af5516a_247fea7b","updated":"2024-11-25 16:28:29.000000000","message":"Acknowledged","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":150,"context_line":"                         meter_name\u003dNone, start_time\u003dNone, end_time\u003dNone,"},{"line_number":151,"context_line":"                         granularity\u003d300):"},{"line_number":152,"context_line":"        raise NotImplementedError("},{"line_number":153,"context_line":"            _(\u0027Prometheus helper does not currently support statistic_series.\u0027"},{"line_number":154,"context_line":"              \u0027This can be considered for future enhancement.\u0027))"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def get_host_cpu_usage(self, resource, period\u003d300,"}],"source_content_type":"text/x-python","patch_set":3,"id":"12a7c312_58cb35cf","line":153,"in_reply_to":"bf2bd156_9ece74b9","updated":"2024-11-14 18:55:14.000000000","message":"that could be in a follwo up pathch i guess.","commit_id":"a413d25491e1d658cf1fbbe9d946d46b1ff5bcc4"},{"author":{"_account_id":32968,"name":"Juan Larriba","email":"jlarriba@redhat.com","username":"jlarriba"},"change_message_id":"71ef4d362bb6ad2e5c9f8543efdf2c96ce8e31a6","unresolved":true,"context_lines":[{"line_number":32,"context_line":"                      host_inlet_temp\u003dNone,"},{"line_number":33,"context_line":"                      host_airflow\u003dNone,"},{"line_number":34,"context_line":"                      host_power\u003dNone,"},{"line_number":35,"context_line":"                      instance_cpu_usage\u003dNone,"},{"line_number":36,"context_line":"                      instance_ram_usage\u003dNone,"},{"line_number":37,"context_line":"                      instance_ram_allocated\u003dNone,"},{"line_number":38,"context_line":"                      instance_l3_cache_usage\u003dNone,"}],"source_content_type":"text/x-python","patch_set":4,"id":"2cd875e2_4a6ab5a9","line":35,"updated":"2024-11-15 11:34:53.000000000","message":"This kind of instance metrics are not used? We have them stored in Prometheus for each VM running on the cluster.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":true,"context_lines":[{"line_number":32,"context_line":"                      host_inlet_temp\u003dNone,"},{"line_number":33,"context_line":"                      host_airflow\u003dNone,"},{"line_number":34,"context_line":"                      host_power\u003dNone,"},{"line_number":35,"context_line":"                      instance_cpu_usage\u003dNone,"},{"line_number":36,"context_line":"                      instance_ram_usage\u003dNone,"},{"line_number":37,"context_line":"                      instance_ram_allocated\u003dNone,"},{"line_number":38,"context_line":"                      instance_l3_cache_usage\u003dNone,"}],"source_content_type":"text/x-python","patch_set":4,"id":"8f9cfb26_28e50980","line":35,"in_reply_to":"2cd875e2_4a6ab5a9","updated":"2024-11-15 14:33:35.000000000","message":"indeed my initial intent was to include the vms queries too but decided to focus on the host ones for v1. we sill expand and the vm ones are next.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":32968,"name":"Juan Larriba","email":"jlarriba@redhat.com","username":"jlarriba"},"change_message_id":"74f7baea8977532f1b55116c4241b069ff69d1ce","unresolved":false,"context_lines":[{"line_number":32,"context_line":"                      host_inlet_temp\u003dNone,"},{"line_number":33,"context_line":"                      host_airflow\u003dNone,"},{"line_number":34,"context_line":"                      host_power\u003dNone,"},{"line_number":35,"context_line":"                      instance_cpu_usage\u003dNone,"},{"line_number":36,"context_line":"                      instance_ram_usage\u003dNone,"},{"line_number":37,"context_line":"                      instance_ram_allocated\u003dNone,"},{"line_number":38,"context_line":"                      instance_l3_cache_usage\u003dNone,"}],"source_content_type":"text/x-python","patch_set":4,"id":"fe0727a3_42dd8e4b","line":35,"in_reply_to":"8f9cfb26_28e50980","updated":"2024-11-21 09:45:17.000000000","message":"Ok, that seems a good iterative approach.\n\nI have checked and we are currently providing even the speed of the fans and the temperature of the server, for when you need them.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ac7aae601aa614b0ae7343b9f063e67083a33c62","unresolved":true,"context_lines":[{"line_number":39,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":40,"context_line":"                      )"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    NODES_TO_LABELS \u003d dict()"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    def __init__(self):"},{"line_number":45,"context_line":"        self._host_port \u003d CONF.prometheus_client.prometheus_host_port"}],"source_content_type":"text/x-python","patch_set":4,"id":"eb2e186a_02f9ec6d","line":42,"updated":"2024-11-14 18:38:18.000000000","message":"unused delete this","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":39,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":40,"context_line":"                      )"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    NODES_TO_LABELS \u003d dict()"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    def __init__(self):"},{"line_number":45,"context_line":"        self._host_port \u003d CONF.prometheus_client.prometheus_host_port"}],"source_content_type":"text/x-python","patch_set":4,"id":"2cb0af9c_d403df4f","line":42,"range":{"start_line":42,"start_character":0,"end_line":42,"end_character":2},"updated":"2024-11-14 18:55:14.000000000","message":"we might want to make this an instance filed rather then a class filed but i have not looked at the lifetime of the helper yet.\n\nif we create the helper on every use then it should not be an instnace var\n\nif we carete it once at start up and reuse it then i think it shoudl be \n\nit will make testing this simpler in that context because it will prevent unitetional cross test shareing.\n\n----\nlater ok this seams to be unused so i guess it was replaced by computing the lable via self.prometheus_host_port_map ?","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":39,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":40,"context_line":"                      )"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    NODES_TO_LABELS \u003d dict()"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    def __init__(self):"},{"line_number":45,"context_line":"        self._host_port \u003d CONF.prometheus_client.prometheus_host_port"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa9be341_4c0c5379","line":42,"range":{"start_line":42,"start_character":0,"end_line":42,"end_character":2},"in_reply_to":"1166f7b6_04d82619","updated":"2024-11-15 14:33:35.000000000","message":"Done","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ab0a7a537ba824bd924d269935e141de91528451","unresolved":true,"context_lines":[{"line_number":39,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":40,"context_line":"                      )"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    NODES_TO_LABELS \u003d dict()"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    def __init__(self):"},{"line_number":45,"context_line":"        self._host_port \u003d CONF.prometheus_client.prometheus_host_port"}],"source_content_type":"text/x-python","patch_set":4,"id":"1166f7b6_04d82619","line":42,"range":{"start_line":42,"start_character":0,"end_line":42,"end_character":2},"in_reply_to":"2cb0af9c_d403df4f","updated":"2024-11-14 21:02:17.000000000","message":"yes sorry for the confusion on that one\n\nyou guessed right it is unused I need to remove it\n\ni added the comment but you must have started reviewing before i bit send\n\nthanks for your review time and sorry again","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":39,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":40,"context_line":"                      )"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    NODES_TO_LABELS \u003d dict()"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    def __init__(self):"},{"line_number":45,"context_line":"        self._host_port \u003d CONF.prometheus_client.prometheus_host_port"}],"source_content_type":"text/x-python","patch_set":4,"id":"01e1a7d0_d4076e80","line":42,"in_reply_to":"eb2e186a_02f9ec6d","updated":"2024-11-15 14:33:35.000000000","message":"Done","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":45,"context_line":"        self._host_port \u003d CONF.prometheus_client.prometheus_host_port"},{"line_number":46,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient("},{"line_number":47,"context_line":"            self._host_port)"},{"line_number":48,"context_line":"        self.prometheus_host_port_map \u003d self._build_prometheus_host_port_map()"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def _build_prometheus_host_port_map(self):"},{"line_number":51,"context_line":"        hostports \u003d self.prometheus._get(\"label/instance/values\")[\u0027data\u0027]"}],"source_content_type":"text/x-python","patch_set":4,"id":"f175a267_3fd85e45","line":48,"updated":"2024-11-14 18:55:14.000000000","message":"ack so we build this once on creation of the helper.\n\nso for the cachign to be useful that means we need to reuse the same instance of the helper.\n\nwhich would imply NODES_TO_LABELS should be on the instance too now a class field.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        self._host_port \u003d CONF.prometheus_client.prometheus_host_port"},{"line_number":46,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient("},{"line_number":47,"context_line":"            self._host_port)"},{"line_number":48,"context_line":"        self.prometheus_host_port_map \u003d self._build_prometheus_host_port_map()"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def _build_prometheus_host_port_map(self):"},{"line_number":51,"context_line":"        hostports \u003d self.prometheus._get(\"label/instance/values\")[\u0027data\u0027]"}],"source_content_type":"text/x-python","patch_set":4,"id":"a58fef4c_dea7937e","line":48,"in_reply_to":"7f971a06_3e7f1940","updated":"2024-11-15 14:33:35.000000000","message":"no not going to do this. i was thikning along the lines of \n\n    def _get_prometheus_host_port_map(self, refresh\u003dFalse):\n        if not self.prometheus_host_port_map or refresh:\n            self.prometheus_host_port_map \u003d self._build_prometheus_host_port_map()\n        return\n\n\nbut... not sure what use that will be. like how are we ever going to pass refresh\u003dTrue we\u0027d have to change the signature of the calling method (called from statistic_aggregation and we can\u0027t do that since we inherit from the base class.\n\nmarking resolved","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"9616fb34b08da603fad624b4e5d3448b37c8c07e","unresolved":true,"context_lines":[{"line_number":45,"context_line":"        self._host_port \u003d CONF.prometheus_client.prometheus_host_port"},{"line_number":46,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient("},{"line_number":47,"context_line":"            self._host_port)"},{"line_number":48,"context_line":"        self.prometheus_host_port_map \u003d self._build_prometheus_host_port_map()"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def _build_prometheus_host_port_map(self):"},{"line_number":51,"context_line":"        hostports \u003d self.prometheus._get(\"label/instance/values\")[\u0027data\u0027]"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f971a06_3e7f1940","line":48,"in_reply_to":"f175a267_3fd85e45","updated":"2024-11-15 11:22:36.000000000","message":"yesterday at some point i had this with a getter method.\n\nso it was initialised to {}\n\nthe get would return the map if it was initialised, otherwise call build.\n\ni might re-add that on next pass see what you think\n\n\n```\n        self.prometheus_host_port_map \u003d {}\n\n    def get_prometheus_host_port_map(self):\n        return prometheus_host_port_map if promtheus_host_port_map\n        else build, assign to self.prometheus_host_port_map and return it        \n```","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":51,"context_line":"        hostports \u003d self.prometheus._get(\"label/instance/values\")[\u0027data\u0027]"},{"line_number":52,"context_line":"        # TODO(marios): remove this comment"},{"line_number":53,"context_line":"        # hostports is like [\u002710.0.79.133:9100\u0027, \u0027localhost:9100\u0027]"},{"line_number":54,"context_line":"        _host_port_map \u003d {"},{"line_number":55,"context_line":"            host: port for (host, port) in ("},{"line_number":56,"context_line":"                hostport.split(\u0027:\u0027) for hostport in"},{"line_number":57,"context_line":"                hostports"}],"source_content_type":"text/x-python","patch_set":4,"id":"e434c269_c8ccab38","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":10},"updated":"2024-11-14 18:55:14.000000000","message":"why the `_` prefix?","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":51,"context_line":"        hostports \u003d self.prometheus._get(\"label/instance/values\")[\u0027data\u0027]"},{"line_number":52,"context_line":"        # TODO(marios): remove this comment"},{"line_number":53,"context_line":"        # hostports is like [\u002710.0.79.133:9100\u0027, \u0027localhost:9100\u0027]"},{"line_number":54,"context_line":"        _host_port_map \u003d {"},{"line_number":55,"context_line":"            host: port for (host, port) in ("},{"line_number":56,"context_line":"                hostport.split(\u0027:\u0027) for hostport in"},{"line_number":57,"context_line":"                hostports"}],"source_content_type":"text/x-python","patch_set":4,"id":"b1a875ae_cbf215b2","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":10},"in_reply_to":"0cdeea3d_c98a4090","updated":"2024-11-15 14:33:35.000000000","message":"Done","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"f9ad67fe8210a8a31c7f6a135f7bfe223166178f","unresolved":true,"context_lines":[{"line_number":51,"context_line":"        hostports \u003d self.prometheus._get(\"label/instance/values\")[\u0027data\u0027]"},{"line_number":52,"context_line":"        # TODO(marios): remove this comment"},{"line_number":53,"context_line":"        # hostports is like [\u002710.0.79.133:9100\u0027, \u0027localhost:9100\u0027]"},{"line_number":54,"context_line":"        _host_port_map \u003d {"},{"line_number":55,"context_line":"            host: port for (host, port) in ("},{"line_number":56,"context_line":"                hostport.split(\u0027:\u0027) for hostport in"},{"line_number":57,"context_line":"                hostports"}],"source_content_type":"text/x-python","patch_set":4,"id":"0cdeea3d_c98a4090","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":10},"in_reply_to":"e434c269_c8ccab38","updated":"2024-11-14 18:58:22.000000000","message":"no reason can will remove","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":64,"context_line":"            )"},{"line_number":65,"context_line":"        return _host_port_map"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    def _build_prometheus_query(self, aggregate, meter, instance_label,"},{"line_number":68,"context_line":"                                period):"},{"line_number":69,"context_line":"        \"\"\"Build and return the prometheus query string with the given args"},{"line_number":70,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"49c38f01_2d03ee2a","line":67,"range":{"start_line":67,"start_character":8,"end_line":67,"end_character":31},"updated":"2024-11-14 18:55:14.000000000","message":"ack, not quite what i asked for but it allows us to test the query generation form the rest of the other function so +1","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":64,"context_line":"            )"},{"line_number":65,"context_line":"        return _host_port_map"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    def _build_prometheus_query(self, aggregate, meter, instance_label,"},{"line_number":68,"context_line":"                                period):"},{"line_number":69,"context_line":"        \"\"\"Build and return the prometheus query string with the given args"},{"line_number":70,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"171c0fbd_4785274a","line":67,"range":{"start_line":67,"start_character":8,"end_line":67,"end_character":31},"in_reply_to":"49c38f01_2d03ee2a","updated":"2024-11-15 14:33:35.000000000","message":"Acknowledged","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":32968,"name":"Juan Larriba","email":"jlarriba@redhat.com","username":"jlarriba"},"change_message_id":"71ef4d362bb6ad2e5c9f8543efdf2c96ce8e31a6","unresolved":true,"context_lines":[{"line_number":72,"context_line":"        # prometheus.query(100 -"},{"line_number":73,"context_line":"        #      (avg by (instance)(rate(node_cpu_seconds_total"},{"line_number":74,"context_line":"        #      {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100)\")"},{"line_number":75,"context_line":"        # prometheus.query(\"(node_memory_MemTotal_bytes"},{"line_number":76,"context_line":"        #                   {instance\u003d\u0027localhost:9100\u0027} - avg_over_time("},{"line_number":77,"context_line":"        #                   node_memory_MemAvailable_bytes{"},{"line_number":78,"context_line":"        #                   instance\u003d\u0027localhost:9100\u0027}[300s])) / 1024 / 1024\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"047b611b_7727fe56","line":75,"updated":"2024-11-15 11:34:53.000000000","message":"This query returns the avg memory used in the node. Would not be more useful getting the used memory percentage to be able to take decisions?","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":true,"context_lines":[{"line_number":72,"context_line":"        # prometheus.query(100 -"},{"line_number":73,"context_line":"        #      (avg by (instance)(rate(node_cpu_seconds_total"},{"line_number":74,"context_line":"        #      {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100)\")"},{"line_number":75,"context_line":"        # prometheus.query(\"(node_memory_MemTotal_bytes"},{"line_number":76,"context_line":"        #                   {instance\u003d\u0027localhost:9100\u0027} - avg_over_time("},{"line_number":77,"context_line":"        #                   node_memory_MemAvailable_bytes{"},{"line_number":78,"context_line":"        #                   instance\u003d\u0027localhost:9100\u0027}[300s])) / 1024 / 1024\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"a6871762_13b42bd7","line":75,"in_reply_to":"047b611b_7727fe56","updated":"2024-11-15 14:33:35.000000000","message":"ack thanks this is exactly the kind of discussion i wanted to have with you\nlets discuss some more next week","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":72,"context_line":"        # prometheus.query(100 -"},{"line_number":73,"context_line":"        #      (avg by (instance)(rate(node_cpu_seconds_total"},{"line_number":74,"context_line":"        #      {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100)\")"},{"line_number":75,"context_line":"        # prometheus.query(\"(node_memory_MemTotal_bytes"},{"line_number":76,"context_line":"        #                   {instance\u003d\u0027localhost:9100\u0027} - avg_over_time("},{"line_number":77,"context_line":"        #                   node_memory_MemAvailable_bytes{"},{"line_number":78,"context_line":"        #                   instance\u003d\u0027localhost:9100\u0027}[300s])) / 1024 / 1024\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"b9222ac3_868fbba2","line":75,"in_reply_to":"2b0c0a0e_5e21541a","updated":"2024-11-25 16:28:29.000000000","message":"i think in general we will want ot track the absolute values not percentages\nbut as Mario notes it will depend on how the current stagies are coded.\n\n\nfor the exisitng code we need to provide the metrics with the same units they expect.\n\nwe could consider using aggregated/transformed values like percent_free ectra for new goals/strategies.\n\n\nwhen watcher started id did not have time series data sources so it had to compute the derived metrics form the absolute values. so we shoudl defer chaning that until we have the baseline enablement complete.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6a7339f3f170b5595fa356236c58184a3b1ff24a","unresolved":true,"context_lines":[{"line_number":72,"context_line":"        # prometheus.query(100 -"},{"line_number":73,"context_line":"        #      (avg by (instance)(rate(node_cpu_seconds_total"},{"line_number":74,"context_line":"        #      {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100)\")"},{"line_number":75,"context_line":"        # prometheus.query(\"(node_memory_MemTotal_bytes"},{"line_number":76,"context_line":"        #                   {instance\u003d\u0027localhost:9100\u0027} - avg_over_time("},{"line_number":77,"context_line":"        #                   node_memory_MemAvailable_bytes{"},{"line_number":78,"context_line":"        #                   instance\u003d\u0027localhost:9100\u0027}[300s])) / 1024 / 1024\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"2b0c0a0e_5e21541a","line":75,"in_reply_to":"a6871762_13b42bd7","updated":"2024-11-18 09:08:53.000000000","message":"this has to implement the DataSourceBase and for the memory query watcher expects the memory used in megabytes . For the cpu query it expects percentage but for memory it wants \u0027ram usage as float in megabytes\u0027 https://opendev.org/openstack/watcher/src/commit/4d5022ab94ce604cd362d9f50ea0ba7deb94d0f7/watcher/decision_engine/datasources/base.py#L167-L183","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        # prometheus.query(100 -"},{"line_number":73,"context_line":"        #      (avg by (instance)(rate(node_cpu_seconds_total"},{"line_number":74,"context_line":"        #      {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100)\")"},{"line_number":75,"context_line":"        # prometheus.query(\"(node_memory_MemTotal_bytes"},{"line_number":76,"context_line":"        #                   {instance\u003d\u0027localhost:9100\u0027} - avg_over_time("},{"line_number":77,"context_line":"        #                   node_memory_MemAvailable_bytes{"},{"line_number":78,"context_line":"        #                   instance\u003d\u0027localhost:9100\u0027}[300s])) / 1024 / 1024\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"143308a2_70461e29","line":75,"in_reply_to":"b9222ac3_868fbba2","updated":"2024-11-26 12:40:45.000000000","message":"Acknowledged","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":111,"context_line":"        \"\"\"localhost:9090/api/v1/status/runtimeinfo to check status\"\"\""},{"line_number":112,"context_line":"        \"\"\"prometheus_client._get raises PrometheusAPIClientError if not OK\"\"\""},{"line_number":113,"context_line":"        status \u003d self.prometheus._get(\"status/runtimeinfo\")"},{"line_number":114,"context_line":"        if status:"},{"line_number":115,"context_line":"            return \u0027available\u0027"},{"line_number":116,"context_line":"        else:"},{"line_number":117,"context_line":"            return \u0027not available\u0027"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def list_metrics(self):"},{"line_number":120,"context_line":"        \"\"\"All metrics localhost:9090/api/v1/label/__name__/values\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"4deef9fc_3c0f32e9","line":117,"range":{"start_line":114,"start_character":2,"end_line":117,"end_character":34},"updated":"2024-11-14 18:55:14.000000000","message":"this should be returing True or False\n\nhttps://github.com/openstack/watcher/blob/master/watcher/decision_engine/datasources/base.py#L111-L117\n\n\"\"\":return: True or False with true meaning the data source is available\"\"\"\n\nalthough looking at the ceilometer gnocchi and monsasca they are not following the docuemnted api contract.\n\nso this is an existing bug...\n\ncan we file one for this we can fix that separately\n\nthis is an internal api contract but not for a pluggable part of Watcher so we shoudl be able to just fix this in tree without breaking any external caller but that out of scope of this feature...","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"536c43dfbaa7e2115be3cb7762057c6a95f43072","unresolved":true,"context_lines":[{"line_number":111,"context_line":"        \"\"\"localhost:9090/api/v1/status/runtimeinfo to check status\"\"\""},{"line_number":112,"context_line":"        \"\"\"prometheus_client._get raises PrometheusAPIClientError if not OK\"\"\""},{"line_number":113,"context_line":"        status \u003d self.prometheus._get(\"status/runtimeinfo\")"},{"line_number":114,"context_line":"        if status:"},{"line_number":115,"context_line":"            return \u0027available\u0027"},{"line_number":116,"context_line":"        else:"},{"line_number":117,"context_line":"            return \u0027not available\u0027"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def list_metrics(self):"},{"line_number":120,"context_line":"        \"\"\"All metrics localhost:9090/api/v1/label/__name__/values\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"db110f94_08dfb85b","line":117,"range":{"start_line":114,"start_character":2,"end_line":117,"end_character":34},"in_reply_to":"4deef9fc_3c0f32e9","updated":"2024-11-15 10:59:08.000000000","message":"ack yeah i was following the others as you noted. ack i\u0027ll update to use True/False","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"203f971d9849ef0c23b1901f89ad5f3c9d829049","unresolved":true,"context_lines":[{"line_number":111,"context_line":"        \"\"\"localhost:9090/api/v1/status/runtimeinfo to check status\"\"\""},{"line_number":112,"context_line":"        \"\"\"prometheus_client._get raises PrometheusAPIClientError if not OK\"\"\""},{"line_number":113,"context_line":"        status \u003d self.prometheus._get(\"status/runtimeinfo\")"},{"line_number":114,"context_line":"        if status:"},{"line_number":115,"context_line":"            return \u0027available\u0027"},{"line_number":116,"context_line":"        else:"},{"line_number":117,"context_line":"            return \u0027not available\u0027"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def list_metrics(self):"},{"line_number":120,"context_line":"        \"\"\"All metrics localhost:9090/api/v1/label/__name__/values\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"dd508e88_ffe5f17b","line":117,"range":{"start_line":114,"start_character":2,"end_line":117,"end_character":34},"in_reply_to":"db110f94_08dfb85b","updated":"2024-11-15 13:11:28.000000000","message":"usign true/false will unfortunately break how this is being used.\n\nfor nwo keep the code as it is an we cna have a seperate patch to either update the docs stirng or fix all the datasouces and the usage.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        \"\"\"localhost:9090/api/v1/status/runtimeinfo to check status\"\"\""},{"line_number":112,"context_line":"        \"\"\"prometheus_client._get raises PrometheusAPIClientError if not OK\"\"\""},{"line_number":113,"context_line":"        status \u003d self.prometheus._get(\"status/runtimeinfo\")"},{"line_number":114,"context_line":"        if status:"},{"line_number":115,"context_line":"            return \u0027available\u0027"},{"line_number":116,"context_line":"        else:"},{"line_number":117,"context_line":"            return \u0027not available\u0027"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def list_metrics(self):"},{"line_number":120,"context_line":"        \"\"\"All metrics localhost:9090/api/v1/label/__name__/values\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"15a54274_4cd38001","line":117,"range":{"start_line":114,"start_character":2,"end_line":117,"end_character":34},"in_reply_to":"dd508e88_ffe5f17b","updated":"2024-11-15 14:33:35.000000000","message":"Acknowledged","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":122,"context_line":"        if not response:"},{"line_number":123,"context_line":"            return set()"},{"line_number":124,"context_line":"        else:"},{"line_number":125,"context_line":"            return set(response[\u0027data\u0027])"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":128,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9b055506_457e58e6","line":125,"updated":"2024-11-14 18:55:14.000000000","message":"... this is also ment to return a list not a set\n\nhttps://github.com/openstack/watcher/blob/4d5022ab94ce604cd362d9f50ea0ba7deb94d0f7/watcher/decision_engine/datasources/base.py#L107C4-L107C75\n\n\n     :return: List of supported metrics containing keys from METRIC_MAP\n     \nat somepoitn we shoudl tighten this up with mypy and type hints...\n\nthe classes that implement it all use sets so lets keep it consistent.\n\nThe Graphana backend does not implement this at all and the Monsasca one just passes so there are definitely bugs here that need to be addressed.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        if not response:"},{"line_number":123,"context_line":"            return set()"},{"line_number":124,"context_line":"        else:"},{"line_number":125,"context_line":"            return set(response[\u0027data\u0027])"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":128,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"}],"source_content_type":"text/x-python","patch_set":4,"id":"90f23d25_912f2c42","line":125,"in_reply_to":"0b1f1b2d_5e10e384","updated":"2024-11-15 14:33:35.000000000","message":"Acknowledged","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"203f971d9849ef0c23b1901f89ad5f3c9d829049","unresolved":true,"context_lines":[{"line_number":122,"context_line":"        if not response:"},{"line_number":123,"context_line":"            return set()"},{"line_number":124,"context_line":"        else:"},{"line_number":125,"context_line":"            return set(response[\u0027data\u0027])"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":128,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"}],"source_content_type":"text/x-python","patch_set":4,"id":"0b1f1b2d_5e10e384","line":125,"in_reply_to":"3c6a67d6_88f6b4b5","updated":"2024-11-15 13:11:28.000000000","message":"Yeah, my general point is that the implementation and the docs string don\u0027t match.\n\nim find wiht usign sets here\n\nwe just need to update the doc string to refect that in the base class.\n\nbut that is exisign tech debt so we shoudl adress that in a sperate commit.\n\nkeep with the set for now.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"536c43dfbaa7e2115be3cb7762057c6a95f43072","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        if not response:"},{"line_number":123,"context_line":"            return set()"},{"line_number":124,"context_line":"        else:"},{"line_number":125,"context_line":"            return set(response[\u0027data\u0027])"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":128,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"}],"source_content_type":"text/x-python","patch_set":4,"id":"3c6a67d6_88f6b4b5","line":125,"in_reply_to":"9b055506_457e58e6","updated":"2024-11-15 10:59:08.000000000","message":"sure so I guess set will just eliminate duplicates though there should not be any.\n\ni used set \"cos the others did that\" \n\ngnochi https://github.com/openstack/watcher/blob/4d5022ab94ce604cd362d9f50ea0ba7deb94d0f7/watcher/decision_engine/datasources/gnocchi.py#L65-L67 \n\nceilo https://github.com/openstack/watcher/blob/4d5022ab94ce604cd362d9f50ea0ba7deb94d0f7/watcher/decision_engine/datasources/ceilometer.py#L141-L143","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":132,"context_line":"        query_args \u003d \u0027\u0027"},{"line_number":133,"context_line":"        instance_label \u003d \u0027\u0027"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"        if aggregate \u003d\u003d \u0027mean\u0027:"},{"line_number":136,"context_line":"            promql_aggregate \u003d \u0027avg\u0027"},{"line_number":137,"context_line":"        elif aggregate \u003d\u003d \u0027max\u0027:"},{"line_number":138,"context_line":"            promql_aggregate \u003d \u0027min\u0027"},{"line_number":139,"context_line":"        elif aggregate \u003d\u003d \u0027min\u0027:"},{"line_number":140,"context_line":"            promql_aggregate \u003d \u0027max\u0027"},{"line_number":141,"context_line":"        elif aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":142,"context_line":"            promql_aggregate \u003d \u0027avg\u0027"},{"line_number":143,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":144,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":145,"context_line":"        if resource_type \u003d\u003d \u0027compute_node\u0027:"},{"line_number":146,"context_line":"            label_port \u003d self.prometheus_host_port_map[resource.hostname]"},{"line_number":147,"context_line":"            if not label_port:"}],"source_content_type":"text/x-python","patch_set":4,"id":"8ff21eec_7afac2f6","line":144,"range":{"start_line":135,"start_character":0,"end_line":144,"end_character":70},"updated":"2024-11-14 18:55:14.000000000","message":"nit:\n\ni guess this is ok.\nmy personal prefence is to minimise if else chains but this isnt too long.\n\nagain personall prefence but when you end an if elif else chain like this i like to add a blank line to easilly serpeate this for the next one.\n\nthis could also be factored out into a _translate_to_prom_aggregate function","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":132,"context_line":"        query_args \u003d \u0027\u0027"},{"line_number":133,"context_line":"        instance_label \u003d \u0027\u0027"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"        if aggregate \u003d\u003d \u0027mean\u0027:"},{"line_number":136,"context_line":"            promql_aggregate \u003d \u0027avg\u0027"},{"line_number":137,"context_line":"        elif aggregate \u003d\u003d \u0027max\u0027:"},{"line_number":138,"context_line":"            promql_aggregate \u003d \u0027min\u0027"},{"line_number":139,"context_line":"        elif aggregate \u003d\u003d \u0027min\u0027:"},{"line_number":140,"context_line":"            promql_aggregate \u003d \u0027max\u0027"},{"line_number":141,"context_line":"        elif aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":142,"context_line":"            promql_aggregate \u003d \u0027avg\u0027"},{"line_number":143,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":144,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":145,"context_line":"        if resource_type \u003d\u003d \u0027compute_node\u0027:"},{"line_number":146,"context_line":"            label_port \u003d self.prometheus_host_port_map[resource.hostname]"},{"line_number":147,"context_line":"            if not label_port:"}],"source_content_type":"text/x-python","patch_set":4,"id":"9e0242da_1931f070","line":144,"range":{"start_line":135,"start_character":0,"end_line":144,"end_character":70},"in_reply_to":"3e25af2e_1f316a8c","updated":"2024-11-15 14:33:35.000000000","message":"Done","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"2d0a7c3cc4e7297ee11d4f580b80ccd398c1125a","unresolved":true,"context_lines":[{"line_number":132,"context_line":"        query_args \u003d \u0027\u0027"},{"line_number":133,"context_line":"        instance_label \u003d \u0027\u0027"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"        if aggregate \u003d\u003d \u0027mean\u0027:"},{"line_number":136,"context_line":"            promql_aggregate \u003d \u0027avg\u0027"},{"line_number":137,"context_line":"        elif aggregate \u003d\u003d \u0027max\u0027:"},{"line_number":138,"context_line":"            promql_aggregate \u003d \u0027min\u0027"},{"line_number":139,"context_line":"        elif aggregate \u003d\u003d \u0027min\u0027:"},{"line_number":140,"context_line":"            promql_aggregate \u003d \u0027max\u0027"},{"line_number":141,"context_line":"        elif aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":142,"context_line":"            promql_aggregate \u003d \u0027avg\u0027"},{"line_number":143,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":144,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":145,"context_line":"        if resource_type \u003d\u003d \u0027compute_node\u0027:"},{"line_number":146,"context_line":"            label_port \u003d self.prometheus_host_port_map[resource.hostname]"},{"line_number":147,"context_line":"            if not label_port:"}],"source_content_type":"text/x-python","patch_set":4,"id":"3e25af2e_1f316a8c","line":144,"range":{"start_line":135,"start_character":0,"end_line":144,"end_character":70},"in_reply_to":"8ff21eec_7afac2f6","updated":"2024-11-14 21:05:05.000000000","message":"sure let me revisit this one too. something something make it a struct we lookup in like the host_port_map","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":147,"context_line":"            if not label_port:"},{"line_number":148,"context_line":"                LOG.error(\"Cannot query prometheus without instance label\""},{"line_number":149,"context_line":"                          \"Could not match %s \", resource.hostname)"},{"line_number":150,"context_line":"                return"},{"line_number":151,"context_line":"            instance_label \u003d \"%s:%s\" % (resource.hostname, label_port)"},{"line_number":152,"context_line":"        else:"},{"line_number":153,"context_line":"            LOG.warning("}],"source_content_type":"text/x-python","patch_set":4,"id":"e7da7631_f9f52261","line":150,"range":{"start_line":150,"start_character":16,"end_line":150,"end_character":22},"updated":"2024-11-14 18:55:14.000000000","message":"we should be consitent with `return` vs `return None`\n \n they are the same but it woudl be nice to be explict here and `return None`\n \n same below","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ca7f4e92d07e29cf13f58d5e1bc43fc718189224","unresolved":false,"context_lines":[{"line_number":147,"context_line":"            if not label_port:"},{"line_number":148,"context_line":"                LOG.error(\"Cannot query prometheus without instance label\""},{"line_number":149,"context_line":"                          \"Could not match %s \", resource.hostname)"},{"line_number":150,"context_line":"                return"},{"line_number":151,"context_line":"            instance_label \u003d \"%s:%s\" % (resource.hostname, label_port)"},{"line_number":152,"context_line":"        else:"},{"line_number":153,"context_line":"            LOG.warning("}],"source_content_type":"text/x-python","patch_set":4,"id":"13011b00_c35bb35b","line":150,"range":{"start_line":150,"start_character":16,"end_line":150,"end_character":22},"in_reply_to":"e7da7631_f9f52261","updated":"2024-11-15 14:33:35.000000000","message":"Acknowledged","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d16eea42971dcbfb6b69e9e389b2b03e7a1ceaa6","unresolved":true,"context_lines":[{"line_number":179,"context_line":"            _(\u0027Prometheus helper does not currently support statistic_series.\u0027"},{"line_number":180,"context_line":"              \u0027This can be considered for future enhancement.\u0027))"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"    def get_host_cpu_usage(self, resource, period\u003d300,"},{"line_number":183,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":184,"context_line":"        return self.statistic_aggregation("},{"line_number":185,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, period, aggregate,"}],"source_content_type":"text/x-python","patch_set":4,"id":"c42b8ad6_1b4a6db4","line":182,"updated":"2024-11-14 18:55:14.000000000","message":"by the way the base datasocue class has abstract methods decorators on functions lik ehtis\n\n\nhttps://github.com/openstack/watcher/blob/master/watcher/decision_engine/datasources/base.py#L166-L174\n\nbut the base class itself is not declared abstract...\nhttps://github.com/openstack/watcher/blob/master/watcher/decision_engine/datasources/base.py#L28\n\nit does not inherit from https://docs.python.org/3/library/abc.html#abc.ABC\nor use ABCMeta\n\nso the @abstractmethod isnt actully enforcing anything...\nhttps://docs.python.org/3/library/abc.html#abc.abstractmethod\n\nso that is yet another bug.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":false,"context_lines":[{"line_number":179,"context_line":"            _(\u0027Prometheus helper does not currently support statistic_series.\u0027"},{"line_number":180,"context_line":"              \u0027This can be considered for future enhancement.\u0027))"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"    def get_host_cpu_usage(self, resource, period\u003d300,"},{"line_number":183,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":184,"context_line":"        return self.statistic_aggregation("},{"line_number":185,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, period, aggregate,"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a850f29_c4d584ca","line":182,"in_reply_to":"c42b8ad6_1b4a6db4","updated":"2024-11-25 16:28:29.000000000","message":"I filed a bug for this so we can ignore this comment for now.","commit_id":"545571af006f7201fa621217500cf33a4b2551df"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"5bd2fba4568b23ee696a209e2a70e198c179d647","unresolved":true,"context_lines":[{"line_number":46,"context_line":"            self._host_port)"},{"line_number":47,"context_line":"        self.prometheus_host_port_map \u003d self._build_prometheus_host_port_map()"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    def _get_prometheus_host_port_map(self, refresh\u003dFalse):"},{"line_number":50,"context_line":"        if not self.prometheus_host_port_map or refresh:"},{"line_number":51,"context_line":"            self.prometheus_host_port_map \u003d ("},{"line_number":52,"context_line":"                self._build_prometheus_host_port_map())"}],"source_content_type":"text/x-python","patch_set":5,"id":"9cef0ed0_fb3a36ff","line":49,"updated":"2024-11-18 11:03:35.000000000","message":"remove this","commit_id":"d5c6471902561fbc7abd41ce017ae59d4be7980a"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"da0320a66214239a5c4bc8a5cae81285af16e41e","unresolved":false,"context_lines":[{"line_number":46,"context_line":"            self._host_port)"},{"line_number":47,"context_line":"        self.prometheus_host_port_map \u003d self._build_prometheus_host_port_map()"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    def _get_prometheus_host_port_map(self, refresh\u003dFalse):"},{"line_number":50,"context_line":"        if not self.prometheus_host_port_map or refresh:"},{"line_number":51,"context_line":"            self.prometheus_host_port_map \u003d ("},{"line_number":52,"context_line":"                self._build_prometheus_host_port_map())"}],"source_content_type":"text/x-python","patch_set":5,"id":"1a90d5b9_c6ea6094","line":49,"in_reply_to":"9cef0ed0_fb3a36ff","updated":"2024-11-18 16:40:46.000000000","message":"Done","commit_id":"d5c6471902561fbc7abd41ce017ae59d4be7980a"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6a7339f3f170b5595fa356236c58184a3b1ff24a","unresolved":true,"context_lines":[{"line_number":55,"context_line":"    def _build_prometheus_host_port_map(self):"},{"line_number":56,"context_line":"        hostports \u003d self.prometheus._get(\"label/instance/values\")[\u0027data\u0027]"},{"line_number":57,"context_line":"        # TODO(marios): remove this comment"},{"line_number":58,"context_line":"        # hostports is like [\u002710.0.79.133:9100\u0027, \u0027localhost:9100\u0027]"},{"line_number":59,"context_line":"        host_port_map \u003d {"},{"line_number":60,"context_line":"            host: port for (host, port) in ("},{"line_number":61,"context_line":"                hostport.split(\u0027:\u0027) for hostport in"}],"source_content_type":"text/x-python","patch_set":5,"id":"2846613b_c499ee1a","line":58,"updated":"2024-11-18 09:08:53.000000000","message":"@jlarriba@redhat.com one thing I\u0027d like to discuss and agree on is the assumption made here. I am relying on using the prometheus config to get the label instances that I can use in my queries. For example, for the following prom config:\n\n```\nstack@marios-env-again:~$ cat prometheus_config.yml \nglobal:\n  scrape_interval: 15s\n\nscrape_configs:\n  - job_name: node\n    static_configs:\n    - targets: [\u0027localhost:9100\u0027]\n      labels:\n        mylabel: \"afoo\"\n    - targets: [\u002710.0.79.133:9100\u0027]\n      labels:\n        mylabel: \"abar\"\n```\n\n\nwatcher maintains the hostname for compute nodes. In queries, like the ones we make with statistic_aggregation method below, there is a \u0027node\u0027 specified against which we should make the queries. I try to match the (watcher) node.hostname against one of the labels ^^^ that is configured in prmetheus conf.","commit_id":"d5c6471902561fbc7abd41ce017ae59d4be7980a"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"da0320a66214239a5c4bc8a5cae81285af16e41e","unresolved":true,"context_lines":[{"line_number":55,"context_line":"    def _build_prometheus_host_port_map(self):"},{"line_number":56,"context_line":"        hostports \u003d self.prometheus._get(\"label/instance/values\")[\u0027data\u0027]"},{"line_number":57,"context_line":"        # TODO(marios): remove this comment"},{"line_number":58,"context_line":"        # hostports is like [\u002710.0.79.133:9100\u0027, \u0027localhost:9100\u0027]"},{"line_number":59,"context_line":"        host_port_map \u003d {"},{"line_number":60,"context_line":"            host: port for (host, port) in ("},{"line_number":61,"context_line":"                hostport.split(\u0027:\u0027) for hostport in"}],"source_content_type":"text/x-python","patch_set":5,"id":"ae1d1407_c1f59f85","line":58,"in_reply_to":"2846613b_c499ee1a","updated":"2024-11-18 16:40:46.000000000","message":"adding info for others, the prometheus scrape configs currently looks like (example) https://logserver.rdoproject.org/27/527/5130e45b6230032820ce2a9dc211e19ce8d85f93/github-check/functional-metric-verification-tests-osp18/06c8093/controller/ci-framework-data/logs/openstack-k8s-operators-openstack-must-gather/namespaces/openstack/crs/scrapeconfigs.monitoring.rhobs/telemetry-node-exporter-tls.yaml\n\nso we get a hostname there in labels:\n\n```\n  staticConfigs:\n  - labels:\n      hostname: compute-0\n    targets:\n    - 192.168.122.100:9100\n```\n\nWe can use the hostname to match, but even better if we can get the fqdn. Juan is going to work on adding the fqdn there.","commit_id":"d5c6471902561fbc7abd41ce017ae59d4be7980a"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":false,"context_lines":[{"line_number":55,"context_line":"    def _build_prometheus_host_port_map(self):"},{"line_number":56,"context_line":"        hostports \u003d self.prometheus._get(\"label/instance/values\")[\u0027data\u0027]"},{"line_number":57,"context_line":"        # TODO(marios): remove this comment"},{"line_number":58,"context_line":"        # hostports is like [\u002710.0.79.133:9100\u0027, \u0027localhost:9100\u0027]"},{"line_number":59,"context_line":"        host_port_map \u003d {"},{"line_number":60,"context_line":"            host: port for (host, port) in ("},{"line_number":61,"context_line":"                hostport.split(\u0027:\u0027) for hostport in"}],"source_content_type":"text/x-python","patch_set":5,"id":"5bc67894_d8ffc837","line":58,"in_reply_to":"ae1d1407_c1f59f85","updated":"2024-11-25 16:28:29.000000000","message":"Acknowledged","commit_id":"d5c6471902561fbc7abd41ce017ae59d4be7980a"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"0eb5ced1f3cd1da3a8302ebe36dce7f3479f3c88","unresolved":true,"context_lines":[{"line_number":36,"context_line":"                      host_outlet_temp\u003dNone,"},{"line_number":37,"context_line":"                      host_inlet_temp\u003dNone,"},{"line_number":38,"context_line":"                      host_airflow\u003dNone,"},{"line_number":39,"context_line":"                      host_power\u003dNone,"},{"line_number":40,"context_line":"                      instance_cpu_usage\u003dNone,"},{"line_number":41,"context_line":"                      instance_ram_usage\u003dNone,"},{"line_number":42,"context_line":"                      instance_ram_allocated\u003dNone,"}],"source_content_type":"text/x-python","patch_set":6,"id":"d60c9e21_c92edc9a","line":39,"range":{"start_line":39,"start_character":22,"end_line":39,"end_character":32},"updated":"2024-11-19 10:47:33.000000000","message":"also kepler is another prometheus collector\n(discussing with Juan Larriba in a call now. also kepler needs baremetal so we can\u0027t test in devstack/vms env)","commit_id":"2d712ad9efaeaa614bf1f4c3272730e3b83e6c98"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":36,"context_line":"                      host_outlet_temp\u003dNone,"},{"line_number":37,"context_line":"                      host_inlet_temp\u003dNone,"},{"line_number":38,"context_line":"                      host_airflow\u003dNone,"},{"line_number":39,"context_line":"                      host_power\u003dNone,"},{"line_number":40,"context_line":"                      instance_cpu_usage\u003dNone,"},{"line_number":41,"context_line":"                      instance_ram_usage\u003dNone,"},{"line_number":42,"context_line":"                      instance_ram_allocated\u003dNone,"}],"source_content_type":"text/x-python","patch_set":6,"id":"c60919cb_fc2828c5","line":39,"range":{"start_line":39,"start_character":22,"end_line":39,"end_character":32},"in_reply_to":"d60c9e21_c92edc9a","updated":"2024-11-26 12:40:45.000000000","message":"Acknowledged we will iterate to add further metrics including kepler","commit_id":"2d712ad9efaeaa614bf1f4c3272730e3b83e6c98"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"341c3cbb7d05e3dc258a2160fbecf42b2c5a4f06","unresolved":true,"context_lines":[{"line_number":78,"context_line":"        # TODO(marios): remove this comment"},{"line_number":79,"context_line":"        # \u003e\u003e\u003e instance_labels[0][\u0027labels\u0027]"},{"line_number":80,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":81,"context_line":"        #  \u0027hostname\u0027: \u0027marios-env-again\u0027, \u0027instance\u0027: \u0027localhost:9100\u0027,"},{"line_number":82,"context_line":"        #  \u0027job\u0027: \u0027node\u0027}"},{"line_number":83,"context_line":"        host_instance_map \u003d {"},{"line_number":84,"context_line":"            host: instance for (host, instance) in ("}],"source_content_type":"text/x-python","patch_set":7,"id":"d4299ddf_564ef3ba","line":81,"updated":"2024-11-20 07:51:19.000000000","message":"actually hostname was removed and we only get fqdn now.\nwe need to do some processing here to deal with watcher having hostname and not fqdn for each node.\n\nwe could keep a parallel/duplicate map like hostname_instance_map and fqdn_instance_map \n\nwe can extract hostname from the fqdn.","commit_id":"11d000f63659e7bbf9d5d30b12e89ff2c538a495"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        # TODO(marios): remove this comment"},{"line_number":79,"context_line":"        # \u003e\u003e\u003e instance_labels[0][\u0027labels\u0027]"},{"line_number":80,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":81,"context_line":"        #  \u0027hostname\u0027: \u0027marios-env-again\u0027, \u0027instance\u0027: \u0027localhost:9100\u0027,"},{"line_number":82,"context_line":"        #  \u0027job\u0027: \u0027node\u0027}"},{"line_number":83,"context_line":"        host_instance_map \u003d {"},{"line_number":84,"context_line":"            host: instance for (host, instance) in ("}],"source_content_type":"text/x-python","patch_set":7,"id":"e1ed6705_3b61a8d4","line":81,"in_reply_to":"cb0b5635_9d784515","updated":"2024-11-26 12:40:45.000000000","message":"Acknowledged","commit_id":"11d000f63659e7bbf9d5d30b12e89ff2c538a495"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":78,"context_line":"        # TODO(marios): remove this comment"},{"line_number":79,"context_line":"        # \u003e\u003e\u003e instance_labels[0][\u0027labels\u0027]"},{"line_number":80,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":81,"context_line":"        #  \u0027hostname\u0027: \u0027marios-env-again\u0027, \u0027instance\u0027: \u0027localhost:9100\u0027,"},{"line_number":82,"context_line":"        #  \u0027job\u0027: \u0027node\u0027}"},{"line_number":83,"context_line":"        host_instance_map \u003d {"},{"line_number":84,"context_line":"            host: instance for (host, instance) in ("}],"source_content_type":"text/x-python","patch_set":7,"id":"cb0b5635_9d784515","line":81,"in_reply_to":"cfd2ecab_b706cc4f","updated":"2024-11-25 16:28:29.000000000","message":"so there is no requriements for FQDN anywhere in openstack.\n\ntripleo and our new operator isntaller uses them but in generall we cant assume that there is an fqdn.\n\nwe can add supprot for both but we always need to supprot the host/hypervior_hostname not being an fqdn.","commit_id":"11d000f63659e7bbf9d5d30b12e89ff2c538a495"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"587f4ed3a500be388437fbb99c0e01476738f59c","unresolved":true,"context_lines":[{"line_number":78,"context_line":"        # TODO(marios): remove this comment"},{"line_number":79,"context_line":"        # \u003e\u003e\u003e instance_labels[0][\u0027labels\u0027]"},{"line_number":80,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":81,"context_line":"        #  \u0027hostname\u0027: \u0027marios-env-again\u0027, \u0027instance\u0027: \u0027localhost:9100\u0027,"},{"line_number":82,"context_line":"        #  \u0027job\u0027: \u0027node\u0027}"},{"line_number":83,"context_line":"        host_instance_map \u003d {"},{"line_number":84,"context_line":"            host: instance for (host, instance) in ("}],"source_content_type":"text/x-python","patch_set":7,"id":"cfd2ecab_b706cc4f","line":81,"in_reply_to":"d4299ddf_564ef3ba","updated":"2024-11-20 10:02:44.000000000","message":"so no... for now I think we need to assume that watcher will have hostname and doesn\u0027t know anything about fqdn (we can propose to add that later, maybe)\n\ni think i\u0027ll use the fqdn to extract the hostname and store that in the host_name_map.\n\nas a future improvement and if acceptable, we can add fqdn to the watcher node model and switch this code to use fqdn. thoughts @smooney@redhat.com ?","commit_id":"11d000f63659e7bbf9d5d30b12e89ff2c538a495"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"64ea7245678f5ef9ef411d372f6b3ef1789cd804","unresolved":true,"context_lines":[{"line_number":85,"context_line":"                 target[\u0027labels\u0027].get(\u0027instance\u0027))"},{"line_number":86,"context_line":"                for target in prometheus_targets"},{"line_number":87,"context_line":"                if target.get(\u0027labels\u0027) and target.get(\u0027labels\u0027).get(\u0027fqdn\u0027)"},{"line_number":88,"context_line":"            )"},{"line_number":89,"context_line":"        }"},{"line_number":90,"context_line":"        if not host_instance_map:"},{"line_number":91,"context_line":"            LOG.error("}],"source_content_type":"text/x-python","patch_set":9,"id":"27330ca7_6edba83c","line":88,"updated":"2024-11-20 12:55:38.000000000","message":"we need to deal with both \n\nhostname\u003c-\u003e instance\nfqdn\u003c-\u003einstance\n\nmaybe ips but we can expand if needed","commit_id":"48bf1a5f8457c599bdfb7d515536f7aa4c12b5f9"},{"author":{"_account_id":32968,"name":"Juan Larriba","email":"jlarriba@redhat.com","username":"jlarriba"},"change_message_id":"74f7baea8977532f1b55116c4241b069ff69d1ce","unresolved":true,"context_lines":[{"line_number":85,"context_line":"                 target[\u0027labels\u0027].get(\u0027instance\u0027))"},{"line_number":86,"context_line":"                for target in prometheus_targets"},{"line_number":87,"context_line":"                if target.get(\u0027labels\u0027) and target.get(\u0027labels\u0027).get(\u0027fqdn\u0027)"},{"line_number":88,"context_line":"            )"},{"line_number":89,"context_line":"        }"},{"line_number":90,"context_line":"        if not host_instance_map:"},{"line_number":91,"context_line":"            LOG.error("}],"source_content_type":"text/x-python","patch_set":9,"id":"5c828be5_6b124b0c","line":88,"in_reply_to":"27330ca7_6edba83c","updated":"2024-11-21 09:45:17.000000000","message":"I am little bit confused by this piece of code. We used to put the hostname in there and that was deemed not enough, so we modified it to include the full fqdn. And at the end, it seems that only the hostname was needed, and the rest of the fqdn is never used.\n\nIs the hostname the only thing you actually needed?","commit_id":"48bf1a5f8457c599bdfb7d515536f7aa4c12b5f9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"0c90bdbae663b59e83f3affc9e47562883d2cdb8","unresolved":true,"context_lines":[{"line_number":85,"context_line":"                 target[\u0027labels\u0027].get(\u0027instance\u0027))"},{"line_number":86,"context_line":"                for target in prometheus_targets"},{"line_number":87,"context_line":"                if target.get(\u0027labels\u0027) and target.get(\u0027labels\u0027).get(\u0027fqdn\u0027)"},{"line_number":88,"context_line":"            )"},{"line_number":89,"context_line":"        }"},{"line_number":90,"context_line":"        if not host_instance_map:"},{"line_number":91,"context_line":"            LOG.error("}],"source_content_type":"text/x-python","patch_set":9,"id":"b3077dad_0a23d861","line":88,"in_reply_to":"5c828be5_6b124b0c","updated":"2024-11-21 10:11:23.000000000","message":"We need both Juan so adding the fqdn was needed. we will have to deal with both fqdn and hostname (in future maybe also IP) for identifying nodes on the watcher side. \n\nSo yes we need prometheus to label with fqdn and we use that to match both fqdn or hostname depending on how watcher is configured.","commit_id":"48bf1a5f8457c599bdfb7d515536f7aa4c12b5f9"},{"author":{"_account_id":32968,"name":"Juan Larriba","email":"jlarriba@redhat.com","username":"jlarriba"},"change_message_id":"26fb8653b252e1dbccb79cd1b3bc0522cece6981","unresolved":false,"context_lines":[{"line_number":85,"context_line":"                 target[\u0027labels\u0027].get(\u0027instance\u0027))"},{"line_number":86,"context_line":"                for target in prometheus_targets"},{"line_number":87,"context_line":"                if target.get(\u0027labels\u0027) and target.get(\u0027labels\u0027).get(\u0027fqdn\u0027)"},{"line_number":88,"context_line":"            )"},{"line_number":89,"context_line":"        }"},{"line_number":90,"context_line":"        if not host_instance_map:"},{"line_number":91,"context_line":"            LOG.error("}],"source_content_type":"text/x-python","patch_set":9,"id":"738e0b87_8a966367","line":88,"in_reply_to":"b3077dad_0a23d861","updated":"2024-11-21 10:14:51.000000000","message":"Understood, thank you for the explanation Marios!","commit_id":"48bf1a5f8457c599bdfb7d515536f7aa4c12b5f9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"ef4c3b6812f846d464dab0565ceb0351c33eadf5","unresolved":true,"context_lines":[{"line_number":99,"context_line":"            )"},{"line_number":100,"context_line":"            return None"},{"line_number":101,"context_line":"        return fqdn_instance_map"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def _build_prometheus_host_instance_map(self):"},{"line_number":104,"context_line":"        \"\"\"Build the hostname\u003c--\u003einstance_label mapping needed for queries"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"d2cf6914_d131bef2","line":102,"updated":"2024-11-21 13:51:12.000000000","message":"thinking about this some more... the assumption on the prometheus exporter can be softened by making it configurable\n\nwe can default expect \u0027fqdn\u0027 but provide a config option to set this to something else if you so wish (like if you have \u0027host\u0027 or \u0027hostname\u0027 or any other label you are using).\n\nthere would still be a requirement for A label that would match watcher node.host but you can configure what that label is.\n\nwdyt @smooney@redhat.com ?","commit_id":"3f261deba42b3cf11984f13bf9cd922c8fc7e989"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"079b40687709bf8f5999482f59012e5e8964931d","unresolved":true,"context_lines":[{"line_number":99,"context_line":"            )"},{"line_number":100,"context_line":"            return None"},{"line_number":101,"context_line":"        return fqdn_instance_map"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def _build_prometheus_host_instance_map(self):"},{"line_number":104,"context_line":"        \"\"\"Build the hostname\u003c--\u003einstance_label mapping needed for queries"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"a0418f2e_5e014c76","line":102,"in_reply_to":"16f4490e_8d027575","updated":"2024-11-25 16:47:33.000000000","message":"unmarking resolved since I pointed to this in my request for reviews today, will re-mark resolved sool","commit_id":"3f261deba42b3cf11984f13bf9cd922c8fc7e989"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":99,"context_line":"            )"},{"line_number":100,"context_line":"            return None"},{"line_number":101,"context_line":"        return fqdn_instance_map"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def _build_prometheus_host_instance_map(self):"},{"line_number":104,"context_line":"        \"\"\"Build the hostname\u003c--\u003einstance_label mapping needed for queries"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"51c85fcd_8f180124","line":102,"in_reply_to":"3d355747_35b165fa","updated":"2024-11-26 12:40:45.000000000","message":"Done","commit_id":"3f261deba42b3cf11984f13bf9cd922c8fc7e989"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"60327ac8f558e1b4d721d52433883b95e68441e6","unresolved":true,"context_lines":[{"line_number":99,"context_line":"            )"},{"line_number":100,"context_line":"            return None"},{"line_number":101,"context_line":"        return fqdn_instance_map"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def _build_prometheus_host_instance_map(self):"},{"line_number":104,"context_line":"        \"\"\"Build the hostname\u003c--\u003einstance_label mapping needed for queries"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"3d355747_35b165fa","line":102,"in_reply_to":"a0418f2e_5e014c76","updated":"2024-11-25 16:48:27.000000000","message":"(soon)","commit_id":"3f261deba42b3cf11984f13bf9cd922c8fc7e989"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":false,"context_lines":[{"line_number":99,"context_line":"            )"},{"line_number":100,"context_line":"            return None"},{"line_number":101,"context_line":"        return fqdn_instance_map"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def _build_prometheus_host_instance_map(self):"},{"line_number":104,"context_line":"        \"\"\"Build the hostname\u003c--\u003einstance_label mapping needed for queries"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"16f4490e_8d027575","line":102,"in_reply_to":"d0fb2a23_cc9b2973","updated":"2024-11-25 16:28:29.000000000","message":"Done","commit_id":"3f261deba42b3cf11984f13bf9cd922c8fc7e989"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"f8e1df47eadcb612d1f2035d209812fadd2489ab","unresolved":true,"context_lines":[{"line_number":99,"context_line":"            )"},{"line_number":100,"context_line":"            return None"},{"line_number":101,"context_line":"        return fqdn_instance_map"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def _build_prometheus_host_instance_map(self):"},{"line_number":104,"context_line":"        \"\"\"Build the hostname\u003c--\u003einstance_label mapping needed for queries"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"d0fb2a23_cc9b2973","line":102,"in_reply_to":"d2cf6914_d131bef2","updated":"2024-11-22 14:22:24.000000000","message":"i implemented this in v11","commit_id":"3f261deba42b3cf11984f13bf9cd922c8fc7e989"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"d67cc8f19764adfc2d815a09c392e605be2d1ecf","unresolved":true,"context_lines":[{"line_number":100,"context_line":"                (target[\u0027labels\u0027].get(self.prometheus_fqdn_label),"},{"line_number":101,"context_line":"                 target[\u0027labels\u0027].get(\u0027instance\u0027))"},{"line_number":102,"context_line":"                for target in prometheus_targets"},{"line_number":103,"context_line":"                if target.get(\u0027labels\u0027) and"},{"line_number":104,"context_line":"                target.get(\u0027labels\u0027).get(self.prometheus_fqdn_label)"},{"line_number":105,"context_line":"            )"},{"line_number":106,"context_line":"        }"},{"line_number":107,"context_line":"        if not fqdn_instance_map:"}],"source_content_type":"text/x-python","patch_set":12,"id":"f07322ca_a2260b58","line":104,"range":{"start_line":103,"start_character":16,"end_line":104,"end_character":68},"updated":"2024-11-25 19:30:28.000000000","message":"nit: i think that you can reduce to:\n```if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label)```\nfor me is easier to read, but not sure others","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                (target[\u0027labels\u0027].get(self.prometheus_fqdn_label),"},{"line_number":101,"context_line":"                 target[\u0027labels\u0027].get(\u0027instance\u0027))"},{"line_number":102,"context_line":"                for target in prometheus_targets"},{"line_number":103,"context_line":"                if target.get(\u0027labels\u0027) and"},{"line_number":104,"context_line":"                target.get(\u0027labels\u0027).get(self.prometheus_fqdn_label)"},{"line_number":105,"context_line":"            )"},{"line_number":106,"context_line":"        }"},{"line_number":107,"context_line":"        if not fqdn_instance_map:"}],"source_content_type":"text/x-python","patch_set":12,"id":"0eff6a35_2f781b2d","line":104,"range":{"start_line":103,"start_character":16,"end_line":104,"end_character":68},"in_reply_to":"f07322ca_a2260b58","updated":"2024-11-26 12:40:45.000000000","message":"sure thanks for the suggestion","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":95,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":96,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":97,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":98,"context_line":"        fqdn_instance_map \u003d {"},{"line_number":99,"context_line":"            fqdn: instance for (fqdn, instance) in ("},{"line_number":100,"context_line":"                (target[\u0027labels\u0027].get(self.prometheus_fqdn_label),"},{"line_number":101,"context_line":"                 target[\u0027labels\u0027].get(\u0027instance\u0027))"},{"line_number":102,"context_line":"                for target in prometheus_targets"},{"line_number":103,"context_line":"                if target.get(\u0027labels\u0027) and"},{"line_number":104,"context_line":"                target.get(\u0027labels\u0027).get(self.prometheus_fqdn_label)"},{"line_number":105,"context_line":"            )"},{"line_number":106,"context_line":"        }"},{"line_number":107,"context_line":"        if not fqdn_instance_map:"},{"line_number":108,"context_line":"            LOG.error("},{"line_number":109,"context_line":"                \"Could not create host instance map from Prometheus\""}],"source_content_type":"text/x-python","patch_set":12,"id":"6de48112_96b8b587","line":106,"range":{"start_line":98,"start_character":7,"end_line":106,"end_character":9},"updated":"2024-11-25 16:28:29.000000000","message":"nit: this is perhaps pushing dict comprehensions a bit too far.\n\nthis is kind of my limit on complexity\nif this was any more complex  would prefer a traditional for loop here instead.\n\nthis is more efficent (slightly) but harder to read.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":95,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":96,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":97,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":98,"context_line":"        fqdn_instance_map \u003d {"},{"line_number":99,"context_line":"            fqdn: instance for (fqdn, instance) in ("},{"line_number":100,"context_line":"                (target[\u0027labels\u0027].get(self.prometheus_fqdn_label),"},{"line_number":101,"context_line":"                 target[\u0027labels\u0027].get(\u0027instance\u0027))"},{"line_number":102,"context_line":"                for target in prometheus_targets"},{"line_number":103,"context_line":"                if target.get(\u0027labels\u0027) and"},{"line_number":104,"context_line":"                target.get(\u0027labels\u0027).get(self.prometheus_fqdn_label)"},{"line_number":105,"context_line":"            )"},{"line_number":106,"context_line":"        }"},{"line_number":107,"context_line":"        if not fqdn_instance_map:"},{"line_number":108,"context_line":"            LOG.error("},{"line_number":109,"context_line":"                \"Could not create host instance map from Prometheus\""}],"source_content_type":"text/x-python","patch_set":12,"id":"b7559ac6_ef47bc64","line":106,"range":{"start_line":98,"start_character":7,"end_line":106,"end_character":9},"in_reply_to":"6de48112_96b8b587","updated":"2024-11-26 12:40:45.000000000","message":"yeah agree i did consider expanding it at some point. perhaps after Doug\u0027s suggested edit above and removing the last \"and\" it might just be a bit easier to read. \nI do plan/want to keep the comment in there to show what the comprehension is using as input it should help i think","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":153,"context_line":"        :param node_name: the watcher node.hostname"},{"line_number":154,"context_line":"        :return String for the prometheus instance label"},{"line_number":155,"context_line":"        \"\"\""},{"line_number":156,"context_line":"        try:"},{"line_number":157,"context_line":"            return self.prometheus_fqdn_instance_map[node_name]"},{"line_number":158,"context_line":"        except KeyError:"},{"line_number":159,"context_line":"            pass"},{"line_number":160,"context_line":"        try:"},{"line_number":161,"context_line":"            return self.prometheus_host_instance_map[node_name]"},{"line_number":162,"context_line":"        except (KeyError, TypeError):"},{"line_number":163,"context_line":"            LOG.error(\"Cannot query prometheus without instance label. \""},{"line_number":164,"context_line":"                      \"Could not resolve %s\", node_name)"},{"line_number":165,"context_line":"            return None"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    def _build_prometheus_query(self, aggregate, meter, instance_label,"},{"line_number":168,"context_line":"                                period):"}],"source_content_type":"text/x-python","patch_set":12,"id":"da6d7a9e_0bd67008","line":165,"range":{"start_line":156,"start_character":0,"end_line":165,"end_character":23},"updated":"2024-11-25 16:28:29.000000000","message":"```suggestion\n        ret \u003d self.prometheus_fqdn_instance_map.get(\n            node_name, self.prometheus_host_instance_map(node_name, None)\n        if ret is None:\n            LOG.error(\"Cannot query prometheus without instance label. \"\n                      \"Could not resolve %s\", node_name)\n        return ret\n```\n\nby the way im not sure if returning none is the correct api.\nevenutally this probaly shoudl raise an expction direclty but this\nis how i would refactor the code initiall.\n\nwe should avoid using exceptions as control flow.\n\nreturning a sential value like None is ok but if its not ok for a mapping to be unfound we should raise a specific error instead.\nthat could be a follow up","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"d72431fc46d34e6be4c1415be9f45913b5172998","unresolved":false,"context_lines":[{"line_number":153,"context_line":"        :param node_name: the watcher node.hostname"},{"line_number":154,"context_line":"        :return String for the prometheus instance label"},{"line_number":155,"context_line":"        \"\"\""},{"line_number":156,"context_line":"        try:"},{"line_number":157,"context_line":"            return self.prometheus_fqdn_instance_map[node_name]"},{"line_number":158,"context_line":"        except KeyError:"},{"line_number":159,"context_line":"            pass"},{"line_number":160,"context_line":"        try:"},{"line_number":161,"context_line":"            return self.prometheus_host_instance_map[node_name]"},{"line_number":162,"context_line":"        except (KeyError, TypeError):"},{"line_number":163,"context_line":"            LOG.error(\"Cannot query prometheus without instance label. \""},{"line_number":164,"context_line":"                      \"Could not resolve %s\", node_name)"},{"line_number":165,"context_line":"            return None"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    def _build_prometheus_query(self, aggregate, meter, instance_label,"},{"line_number":168,"context_line":"                                period):"}],"source_content_type":"text/x-python","patch_set":12,"id":"9cce8ba0_7f936119","line":165,"range":{"start_line":156,"start_character":0,"end_line":165,"end_character":23},"in_reply_to":"209eb23f_fe9ea21c","updated":"2024-12-10 09:33:18.000000000","message":"Done","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":true,"context_lines":[{"line_number":153,"context_line":"        :param node_name: the watcher node.hostname"},{"line_number":154,"context_line":"        :return String for the prometheus instance label"},{"line_number":155,"context_line":"        \"\"\""},{"line_number":156,"context_line":"        try:"},{"line_number":157,"context_line":"            return self.prometheus_fqdn_instance_map[node_name]"},{"line_number":158,"context_line":"        except KeyError:"},{"line_number":159,"context_line":"            pass"},{"line_number":160,"context_line":"        try:"},{"line_number":161,"context_line":"            return self.prometheus_host_instance_map[node_name]"},{"line_number":162,"context_line":"        except (KeyError, TypeError):"},{"line_number":163,"context_line":"            LOG.error(\"Cannot query prometheus without instance label. \""},{"line_number":164,"context_line":"                      \"Could not resolve %s\", node_name)"},{"line_number":165,"context_line":"            return None"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    def _build_prometheus_query(self, aggregate, meter, instance_label,"},{"line_number":168,"context_line":"                                period):"}],"source_content_type":"text/x-python","patch_set":12,"id":"209eb23f_fe9ea21c","line":165,"range":{"start_line":156,"start_character":0,"end_line":165,"end_character":23},"in_reply_to":"da6d7a9e_0bd67008","updated":"2024-11-26 12:40:45.000000000","message":"yeah OK I\u0027ll rework as you suggest and remove the try/catch.\n\n currently the error would be raised by the _build_prometheus_query function since the instance_label (returned by this function) would be None. I\u0027m in two mindas about leaveing this to return None or adding the exception here.\n \nsince this function is meant to say \u0027found\u0027 or \u0027not found\u0027 it feels wrong for it to explode every time the answer is not found. I think i\u0027d rather deal with the None in the calling function but again, i am not 100% what the right way is for this one.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":185,"context_line":"            raise exception.InvalidParameter("},{"line_number":186,"context_line":"                message\u003d("},{"line_number":187,"context_line":"                    \"Cannot build prometheus query without args. \""},{"line_number":188,"context_line":"                    \"You provided the following: %s\", str(locals())"},{"line_number":189,"context_line":"                )"},{"line_number":190,"context_line":"            )"},{"line_number":191,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"425f3dca_593119f7","line":188,"range":{"start_line":188,"start_character":0,"end_line":188,"end_character":2},"updated":"2024-11-25 16:28:29.000000000","message":"we should not use locals() in excpetions or in genreal.\n\nthat can have unitneded secuity implications depeding on what is in scope so i would consider that a bad practice in general.\n\nperhaps even one we should be enforcing with a pre-commit or lint check.\n\nusing locals is a very easy way to leak private info in logs unitentionally.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":185,"context_line":"            raise exception.InvalidParameter("},{"line_number":186,"context_line":"                message\u003d("},{"line_number":187,"context_line":"                    \"Cannot build prometheus query without args. \""},{"line_number":188,"context_line":"                    \"You provided the following: %s\", str(locals())"},{"line_number":189,"context_line":"                )"},{"line_number":190,"context_line":"            )"},{"line_number":191,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"fa05aeb0_2dd79c11","line":188,"range":{"start_line":188,"start_character":0,"end_line":188,"end_character":2},"in_reply_to":"425f3dca_593119f7","updated":"2024-11-26 12:40:45.000000000","message":"Acknowledged","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":187,"context_line":"                    \"Cannot build prometheus query without args. \""},{"line_number":188,"context_line":"                    \"You provided the following: %s\", str(locals())"},{"line_number":189,"context_line":"                )"},{"line_number":190,"context_line":"            )"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        if meter \u003d\u003d \u0027node_cpu_seconds_total\u0027:"},{"line_number":193,"context_line":"            query_args \u003d ("}],"source_content_type":"text/x-python","patch_set":12,"id":"cb2beee1_2a0bd62b","line":190,"updated":"2024-11-25 16:28:29.000000000","message":"ok this is fine.\n\nwhile you can pass None to positional argument that geneally a code smell given\nthe pythonic convention is to make all optional arguments keyword parmateres\n\na more correct test woudl be \n\nif meter is None or aggregate is None or instance_label is None or  period is None:","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":187,"context_line":"                    \"Cannot build prometheus query without args. \""},{"line_number":188,"context_line":"                    \"You provided the following: %s\", str(locals())"},{"line_number":189,"context_line":"                )"},{"line_number":190,"context_line":"            )"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        if meter \u003d\u003d \u0027node_cpu_seconds_total\u0027:"},{"line_number":193,"context_line":"            query_args \u003d ("}],"source_content_type":"text/x-python","patch_set":12,"id":"b4657f54_a216a631","line":190,"in_reply_to":"cb2beee1_2a0bd62b","updated":"2024-11-26 12:40:45.000000000","message":"Done","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":249,"context_line":"        if aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":250,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":251,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":252,"context_line":"        try:"},{"line_number":253,"context_line":"            promql_aggregate \u003d self.AGGREGATES_MAP[aggregate]"},{"line_number":254,"context_line":"        except KeyError:"},{"line_number":255,"context_line":"            LOG.error(\"Unknown aggregate %s\", aggregate)"},{"line_number":256,"context_line":"            return None"},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"        meter \u003d self._get_meter(meter_name)"},{"line_number":259,"context_line":"        query_args \u003d \u0027\u0027"}],"source_content_type":"text/x-python","patch_set":12,"id":"2cd95724_fd3d18e3","line":256,"range":{"start_line":252,"start_character":1,"end_line":256,"end_character":23},"updated":"2024-11-25 16:28:29.000000000","message":"here as above i would prefer to use get(key, default)\nand check if promql_aggregate is None and return instead fo catch a key error","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"d67cc8f19764adfc2d815a09c392e605be2d1ecf","unresolved":true,"context_lines":[{"line_number":249,"context_line":"        if aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":250,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":251,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":252,"context_line":"        try:"},{"line_number":253,"context_line":"            promql_aggregate \u003d self.AGGREGATES_MAP[aggregate]"},{"line_number":254,"context_line":"        except KeyError:"},{"line_number":255,"context_line":"            LOG.error(\"Unknown aggregate %s\", aggregate)"},{"line_number":256,"context_line":"            return None"},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"        meter \u003d self._get_meter(meter_name)"},{"line_number":259,"context_line":"        query_args \u003d \u0027\u0027"}],"source_content_type":"text/x-python","patch_set":12,"id":"f4dbe28d_ae2d03a7","line":256,"range":{"start_line":252,"start_character":1,"end_line":256,"end_character":23},"in_reply_to":"2cd95724_fd3d18e3","updated":"2024-11-25 19:30:28.000000000","message":"+1","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        if aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":250,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"},{"line_number":251,"context_line":"                        \u0027 the count aggregate. Proceeding with mean.\u0027)"},{"line_number":252,"context_line":"        try:"},{"line_number":253,"context_line":"            promql_aggregate \u003d self.AGGREGATES_MAP[aggregate]"},{"line_number":254,"context_line":"        except KeyError:"},{"line_number":255,"context_line":"            LOG.error(\"Unknown aggregate %s\", aggregate)"},{"line_number":256,"context_line":"            return None"},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"        meter \u003d self._get_meter(meter_name)"},{"line_number":259,"context_line":"        query_args \u003d \u0027\u0027"}],"source_content_type":"text/x-python","patch_set":12,"id":"ea76888c_99ea2a72","line":256,"range":{"start_line":252,"start_character":1,"end_line":256,"end_character":23},"in_reply_to":"f4dbe28d_ae2d03a7","updated":"2024-11-26 12:40:45.000000000","message":"Acknowledged","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"d67cc8f19764adfc2d815a09c392e605be2d1ecf","unresolved":true,"context_lines":[{"line_number":281,"context_line":"            ignored_exc\u003dprometheus_client.PrometheusAPIClientError,"},{"line_number":282,"context_line":"        )"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"        if result:"},{"line_number":285,"context_line":"            return result[0].value"},{"line_number":286,"context_line":"        else:"},{"line_number":287,"context_line":"            return None"},{"line_number":288,"context_line":""},{"line_number":289,"context_line":"    def statistic_series(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":290,"context_line":"                         meter_name\u003dNone, start_time\u003dNone, end_time\u003dNone,"}],"source_content_type":"text/x-python","patch_set":12,"id":"7d8ae5a7_3e04a8f2","line":287,"range":{"start_line":284,"start_character":0,"end_line":287,"end_character":23},"updated":"2024-11-25 19:30:28.000000000","message":"nit: ``return result[0].value if result else None``","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6b2b9b0a384af9418c69bae02d3ce0d9fd8d0734","unresolved":false,"context_lines":[{"line_number":281,"context_line":"            ignored_exc\u003dprometheus_client.PrometheusAPIClientError,"},{"line_number":282,"context_line":"        )"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"        if result:"},{"line_number":285,"context_line":"            return result[0].value"},{"line_number":286,"context_line":"        else:"},{"line_number":287,"context_line":"            return None"},{"line_number":288,"context_line":""},{"line_number":289,"context_line":"    def statistic_series(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":290,"context_line":"                         meter_name\u003dNone, start_time\u003dNone, end_time\u003dNone,"}],"source_content_type":"text/x-python","patch_set":12,"id":"caf17c92_fc127fb6","line":287,"range":{"start_line":284,"start_character":0,"end_line":287,"end_character":23},"in_reply_to":"7d8ae5a7_3e04a8f2","updated":"2024-11-26 12:40:45.000000000","message":"Acknowledged","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"dd4811f48bfce6ee9829f1ee213afc3f500a2fb1","unresolved":true,"context_lines":[{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"        Unlike other Watcher data sources, this class does not expect"},{"line_number":52,"context_line":"        an OSC Client as parameter. Instead it uses python-observabilityclient"},{"line_number":53,"context_line":"        which provides the PrometheusAPIClient."},{"line_number":54,"context_line":"        The prometheus_fqdn_instance_map maps the fqdn of each node to the"},{"line_number":55,"context_line":"        Prometheus instance label added to all metrics on that node. When"}],"source_content_type":"text/x-python","patch_set":13,"id":"09b09aca_728701ae","line":52,"range":{"start_line":51,"start_character":7,"end_line":52,"end_character":36},"updated":"2024-11-26 18:54:05.000000000","message":"i was going to say we need to conform to the base class but the base class does not defin a signiture for the __init__ methond...\n\nso i guess this is fine.\n\nwith that said we shoudl not refer to it as the osc client\n\nOSC Client \n\nthis is the OSC client https://github.com/openstack/python-openstackclient\n\ni would be tempeted to just remove this line.","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8263af3d972041fe1bdb4be221b71567de9492af","unresolved":true,"context_lines":[{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"        Unlike other Watcher data sources, this class does not expect"},{"line_number":52,"context_line":"        an OSC Client as parameter. Instead it uses python-observabilityclient"},{"line_number":53,"context_line":"        which provides the PrometheusAPIClient."},{"line_number":54,"context_line":"        The prometheus_fqdn_instance_map maps the fqdn of each node to the"},{"line_number":55,"context_line":"        Prometheus instance label added to all metrics on that node. When"}],"source_content_type":"text/x-python","patch_set":13,"id":"6c6651e7_ab0b311f","line":52,"range":{"start_line":51,"start_character":7,"end_line":52,"end_character":36},"in_reply_to":"09b09aca_728701ae","updated":"2024-11-27 11:51:03.000000000","message":"right. i was thinking of even just redundant carrying it here but since as you said there is no __init__ signature in the base i can just omit. I\u0027ll add if we have to later but fine for now i think?","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"d72431fc46d34e6be4c1415be9f45913b5172998","unresolved":false,"context_lines":[{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"        Unlike other Watcher data sources, this class does not expect"},{"line_number":52,"context_line":"        an OSC Client as parameter. Instead it uses python-observabilityclient"},{"line_number":53,"context_line":"        which provides the PrometheusAPIClient."},{"line_number":54,"context_line":"        The prometheus_fqdn_instance_map maps the fqdn of each node to the"},{"line_number":55,"context_line":"        Prometheus instance label added to all metrics on that node. When"}],"source_content_type":"text/x-python","patch_set":13,"id":"04ccd08f_73f468ef","line":52,"range":{"start_line":51,"start_character":7,"end_line":52,"end_character":36},"in_reply_to":"6c6651e7_ab0b311f","updated":"2024-12-10 09:33:18.000000000","message":"Done","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"1f0149779f3db8425944bb57e8e94d876d795177","unresolved":true,"context_lines":[{"line_number":143,"context_line":"            return {}"},{"line_number":144,"context_line":"        return host_instance_map"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    def _resolve_prometheus_instance_label(self, node_name):"},{"line_number":147,"context_line":"        \"\"\"Resolve the prometheus instance label to use in queries"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"        Given the watcher node.hostname, resolve the prometheus instance"}],"source_content_type":"text/x-python","patch_set":13,"id":"1bf41f65_559aa507","line":146,"updated":"2024-11-26 16:30:25.000000000","message":"I like the way you implement mapping hosts to labels.\n\nJust a minor issue, while watcher (and I\u0027d say commonly understood in OpenStack) uses `host` for compute hosts metrics and `instance` for OpenStack VM instances, you are using the term `instance` in the methods and variables intended to work with `hosts` identification, not `instances`.\n\nI\u0027m not sure if this is because of prometheus terminology but has been confusing for me while reading the code. i.e. reading `prometheus_fqdn_instance_map` for me was understood as some kind of mapping between instances (vms) and fqdn (which is not).\n\nIn any case, this is not a blocker at this point.","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8263af3d972041fe1bdb4be221b71567de9492af","unresolved":true,"context_lines":[{"line_number":143,"context_line":"            return {}"},{"line_number":144,"context_line":"        return host_instance_map"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    def _resolve_prometheus_instance_label(self, node_name):"},{"line_number":147,"context_line":"        \"\"\"Resolve the prometheus instance label to use in queries"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"        Given the watcher node.hostname, resolve the prometheus instance"}],"source_content_type":"text/x-python","patch_set":13,"id":"5069bc23_9ea99653","line":146,"in_reply_to":"1bf41f65_559aa507","updated":"2024-11-27 11:51:03.000000000","message":"yea you\u0027re right there is overloading of \u0027instance\u0027. unfortunately in prometheus it means \u0027any endpoint you can scrape for metrics https://prometheus.io/docs/concepts/jobs_instances/#jobs-and-instances\n\n```\n In Prometheus terms, an endpoint you can scrape is called an instance, usually corresponding to a single process. A collection of instances with the same purpose, a process replicated for scalability or reliability for example, is called a job.\n \n```","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"98f569cc1463cb3dcc2d8647e39bc77c4db012b5","unresolved":false,"context_lines":[{"line_number":143,"context_line":"            return {}"},{"line_number":144,"context_line":"        return host_instance_map"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    def _resolve_prometheus_instance_label(self, node_name):"},{"line_number":147,"context_line":"        \"\"\"Resolve the prometheus instance label to use in queries"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"        Given the watcher node.hostname, resolve the prometheus instance"}],"source_content_type":"text/x-python","patch_set":13,"id":"06a4a855_73cd4770","line":146,"in_reply_to":"5069bc23_9ea99653","updated":"2024-11-28 16:25:17.000000000","message":"Done","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"1f0149779f3db8425944bb57e8e94d876d795177","unresolved":true,"context_lines":[{"line_number":221,"context_line":"                \"Is Prometheus server down?\""},{"line_number":222,"context_line":"            )"},{"line_number":223,"context_line":"            return \u0027not available\u0027"},{"line_number":224,"context_line":"        return \u0027available\u0027"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    def list_metrics(self):"},{"line_number":227,"context_line":"        \"\"\"Fetch all prometheus metrics  from api/v1/label/__name__/values"}],"source_content_type":"text/x-python","patch_set":13,"id":"f40236f1_88dbac78","line":224,"range":{"start_line":224,"start_character":0,"end_line":224,"end_character":2},"updated":"2024-11-26 16:30:25.000000000","message":"I\u0027m not sure if there is a documented api for datasources (i didn\u0027t find in docs) but according to the base class \"True or False with true meaning the datasource is available\"\n\nhttps://github.com/openstack/watcher/blob/566a830f64983dd98d7cd2eef62c159b1048e42d/watcher/decision_engine/datasources/base.py#L115","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8263af3d972041fe1bdb4be221b71567de9492af","unresolved":false,"context_lines":[{"line_number":221,"context_line":"                \"Is Prometheus server down?\""},{"line_number":222,"context_line":"            )"},{"line_number":223,"context_line":"            return \u0027not available\u0027"},{"line_number":224,"context_line":"        return \u0027available\u0027"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    def list_metrics(self):"},{"line_number":227,"context_line":"        \"\"\"Fetch all prometheus metrics  from api/v1/label/__name__/values"}],"source_content_type":"text/x-python","patch_set":13,"id":"8e964bb1_1c2a0eca","line":224,"range":{"start_line":224,"start_character":0,"end_line":224,"end_character":2},"in_reply_to":"ed0a43c8_651da8d0","updated":"2024-11-27 11:51:03.000000000","message":"Acknowledged","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"dd4811f48bfce6ee9829f1ee213afc3f500a2fb1","unresolved":true,"context_lines":[{"line_number":221,"context_line":"                \"Is Prometheus server down?\""},{"line_number":222,"context_line":"            )"},{"line_number":223,"context_line":"            return \u0027not available\u0027"},{"line_number":224,"context_line":"        return \u0027available\u0027"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    def list_metrics(self):"},{"line_number":227,"context_line":"        \"\"\"Fetch all prometheus metrics  from api/v1/label/__name__/values"}],"source_content_type":"text/x-python","patch_set":13,"id":"ed0a43c8_651da8d0","line":224,"range":{"start_line":224,"start_character":0,"end_line":224,"end_character":2},"in_reply_to":"f40236f1_88dbac78","updated":"2024-11-26 18:54:05.000000000","message":"yep i highlighted that before and filed a bug.\nnone fo the dirver implement the docuemtned api.\n\nso we need ot adress that sepreatly.\n\ni asked marios to conform to the actully api used by other drivers for this fucntion which return the strings.\n\nhttps://bugs.launchpad.net/watcher/+bug/2089384","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"1f0149779f3db8425944bb57e8e94d876d795177","unresolved":true,"context_lines":[{"line_number":240,"context_line":"        return set(response[\u0027data\u0027])"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":243,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"},{"line_number":244,"context_line":"                              aggregate\u003d\u0027mean\u0027):"},{"line_number":245,"context_line":"        if aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":246,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"9667dcd3_97490ddb","line":243,"updated":"2024-11-26 16:30:25.000000000","message":"granularity is unused, I understand it is irrelevant for the prometheus case, right?","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8263af3d972041fe1bdb4be221b71567de9492af","unresolved":true,"context_lines":[{"line_number":240,"context_line":"        return set(response[\u0027data\u0027])"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":243,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"},{"line_number":244,"context_line":"                              aggregate\u003d\u0027mean\u0027):"},{"line_number":245,"context_line":"        if aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":246,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"db6217a3_d634e5a4","line":243,"in_reply_to":"7f745036_664e90bf","updated":"2024-11-27 11:51:03.000000000","message":"thanks for the review and for leaving comments @Alfredo. actually this is one of the points I wanted to hilight in our sync so thanks for raising it here 😊\n\ngranularity applies when you fetch metrics and perform the calculations on those, so granularity will dictate how many of those metrics you fetch. \n\nin our queries we are not fetching individual metrics and performing calculations but instead relying on the built in promql functions and operators (like avg and rate). SO in this sense, the granularity is redundant here and we fall back to whatever the scrape interval is.","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"dd4811f48bfce6ee9829f1ee213afc3f500a2fb1","unresolved":true,"context_lines":[{"line_number":240,"context_line":"        return set(response[\u0027data\u0027])"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":243,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"},{"line_number":244,"context_line":"                              aggregate\u003d\u0027mean\u0027):"},{"line_number":245,"context_line":"        if aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":246,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"7f745036_664e90bf","line":243,"in_reply_to":"9667dcd3_97490ddb","updated":"2024-11-26 18:54:05.000000000","message":"not nessisarly, we shoudl try to supprot this where it makes sense.\nwe are limited in what we can achive but if we have load for exampel available for 5 min or 15 then we should use the 5 minute version based on the default graduality.\n\nfor now we can ignore it but we shoudl try and confrom to the data souce api as closely as possible.\n\nthsi will be relevnet for some of the metrics.","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"d72431fc46d34e6be4c1415be9f45913b5172998","unresolved":false,"context_lines":[{"line_number":240,"context_line":"        return set(response[\u0027data\u0027])"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":243,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"},{"line_number":244,"context_line":"                              aggregate\u003d\u0027mean\u0027):"},{"line_number":245,"context_line":"        if aggregate \u003d\u003d \u0027count\u0027:"},{"line_number":246,"context_line":"            LOG.warning(\u0027Prometheus data source does not currently support \u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"99dec6aa_01402078","line":243,"in_reply_to":"db6217a3_d634e5a4","updated":"2024-12-10 09:33:18.000000000","message":"Done","commit_id":"52e6d5a48f072be8b39b4a74d1d8acbf343cf76c"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":true,"context_lines":[{"line_number":43,"context_line":"                      instance_l3_cache_usage\u003dNone,"},{"line_number":44,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":45,"context_line":"                      )"},{"line_number":46,"context_line":"    AGGREGATES_MAP \u003d dict(mean\u003d\u0027avg\u0027, max\u003d\u0027min\u0027, min\u003d\u0027max\u0027, count\u003d\u0027avg\u0027)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"}],"source_content_type":"text/x-python","patch_set":18,"id":"3249e917_a19214ba","line":46,"range":{"start_line":46,"start_character":38,"end_line":46,"end_character":58},"updated":"2024-12-11 17:52:21.000000000","message":"? really\nif this is corect we proably should have a comment explaining and linking to the relevant prometheus docs cause that is insane.\n\n-1 is mainly for this","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"87d1147f4f4dc336478891c439e1bb51d1f0c225","unresolved":false,"context_lines":[{"line_number":43,"context_line":"                      instance_l3_cache_usage\u003dNone,"},{"line_number":44,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":45,"context_line":"                      )"},{"line_number":46,"context_line":"    AGGREGATES_MAP \u003d dict(mean\u003d\u0027avg\u0027, max\u003d\u0027min\u0027, min\u003d\u0027max\u0027, count\u003d\u0027avg\u0027)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"}],"source_content_type":"text/x-python","patch_set":18,"id":"fc2edf24_38193b70","line":46,"range":{"start_line":46,"start_character":38,"end_line":46,"end_character":58},"in_reply_to":"11afa3da_96b1d359","updated":"2024-12-18 09:06:20.000000000","message":"marking this one resolved. the AGGREGATES_MAP is now more \u0027normal\u0027 and the inversion is pushed into the ``def _resolve_prometheus_aggregate``","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"fb287b3ca02f97f82c25df1d1bb3fdd88f104fb7","unresolved":true,"context_lines":[{"line_number":43,"context_line":"                      instance_l3_cache_usage\u003dNone,"},{"line_number":44,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":45,"context_line":"                      )"},{"line_number":46,"context_line":"    AGGREGATES_MAP \u003d dict(mean\u003d\u0027avg\u0027, max\u003d\u0027min\u0027, min\u003d\u0027max\u0027, count\u003d\u0027avg\u0027)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"}],"source_content_type":"text/x-python","patch_set":18,"id":"eb199f19_0c4a4a8c","line":46,"range":{"start_line":46,"start_character":38,"end_line":46,"end_character":58},"in_reply_to":"32061a07_81fa6a40","updated":"2024-12-12 09:35:51.000000000","message":"Thanks for the explanation! it\u0027s much more clear now.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8f8cc5ecf2cde19b742f81b7ee272a39add047a4","unresolved":true,"context_lines":[{"line_number":43,"context_line":"                      instance_l3_cache_usage\u003dNone,"},{"line_number":44,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":45,"context_line":"                      )"},{"line_number":46,"context_line":"    AGGREGATES_MAP \u003d dict(mean\u003d\u0027avg\u0027, max\u003d\u0027min\u0027, min\u003d\u0027max\u0027, count\u003d\u0027avg\u0027)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"}],"source_content_type":"text/x-python","patch_set":18,"id":"32061a07_81fa6a40","line":46,"range":{"start_line":46,"start_character":38,"end_line":46,"end_character":58},"in_reply_to":"3249e917_a19214ba","updated":"2024-12-12 08:43:13.000000000","message":"right, this needs some \u0027splaining... \n\nno not a bug. not even a feature ;)\n\nthis is a nuance in the way the current queries work, which needs to be documented and which I don\u0027t know for sure will hold when we expand the metrics.\n\nin both cpu/memory i am requesting the \u0027idle\u0027 from prometheus. like \"cpu idle\" or \"unused memory\" but the response we generate and return is the inverse of that like cpu or memory used. \n\nSo if the request is \"max cpu usage\" then i need to request from prometheus the MINIMUM idle time (i.e. the time at which the cpu was maxxed). Same for \"max memory usage\" i need to request the MIN \u0027available memory\u0027 (unused), to get the maxxed memory used.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":true,"context_lines":[{"line_number":43,"context_line":"                      instance_l3_cache_usage\u003dNone,"},{"line_number":44,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":45,"context_line":"                      )"},{"line_number":46,"context_line":"    AGGREGATES_MAP \u003d dict(mean\u003d\u0027avg\u0027, max\u003d\u0027min\u0027, min\u003d\u0027max\u0027, count\u003d\u0027avg\u0027)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"}],"source_content_type":"text/x-python","patch_set":18,"id":"9be61e18_03f923b3","line":46,"range":{"start_line":46,"start_character":38,"end_line":46,"end_character":58},"in_reply_to":"6993f871_5ecd52d0","updated":"2024-12-13 11:34:38.000000000","message":"OK, agree. in the case of the vms metrics the queries are straighforward. i will push this inversion into the function that builds the query and it will only apply for the host metrics.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"02a1bda2b20dd6f7b66b8d8fb5615138f78bdcff","unresolved":true,"context_lines":[{"line_number":43,"context_line":"                      instance_l3_cache_usage\u003dNone,"},{"line_number":44,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":45,"context_line":"                      )"},{"line_number":46,"context_line":"    AGGREGATES_MAP \u003d dict(mean\u003d\u0027avg\u0027, max\u003d\u0027min\u0027, min\u003d\u0027max\u0027, count\u003d\u0027avg\u0027)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"}],"source_content_type":"text/x-python","patch_set":18,"id":"11afa3da_96b1d359","line":46,"range":{"start_line":46,"start_character":38,"end_line":46,"end_character":58},"in_reply_to":"6993f871_5ecd52d0","updated":"2024-12-13 15:04:42.000000000","message":"right, I missed that detail before. But for sure, if this logic is specific to some metrics, it shouldn\u0027t be here, but at the specific queries.\n+1","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c5eacfca7c874ac44d520a7ba784cd8f74e0c3e9","unresolved":true,"context_lines":[{"line_number":43,"context_line":"                      instance_l3_cache_usage\u003dNone,"},{"line_number":44,"context_line":"                      instance_root_disk_size\u003dNone,"},{"line_number":45,"context_line":"                      )"},{"line_number":46,"context_line":"    AGGREGATES_MAP \u003d dict(mean\u003d\u0027avg\u0027, max\u003d\u0027min\u0027, min\u003d\u0027max\u0027, count\u003d\u0027avg\u0027)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def __init__(self):"},{"line_number":49,"context_line":"        \"\"\"Initialise the PrometheusHelper"}],"source_content_type":"text/x-python","patch_set":18,"id":"6993f871_5ecd52d0","line":46,"range":{"start_line":46,"start_character":38,"end_line":46,"end_character":58},"in_reply_to":"eb199f19_0c4a4a8c","updated":"2024-12-12 14:10:40.000000000","message":"ya this is not something we can continue use for other metrics wo i think we need  a differnt solution to this.\n\nat a minimum we are going to need to do this in a per-metric basis if we take the current approhc.\n\notherwise we are going to the have to reconsider how we quiery for the exsitign values.\n\nthis wont work for the instnace values for example.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"877ef13c42db5ac14c54c70d0c20fc926c79c8e4","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"abff96c9_761357fb","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"updated":"2024-12-11 18:04:04.000000000","message":"I\u0027ve had issues when trying to connect to an https endpoint as it\u0027s assuming it\u0027s http unless you enable session.verify:\n\nhttps://github.com/openstack/python-observabilityclient/blob/master/observabilityclient/prometheus_client.py#L72\n\nWe can enable https with https://github.com/openstack/python-observabilityclient/blob/master/observabilityclient/prometheus_client.py#L61\n\nas in https://github.com/openstack/python-observabilityclient/blob/master/observabilityclient/utils/metric_utils.py#L72-L74\n\nWe will still have problems with self-signed certs but that\u0027s probably more an issue in observabilityclient which apparently does not provide a way to disable verify with https.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8f8cc5ecf2cde19b742f81b7ee272a39add047a4","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"5d1885b8_ee0b9c0a","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"32063229_921c351d","updated":"2024-12-12 08:43:13.000000000","message":"thanks for your comments and the discussion\nindeed i did not cover the https case at all in this iteration and would like to merge with this as a first pass since we are going to iterate on the metrics as previously discussed.\nthere is a further parameter to consider, that we have also previously discussed. We should investigate python-observabilityclient vs https://github.com/prometheus/client_python. perhaps the https support here (if better) might be the deciding factor for moving.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"50dbbd1a94e6c6ee7dfa6e25b9fb1de7a1635c66","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"3ae9da55_a363e3fc","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"35a9ae58_9d16c84d","updated":"2024-12-12 10:33:57.000000000","message":"yes,same i actually did some digging (last time ionly found the repo and stopped there). indeed it is a client for prometheus, but more like it understands all about Prometheus things (like counters, gauges etc other metric object types). So indeed that is not an option.\n\nReally what we want/need here is not a \"prometheus\" client per se, just an http one (with _some_ context built into the client that is prometheus specific like ?query endpoint etc). SO i guess observabilityclient it is. I am glad we can let that one rest then","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"7cbf5efe569d800eab69be54ead23476e36e4c9b","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"bc645af5_95de332d","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"3ae9da55_a363e3fc","updated":"2024-12-12 10:57:21.000000000","message":"i think i\u0027d like to iterate here and at least add the client options in for the user/pass (basic auth) and certs that we can pass through to the observabilityclient.\n\ni think we can do that in the next couple days and still aim to get it into mergable state for end next week","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"fb287b3ca02f97f82c25df1d1bb3fdd88f104fb7","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"35a9ae58_9d16c84d","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"5d1885b8_ee0b9c0a","updated":"2024-12-12 09:35:51.000000000","message":"yeah, we can discuss it later when adding support to https. I took a quick look to that library and it\u0027s totally unclear to me how to use it for our use case tbh.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"87d1147f4f4dc336478891c439e1bb51d1f0c225","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"ed5e1588_49b93335","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"6666546f_c228368f","updated":"2024-12-18 09:06:20.000000000","message":"@smooney@redhat.com @amoralej@redhat.com i added a ``def _setup_prometheus_client`` which sets the tls params if they are in watcher config and otherwise tries to set basic auth if that is set. \n\nI think the keystone integration can come in the next iteration","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"bcca968daee2994fd30b7d18a735790100ae7e3a","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"fb7cf76f_04a6dd88","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"6c449f0f_36bfedf2","updated":"2024-12-11 18:38:54.000000000","message":"lookign at aodh they are not using this entry point to the client\n\nhttps://github.com/openstack/aodh/blob/master/aodh/evaluator/prometheus.py#L39-L43\n\nthey are somehow using a keystone session to create a client instance but i dont understand how that is intended to work.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"7953ff79_1bb0626b","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"71ef036c_44d89c5f","updated":"2025-01-09 15:23:36.000000000","message":"i will update the client options/remove prefix etc as discussed in the other comment and split host/port in this patch.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c041481a683e2e3666032e193951ab6b0dfd1052","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"cc993487_093b199b","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"7953ff79_1bb0626b","updated":"2025-01-10 10:35:12.000000000","message":"Done","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"f297b9406de064002f6a608a29cadf168af5001a","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"6c449f0f_36bfedf2","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"abff96c9_761357fb","updated":"2024-12-11 18:30:46.000000000","message":"so i was goign to suggest changing the config option to a URIOpt\n\nbtu looking at \nhttps://opendev.org/openstack/python-observabilityclient/src/branch/master/observabilityclient/prometheus_client.py#L55-L82\nthey are interally generating the url by substituing the host and the schema is determied by   self._session.verify \n\nso to use this with a https endpoitn we woudl need to have a clinet ca cert confgi option...\n\n\n\n\ni think for the intiall implmation we can require http only\n\nand then in a sepreate patch we can add a second config option for the cliant ca cert to supprot https but this is not a partially good inteface.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c5eacfca7c874ac44d520a7ba784cd8f74e0c3e9","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"fecd48cb_0db43c20","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"bc645af5_95de332d","updated":"2024-12-12 14:10:40.000000000","message":"i spoke to @efoley@redhat.com about this a little last night.\n\napparently the way they have integrated prometious with aodh is prometous is registered in Keystone as an endpoint so we should likely replace how we are currently creating the client with the aodh approch.\n\naodh has a service_creditial section\n\nhttps://github.com/openstack-k8s-operators/telemetry-operator/blob/09a19a639cae5fd7b062a0d75a752d0bea35854d/templates/autoscaling/config/aodh.conf#L45-L53\n\nwhich are used ot create a keyston auth session that is then used to create the prometheous client. i dont know the details fo how that client isntance knwo where the server is as unfortuently there are no doc or tempests jobs i can find to explin how that works so i think we need to sit donw with the cloud ops folks and figure this out with them.\n\nim actully surpised that @jlarriba@redhat.com didnt bring this up before.\n\nif prometios is expected to be registed in keystone then we do not need to have the host/port in our config at all\n\nat least not in the way we currently have.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"67a793366a63caa7429da568bf6f131c4f899ff9","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"71ef036c_44d89c5f","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"e38b873a_e4ddcd0c","updated":"2025-01-08 16:30:40.000000000","message":"I\u0027m kind of torn.\n\nwe coudl mark this as resolved provided we are committed to refactor how we create the client and the config option to match how this is done in aodh in a followup this cycle.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"14eaf3118dbae08adbe382caca7d6e87e044a643","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"e38b873a_e4ddcd0c","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"ed5e1588_49b93335","updated":"2025-01-06 09:00:50.000000000","message":"can we mark this one resolved @smooney@redhat.com @amoralej@redhat.com","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"e14fbd67c98c0a8ed1180e0691a28094f91c9960","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"32063229_921c351d","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"fb7cf76f_04a6dd88","updated":"2024-12-11 20:13:35.000000000","message":"I\u0027m fine with doing http only so far.\n\nI\u0027m also not sure how it\u0027s supposed to work. It looks for a \"metric\" endpoint which is intended for gnocchi and it\u0027s not used for prometheus endpoints afaik. Actually, the prometheus endpoint is taken from a prometheus.yaml file or from env variables. I\u0027d say PrometheusAPIClient is fine and much easier for prometheus endpoints than the aodh way. My only doubt is if observabilityclient maintainers will want to allow it to be used in that way and will support changes to improve it (as a way to explicitely set https as protocol even if we don\u0027t want or can\u0027t verify the cert, i.e.)\n\nFor deployment in operators, see how it configures prometheus.yaml:\n\nhttps://github.com/openstack-k8s-operators/telemetry-operator/blob/09a19a639cae5fd7b062a0d75a752d0bea35854d/templates/autoscaling/config/prometheus.yaml#L3","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":true,"context_lines":[{"line_number":69,"context_line":"                    \"the [prometheus_client] section. Unable to initialise \""},{"line_number":70,"context_line":"                    \"the datasource without a value for prometheus_host_port.\")"},{"line_number":71,"context_line":"            )"},{"line_number":72,"context_line":"        self.prometheus \u003d prometheus_client.PrometheusAPIClient(_host_port)"},{"line_number":73,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":74,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":75,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":18,"id":"6666546f_c228368f","line":72,"range":{"start_line":72,"start_character":26,"end_line":72,"end_character":75},"in_reply_to":"fecd48cb_0db43c20","updated":"2024-12-13 11:34:38.000000000","message":"interesting... it makes it a bit unclear how to proceed for now though. I get we must be backwards compatible in the options we expose. \n\nI would like to add user/pass for basic auth as well as ca_cert/client_cert/client_key for tls as options in the client_conf. Can we omit the keystone integration for now altogether until we discuss it in the new year? One posibility is to just add the config options for service_credentials as listed in https://github.com/openstack-k8s-operators/telemetry-operator/blob/92f9bd167b1d8cd205818f105bc1854b29e4bd03/templates/autoscaling/config/aodh.conf#L45-L53 \nand just have them be unused until the details are worked out. but the variable/option names should be fairly consistent I think?\n\nPersonally I\u0027d rather omit the keystone options from this patch and defer to followup when we know more. we can eventually deprecate the user/pass or tls (or just leave it; after all prometheus is not an openstack project so it may not always be the case that we have an endpoint registered with keystone for it).","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":true,"context_lines":[{"line_number":261,"context_line":"                \"list_metrics raised PrometheusAPIClientError. Is Prometheus\""},{"line_number":262,"context_line":"                \"server down?\""},{"line_number":263,"context_line":"            )"},{"line_number":264,"context_line":"            return set()"},{"line_number":265,"context_line":"        return set(response[\u0027data\u0027])"},{"line_number":266,"context_line":""},{"line_number":267,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"}],"source_content_type":"text/x-python","patch_set":18,"id":"b03a4f98_cfcd2584","line":264,"range":{"start_line":264,"start_character":10,"end_line":264,"end_character":24},"updated":"2024-12-11 17:52:21.000000000","message":"i guess you are emulating gnocci and ceilmoeter\n\nhttps://github.com/openstack/watcher/blob/811a704f809652af660b2ffd3a4c76e4196f930f/watcher/decision_engine/datasources/gnocchi.py#L64-L67\n\nhttps://github.com/openstack/watcher/blob/811a704f809652af660b2ffd3a4c76e4196f930f/watcher/decision_engine/datasources/ceilometer.py#L140-L143\n\n\ni dont particallary like much of the api design choies made here but your just confriming to the exstign api so i wont hold that agaisnt you.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8f8cc5ecf2cde19b742f81b7ee272a39add047a4","unresolved":false,"context_lines":[{"line_number":261,"context_line":"                \"list_metrics raised PrometheusAPIClientError. Is Prometheus\""},{"line_number":262,"context_line":"                \"server down?\""},{"line_number":263,"context_line":"            )"},{"line_number":264,"context_line":"            return set()"},{"line_number":265,"context_line":"        return set(response[\u0027data\u0027])"},{"line_number":266,"context_line":""},{"line_number":267,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"}],"source_content_type":"text/x-python","patch_set":18,"id":"4c44acee_d401f323","line":264,"range":{"start_line":264,"start_character":10,"end_line":264,"end_character":24},"in_reply_to":"b03a4f98_cfcd2584","updated":"2024-12-12 08:43:13.000000000","message":"Acknowledged","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"877ef13c42db5ac14c54c70d0c20fc926c79c8e4","unresolved":true,"context_lines":[{"line_number":321,"context_line":"            {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100))"},{"line_number":322,"context_line":"        \"\"\""},{"line_number":323,"context_line":"        return self.statistic_aggregation("},{"line_number":324,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, period, aggregate,"},{"line_number":325,"context_line":"            granularity)"},{"line_number":326,"context_line":""},{"line_number":327,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":328,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":329,"context_line":"        return self.statistic_aggregation("}],"source_content_type":"text/x-python","patch_set":18,"id":"9635ba17_157479e8","line":326,"range":{"start_line":324,"start_character":64,"end_line":326,"end_character":1},"updated":"2024-12-11 18:04:04.000000000","message":"Order of these parameters is wrong compared with the order in statistic_aggregation. I\u0027d suggest you to pass parameters by their name:\n\nperiod\u003dperiod, aggregate\u003daggregate, granularity\u003dgranularity","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8f8cc5ecf2cde19b742f81b7ee272a39add047a4","unresolved":false,"context_lines":[{"line_number":321,"context_line":"            {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100))"},{"line_number":322,"context_line":"        \"\"\""},{"line_number":323,"context_line":"        return self.statistic_aggregation("},{"line_number":324,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, period, aggregate,"},{"line_number":325,"context_line":"            granularity)"},{"line_number":326,"context_line":""},{"line_number":327,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":328,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":329,"context_line":"        return self.statistic_aggregation("}],"source_content_type":"text/x-python","patch_set":18,"id":"dd05f3f2_58646090","line":326,"range":{"start_line":324,"start_character":64,"end_line":326,"end_character":1},"in_reply_to":"283f49f5_aac6cfa0","updated":"2024-12-12 08:43:13.000000000","message":"thanks i will update the order here","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"dded3ad64a928b080bc80e98539de8a5315dad1e","unresolved":true,"context_lines":[{"line_number":321,"context_line":"            {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100))"},{"line_number":322,"context_line":"        \"\"\""},{"line_number":323,"context_line":"        return self.statistic_aggregation("},{"line_number":324,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, period, aggregate,"},{"line_number":325,"context_line":"            granularity)"},{"line_number":326,"context_line":""},{"line_number":327,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":328,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":329,"context_line":"        return self.statistic_aggregation("}],"source_content_type":"text/x-python","patch_set":18,"id":"283f49f5_aac6cfa0","line":326,"range":{"start_line":324,"start_character":64,"end_line":326,"end_character":1},"in_reply_to":"9635ba17_157479e8","updated":"2024-12-11 18:58:26.000000000","message":"so whiel python allows postional argument to be called via names and keyword argumenet ot be called postionally its confidered bad practice to use that funcitonaltiy\n\nso yes these shoudl not rely on that.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"fb287b3ca02f97f82c25df1d1bb3fdd88f104fb7","unresolved":false,"context_lines":[{"line_number":321,"context_line":"            {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100))"},{"line_number":322,"context_line":"        \"\"\""},{"line_number":323,"context_line":"        return self.statistic_aggregation("},{"line_number":324,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, period, aggregate,"},{"line_number":325,"context_line":"            granularity)"},{"line_number":326,"context_line":""},{"line_number":327,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":328,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":329,"context_line":"        return self.statistic_aggregation("}],"source_content_type":"text/x-python","patch_set":18,"id":"dd5ca749_c799cdf6","line":326,"range":{"start_line":324,"start_character":64,"end_line":326,"end_character":1},"in_reply_to":"dd05f3f2_58646090","updated":"2024-12-12 09:35:51.000000000","message":"Why not call parameters via names instead of just order?. As Sean mentioned, even if it works, it\u0027s considered a bad practice to rely in position when using named parameters.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"877ef13c42db5ac14c54c70d0c20fc926c79c8e4","unresolved":true,"context_lines":[{"line_number":327,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":328,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":329,"context_line":"        return self.statistic_aggregation("},{"line_number":330,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_ram_usage\u0027, period, aggregate,"},{"line_number":331,"context_line":"            granularity)"}],"source_content_type":"text/x-python","patch_set":18,"id":"856711fd_10572119","line":331,"range":{"start_line":330,"start_character":64,"end_line":331,"end_character":23},"updated":"2024-12-11 18:04:04.000000000","message":"ditto","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8f8cc5ecf2cde19b742f81b7ee272a39add047a4","unresolved":false,"context_lines":[{"line_number":327,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":328,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":329,"context_line":"        return self.statistic_aggregation("},{"line_number":330,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_ram_usage\u0027, period, aggregate,"},{"line_number":331,"context_line":"            granularity)"}],"source_content_type":"text/x-python","patch_set":18,"id":"eab6ca01_e99430f9","line":331,"range":{"start_line":330,"start_character":64,"end_line":331,"end_character":23},"in_reply_to":"856711fd_10572119","updated":"2024-12-12 08:43:13.000000000","message":"Done","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":9976,"name":"Ronelle Landy","email":"rlandy@redhat.com","username":"rlandy"},"change_message_id":"803db2cbee0e18eec006eb834487c3f42e109e6e","unresolved":true,"context_lines":[{"line_number":109,"context_line":"            \"targets?state\u003dactive\")[\u0027data\u0027][\u0027activeTargets\u0027]"},{"line_number":110,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":111,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":112,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":113,"context_line":"        fqdn_instance_map \u003d {"},{"line_number":114,"context_line":"            fqdn: instance for (fqdn, instance) in ("},{"line_number":115,"context_line":"                (target[\u0027labels\u0027].get(self.prometheus_fqdn_label),"}],"source_content_type":"text/x-python","patch_set":19,"id":"df78f4e3_1e8dd1f6","line":112,"updated":"2024-12-12 21:23:27.000000000","message":"intentional to keep these commented out lines?","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[{"line_number":109,"context_line":"            \"targets?state\u003dactive\")[\u0027data\u0027][\u0027activeTargets\u0027]"},{"line_number":110,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":111,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":112,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":113,"context_line":"        fqdn_instance_map \u003d {"},{"line_number":114,"context_line":"            fqdn: instance for (fqdn, instance) in ("},{"line_number":115,"context_line":"                (target[\u0027labels\u0027].get(self.prometheus_fqdn_label),"}],"source_content_type":"text/x-python","patch_set":19,"id":"8cfe30cd_21506715","line":112,"in_reply_to":"df78f4e3_1e8dd1f6","updated":"2024-12-13 11:34:38.000000000","message":"yeah it provides an example of the input used in the following lines 113 to 118 as an aid to someone trying to follow what is being generated as the fqdn_instance_map","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":9976,"name":"Ronelle Landy","email":"rlandy@redhat.com","username":"rlandy"},"change_message_id":"803db2cbee0e18eec006eb834487c3f42e109e6e","unresolved":true,"context_lines":[{"line_number":194,"context_line":"        (node_memory_MemTotal_bytes{instance\u003d\u0027the_host\u0027} -"},{"line_number":195,"context_line":"        avg_over_time("},{"line_number":196,"context_line":"            node_memory_MemAvailable_bytes{instance\u003d\u0027the_host\u0027}[222s]))"},{"line_number":197,"context_line":"            / 1024 / 1024"},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"        So we take total and subtract available memory to determine"},{"line_number":200,"context_line":"        how much is in use. We use the prometheus xxx_over_time functions"}],"source_content_type":"text/x-python","patch_set":19,"id":"56348e1b_26460915","line":197,"updated":"2024-12-12 21:23:27.000000000","message":"Question: where does the 222s come from?\nI see the 300s period mentioned in other datasources for the other metrics. I don\u0027t see an equivalent of this elsewhere.","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[{"line_number":194,"context_line":"        (node_memory_MemTotal_bytes{instance\u003d\u0027the_host\u0027} -"},{"line_number":195,"context_line":"        avg_over_time("},{"line_number":196,"context_line":"            node_memory_MemAvailable_bytes{instance\u003d\u0027the_host\u0027}[222s]))"},{"line_number":197,"context_line":"            / 1024 / 1024"},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"        So we take total and subtract available memory to determine"},{"line_number":200,"context_line":"        how much is in use. We use the prometheus xxx_over_time functions"}],"source_content_type":"text/x-python","patch_set":19,"id":"30a88df6_56daf72f","line":197,"in_reply_to":"56348e1b_26460915","updated":"2024-12-13 11:34:38.000000000","message":"it is just an example which I copied it from the tests, ok i will make it 300","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"02a1bda2b20dd6f7b66b8d8fb5615138f78bdcff","unresolved":true,"context_lines":[{"line_number":270,"context_line":"                \"server down?\""},{"line_number":271,"context_line":"            )"},{"line_number":272,"context_line":"            return set()"},{"line_number":273,"context_line":"        return set(response[\u0027data\u0027])"},{"line_number":274,"context_line":""},{"line_number":275,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":276,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"}],"source_content_type":"text/x-python","patch_set":19,"id":"328a1975_40425510","line":273,"range":{"start_line":273,"start_character":0,"end_line":273,"end_character":36},"updated":"2024-12-13 15:04:42.000000000","message":"is this only returning metric names?","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"8ecaf9e219f51714b5d9a9018ee8eea380c5094f","unresolved":true,"context_lines":[{"line_number":270,"context_line":"                \"server down?\""},{"line_number":271,"context_line":"            )"},{"line_number":272,"context_line":"            return set()"},{"line_number":273,"context_line":"        return set(response[\u0027data\u0027])"},{"line_number":274,"context_line":""},{"line_number":275,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":276,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"}],"source_content_type":"text/x-python","patch_set":19,"id":"6997e91b_9d203b27","line":273,"range":{"start_line":273,"start_character":0,"end_line":273,"end_character":36},"in_reply_to":"328a1975_40425510","updated":"2024-12-17 09:30:10.000000000","message":"sorry missed this one. yes example output as below\n\n```\n\u003e\u003e\u003e from observabilityclient import prometheus_client\n\u003e\u003e\u003e prometheus \u003d prometheus_client.PrometheusAPIClient(\"localhost:9090\")\n\u003e\u003e\u003e prometheus._get(\"label/__name__/values\")\n{\u0027status\u0027: \u0027success\u0027, \u0027data\u0027: [\u0027go_gc_cycles_automatic_gc_cycles_total\u0027, \u0027go_gc_cycles_forced_gc_cycles_total\u0027, \u0027go_gc_cycles_total_gc_cycles_total\u0027, \u0027go_gc_duration_seconds\u0027, \u0027go_gc_duration_seconds_count\u0027, \u0027go_gc_duration_seconds_sum\u0027, \u0027go_gc_gogc_percent\u0027, \u0027go_gc_gomemlimit_bytes\u0027, \u0027go_gc_heap_allocs_by_size_bytes_bucket\u0027, \u0027go_gc_heap_allocs_by_size_bytes_count\u0027, \u0027go_gc_heap_allocs_by_size_bytes_sum\u0027, \u0027go_gc_heap_allocs_bytes_total\u0027, \u0027go_gc_heap_allocs_objects_total\u0027, \u0027go_gc_heap_frees_by_size_bytes_bucket\u0027,\n```\n\n\nthere is also a testcase here with mock data test_prometheus_list_metrics","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"d62e04e6b3c4b4e9f315e2b58dd5d91b16a27bf7","unresolved":false,"context_lines":[{"line_number":270,"context_line":"                \"server down?\""},{"line_number":271,"context_line":"            )"},{"line_number":272,"context_line":"            return set()"},{"line_number":273,"context_line":"        return set(response[\u0027data\u0027])"},{"line_number":274,"context_line":""},{"line_number":275,"context_line":"    def statistic_aggregation(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":276,"context_line":"                              meter_name\u003dNone, period\u003d300, granularity\u003d300,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f8c4e6f_741c9ade","line":273,"range":{"start_line":273,"start_character":0,"end_line":273,"end_character":36},"in_reply_to":"6997e91b_9d203b27","updated":"2024-12-17 13:22:58.000000000","message":"Ack, thanks for the output.","commit_id":"e1d910a81caa36fe29f94601de556a2fe1ae2efa"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"cf29be709ef735d69b614104401c7e6deec4dfec","unresolved":true,"context_lines":[{"line_number":95,"context_line":"        prometheus_ca_cert \u003d CONF.prometheus_client.prometheus_ca_cert"},{"line_number":96,"context_line":"        prometheus_client_cert \u003d CONF.prometheus_client.prometheus_client_cert"},{"line_number":97,"context_line":"        prometheus_client_key \u003d CONF.prometheus_client.prometheus_client_key"},{"line_number":98,"context_line":"        if (prometheus_ca_cert and prometheus_client_cert and"},{"line_number":99,"context_line":"                prometheus_client_key):"},{"line_number":100,"context_line":"            the_client.set_ca_cert(prometheus_ca_cert)"},{"line_number":101,"context_line":"            the_client.set_client_cert(prometheus_client_cert,"},{"line_number":102,"context_line":"                                       prometheus_client_key)"},{"line_number":103,"context_line":"        elif (prometheus_user and prometheus_pass):"},{"line_number":104,"context_line":"            the_client.set_basic_auth(prometheus_user, prometheus_pass)"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"44524caa_0f71b1f4","line":102,"range":{"start_line":98,"start_character":0,"end_line":102,"end_character":61},"updated":"2024-12-18 09:41:34.000000000","message":"AFAIK, client authentication with SSL and server SSL validation are independent and can/must be configured independently. ca_cert is only the path for the CA certificate used to validate the SSL certificate provided by the prometheus server. When enabled, it forces to use https and validate the cert, but it does not imply client side certificate auth (which is enabled by set_client_cert.\n\nThis implementation is merging both, which is inconvenient, imo. In example, ssl validation of server may be a common set while client cert requires the server to enable it.","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b50adb3a487f5edcd64cc98f208d5a25b9fbc787","unresolved":true,"context_lines":[{"line_number":95,"context_line":"        prometheus_ca_cert \u003d CONF.prometheus_client.prometheus_ca_cert"},{"line_number":96,"context_line":"        prometheus_client_cert \u003d CONF.prometheus_client.prometheus_client_cert"},{"line_number":97,"context_line":"        prometheus_client_key \u003d CONF.prometheus_client.prometheus_client_key"},{"line_number":98,"context_line":"        if (prometheus_ca_cert and prometheus_client_cert and"},{"line_number":99,"context_line":"                prometheus_client_key):"},{"line_number":100,"context_line":"            the_client.set_ca_cert(prometheus_ca_cert)"},{"line_number":101,"context_line":"            the_client.set_client_cert(prometheus_client_cert,"},{"line_number":102,"context_line":"                                       prometheus_client_key)"},{"line_number":103,"context_line":"        elif (prometheus_user and prometheus_pass):"},{"line_number":104,"context_line":"            the_client.set_basic_auth(prometheus_user, prometheus_pass)"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"5f3ba23c_7ed68393","line":102,"range":{"start_line":98,"start_character":0,"end_line":102,"end_character":61},"in_reply_to":"44524caa_0f71b1f4","updated":"2024-12-18 11:38:41.000000000","message":"ack will rework the conditional a bit to do this.","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"066ea9236eb0bd26f2d5548ec4013d51a16bab13","unresolved":false,"context_lines":[{"line_number":95,"context_line":"        prometheus_ca_cert \u003d CONF.prometheus_client.prometheus_ca_cert"},{"line_number":96,"context_line":"        prometheus_client_cert \u003d CONF.prometheus_client.prometheus_client_cert"},{"line_number":97,"context_line":"        prometheus_client_key \u003d CONF.prometheus_client.prometheus_client_key"},{"line_number":98,"context_line":"        if (prometheus_ca_cert and prometheus_client_cert and"},{"line_number":99,"context_line":"                prometheus_client_key):"},{"line_number":100,"context_line":"            the_client.set_ca_cert(prometheus_ca_cert)"},{"line_number":101,"context_line":"            the_client.set_client_cert(prometheus_client_cert,"},{"line_number":102,"context_line":"                                       prometheus_client_key)"},{"line_number":103,"context_line":"        elif (prometheus_user and prometheus_pass):"},{"line_number":104,"context_line":"            the_client.set_basic_auth(prometheus_user, prometheus_pass)"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"4954d6d2_586a09aa","line":102,"range":{"start_line":98,"start_character":0,"end_line":102,"end_character":61},"in_reply_to":"5f3ba23c_7ed68393","updated":"2024-12-18 12:45:50.000000000","message":"Done","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"cf29be709ef735d69b614104401c7e6deec4dfec","unresolved":true,"context_lines":[{"line_number":374,"context_line":"            {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100))"},{"line_number":375,"context_line":"        \"\"\""},{"line_number":376,"context_line":"        cpu_usage \u003d self.statistic_aggregation("},{"line_number":377,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027,"},{"line_number":378,"context_line":"            period, granularity, aggregate)"},{"line_number":379,"context_line":"        return float(cpu_usage) if cpu_usage else cpu_usage"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"}],"source_content_type":"text/x-python","patch_set":23,"id":"fe61244c_d04d77b8","line":378,"range":{"start_line":377,"start_character":12,"end_line":378,"end_character":43},"updated":"2024-12-18 09:41:34.000000000","message":"Why not call parameters via names instead of just order?. As Sean mentioned, even if it works, it\u0027s considered a bad practice to rely in position when using named parameters.","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b50adb3a487f5edcd64cc98f208d5a25b9fbc787","unresolved":false,"context_lines":[{"line_number":374,"context_line":"            {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100))"},{"line_number":375,"context_line":"        \"\"\""},{"line_number":376,"context_line":"        cpu_usage \u003d self.statistic_aggregation("},{"line_number":377,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027,"},{"line_number":378,"context_line":"            period, granularity, aggregate)"},{"line_number":379,"context_line":"        return float(cpu_usage) if cpu_usage else cpu_usage"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"}],"source_content_type":"text/x-python","patch_set":23,"id":"a32abee1_76fc2d6a","line":378,"range":{"start_line":377,"start_character":12,"end_line":378,"end_character":43},"in_reply_to":"fe61244c_d04d77b8","updated":"2024-12-18 11:38:41.000000000","message":"ok adding","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"cf29be709ef735d69b614104401c7e6deec4dfec","unresolved":true,"context_lines":[{"line_number":376,"context_line":"        cpu_usage \u003d self.statistic_aggregation("},{"line_number":377,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027,"},{"line_number":378,"context_line":"            period, granularity, aggregate)"},{"line_number":379,"context_line":"        return float(cpu_usage) if cpu_usage else cpu_usage"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":382,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":383,"context_line":"        ram_usage \u003d self.statistic_aggregation("}],"source_content_type":"text/x-python","patch_set":23,"id":"7d043af7_db8dc291","line":380,"range":{"start_line":379,"start_character":15,"end_line":380,"end_character":1},"updated":"2024-12-18 09:41:34.000000000","message":"Nitpick. For me, it\u0027d be easier to read if:\n\nreturn float(cpu_usage) if cpu_usage else None\n\nI guess it\u0027s the same.","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b50adb3a487f5edcd64cc98f208d5a25b9fbc787","unresolved":false,"context_lines":[{"line_number":376,"context_line":"        cpu_usage \u003d self.statistic_aggregation("},{"line_number":377,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027,"},{"line_number":378,"context_line":"            period, granularity, aggregate)"},{"line_number":379,"context_line":"        return float(cpu_usage) if cpu_usage else cpu_usage"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":382,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":383,"context_line":"        ram_usage \u003d self.statistic_aggregation("}],"source_content_type":"text/x-python","patch_set":23,"id":"be79b497_53468d96","line":380,"range":{"start_line":379,"start_character":15,"end_line":380,"end_character":1},"in_reply_to":"7d043af7_db8dc291","updated":"2024-12-18 11:38:41.000000000","message":"Acknowledged","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"7a4f0520c797a56fe6e5ab89eb85f89e1b6c40d0","unresolved":false,"context_lines":[{"line_number":376,"context_line":"        cpu_usage \u003d self.statistic_aggregation("},{"line_number":377,"context_line":"            resource, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027,"},{"line_number":378,"context_line":"            period, granularity, aggregate)"},{"line_number":379,"context_line":"        return float(cpu_usage) if cpu_usage else cpu_usage"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":382,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":383,"context_line":"        ram_usage \u003d self.statistic_aggregation("}],"source_content_type":"text/x-python","patch_set":23,"id":"986abbc5_98733660","line":380,"range":{"start_line":379,"start_character":15,"end_line":380,"end_character":1},"in_reply_to":"be79b497_53468d96","updated":"2024-12-18 12:39:10.000000000","message":"Thanks for changing it.","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"7a4f0520c797a56fe6e5ab89eb85f89e1b6c40d0","unresolved":true,"context_lines":[{"line_number":100,"context_line":"            if (prometheus_client_cert and prometheus_client_key):"},{"line_number":101,"context_line":"                the_client.set_client_cert("},{"line_number":102,"context_line":"                    prometheus_client_cert, prometheus_client_key)"},{"line_number":103,"context_line":"        elif (prometheus_user and prometheus_pass):"},{"line_number":104,"context_line":"            the_client.set_basic_auth(prometheus_user, prometheus_pass)"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"        return the_client"}],"source_content_type":"text/x-python","patch_set":24,"id":"17c2cbe7_c9661315","line":103,"range":{"start_line":103,"start_character":8,"end_line":103,"end_character":51},"updated":"2024-12-18 12:39:10.000000000","message":"We may have basic auth on https but this logic would not allow it to work. I\u0027d do this a separate if instead of an elif.","commit_id":"7c3de9f907c380557ec2adfca808e39b4a907699"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"066ea9236eb0bd26f2d5548ec4013d51a16bab13","unresolved":false,"context_lines":[{"line_number":100,"context_line":"            if (prometheus_client_cert and prometheus_client_key):"},{"line_number":101,"context_line":"                the_client.set_client_cert("},{"line_number":102,"context_line":"                    prometheus_client_cert, prometheus_client_key)"},{"line_number":103,"context_line":"        elif (prometheus_user and prometheus_pass):"},{"line_number":104,"context_line":"            the_client.set_basic_auth(prometheus_user, prometheus_pass)"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"        return the_client"}],"source_content_type":"text/x-python","patch_set":24,"id":"4ad9e01c_592ae71a","line":103,"range":{"start_line":103,"start_character":8,"end_line":103,"end_character":51},"in_reply_to":"17c2cbe7_c9661315","updated":"2024-12-18 12:45:50.000000000","message":"ack thanks for the note. i thought this would always be an else if thing and not both. will update then","commit_id":"7c3de9f907c380557ec2adfca808e39b4a907699"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"0a0d3779416b16b4a0a241c9af17370ea1b3fc36","unresolved":true,"context_lines":[{"line_number":82,"context_line":"                the prometheus_host_port cannot be validated as being"},{"line_number":83,"context_line":"                in host:port format (with a valid hostname and port)."},{"line_number":84,"context_line":"        \"\"\""},{"line_number":85,"context_line":"        def _validate_host_port(hp):"},{"line_number":86,"context_line":"            try:"},{"line_number":87,"context_line":"                host, port \u003d hp.split(\u0027:\u0027)"},{"line_number":88,"context_line":"            except (AttributeError, ValueError):"}],"source_content_type":"text/x-python","patch_set":27,"id":"d8930d67_24801026","line":85,"range":{"start_line":85,"start_character":12,"end_line":85,"end_character":31},"updated":"2024-12-19 17:59:23.000000000","message":"I understand that your approach is to provide detailed error message, which is great, but in the way that is implemented, these strings are not going to be translated as expected. See [1].\n\n[1] https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#using-a-marker-function","commit_id":"b597acdcf2ab0687c13a80bbd93ab0f460b58711"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"cffd493aab2a20f9ed00096157b39a6599d4ec02","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                the prometheus_host_port cannot be validated as being"},{"line_number":83,"context_line":"                in host:port format (with a valid hostname and port)."},{"line_number":84,"context_line":"        \"\"\""},{"line_number":85,"context_line":"        def _validate_host_port(hp):"},{"line_number":86,"context_line":"            try:"},{"line_number":87,"context_line":"                host, port \u003d hp.split(\u0027:\u0027)"},{"line_number":88,"context_line":"            except (AttributeError, ValueError):"}],"source_content_type":"text/x-python","patch_set":27,"id":"4dad7176_09799dd9","line":85,"range":{"start_line":85,"start_character":12,"end_line":85,"end_character":31},"in_reply_to":"031a9e2e_0f1294a7","updated":"2025-01-08 08:13:19.000000000","message":"given your review yesterday marking this one done","commit_id":"b597acdcf2ab0687c13a80bbd93ab0f460b58711"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"14eaf3118dbae08adbe382caca7d6e87e044a643","unresolved":true,"context_lines":[{"line_number":82,"context_line":"                the prometheus_host_port cannot be validated as being"},{"line_number":83,"context_line":"                in host:port format (with a valid hostname and port)."},{"line_number":84,"context_line":"        \"\"\""},{"line_number":85,"context_line":"        def _validate_host_port(hp):"},{"line_number":86,"context_line":"            try:"},{"line_number":87,"context_line":"                host, port \u003d hp.split(\u0027:\u0027)"},{"line_number":88,"context_line":"            except (AttributeError, ValueError):"}],"source_content_type":"text/x-python","patch_set":27,"id":"031a9e2e_0f1294a7","line":85,"range":{"start_line":85,"start_character":12,"end_line":85,"end_character":31},"in_reply_to":"43ceaaa5_29fa9e0f","updated":"2025-01-06 09:00:50.000000000","message":"I\u0027d like to mark this resolved @viroel@gmail.com do you agree?","commit_id":"b597acdcf2ab0687c13a80bbd93ab0f460b58711"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"256a823cef63915d4526d081a582d8721338103d","unresolved":true,"context_lines":[{"line_number":82,"context_line":"                the prometheus_host_port cannot be validated as being"},{"line_number":83,"context_line":"                in host:port format (with a valid hostname and port)."},{"line_number":84,"context_line":"        \"\"\""},{"line_number":85,"context_line":"        def _validate_host_port(hp):"},{"line_number":86,"context_line":"            try:"},{"line_number":87,"context_line":"                host, port \u003d hp.split(\u0027:\u0027)"},{"line_number":88,"context_line":"            except (AttributeError, ValueError):"}],"source_content_type":"text/x-python","patch_set":27,"id":"43ceaaa5_29fa9e0f","line":85,"range":{"start_line":85,"start_character":12,"end_line":85,"end_character":31},"in_reply_to":"d8930d67_24801026","updated":"2024-12-20 10:11:20.000000000","message":"i am not sure how to address the concern though since in this case it is not log or exception handling. the function returns strings. \n\nI will put the marker on the actual exception logged below on line 116","commit_id":"b597acdcf2ab0687c13a80bbd93ab0f460b58711"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"a948d0621661512fca641b95fab9aba8f1e032c2","unresolved":true,"context_lines":[{"line_number":63,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":64,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":65,"context_line":"        )"},{"line_number":66,"context_line":"        self.prometheus_fqdn_instance_map \u003d ("},{"line_number":67,"context_line":"            self._build_prometheus_fqdn_instance_map()"},{"line_number":68,"context_line":"        )"},{"line_number":69,"context_line":"        self.prometheus_host_instance_map \u003d ("}],"source_content_type":"text/x-python","patch_set":29,"id":"531c4c01_03404596","line":66,"updated":"2025-01-08 09:18:32.000000000","message":"Reading this code again, I have a doubt. We are creating this map at driver initialization and creating a static map. That means that if a host is added later, it will not be in cluded in the map.\n\nMy question is, is the driver just initialized once when the decision engine is started or is it initialized on each audit execution?, if it\u0027s the first case, we may easily have problems with new hosts added to the cluster.","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":64,"context_line":"            CONF.prometheus_client.prometheus_fqdn_label"},{"line_number":65,"context_line":"        )"},{"line_number":66,"context_line":"        self.prometheus_fqdn_instance_map \u003d ("},{"line_number":67,"context_line":"            self._build_prometheus_fqdn_instance_map()"},{"line_number":68,"context_line":"        )"},{"line_number":69,"context_line":"        self.prometheus_host_instance_map \u003d ("}],"source_content_type":"text/x-python","patch_set":29,"id":"244da3a4_cc493c5f","line":66,"in_reply_to":"531c4c01_03404596","updated":"2025-01-09 15:23:36.000000000","message":"ack as discussed yesterday will update with a retry in the lookup function\ncoming in v30","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"67a793366a63caa7429da568bf6f131c4f899ff9","unresolved":true,"context_lines":[{"line_number":82,"context_line":"                the prometheus_host_port cannot be validated as being"},{"line_number":83,"context_line":"                in host:port format (with a valid hostname and port)."},{"line_number":84,"context_line":"        \"\"\""},{"line_number":85,"context_line":"        def _validate_host_port(hp):"},{"line_number":86,"context_line":"            try:"},{"line_number":87,"context_line":"                host, port \u003d hp.split(\u0027:\u0027)"},{"line_number":88,"context_line":"            except (AttributeError, ValueError):"},{"line_number":89,"context_line":"                return (False, \"Does not contain exactly one \u0027:\u0027 in \u0027%s\u0027 \""},{"line_number":90,"context_line":"                        % hp)"},{"line_number":91,"context_line":"            if len(host) \u003e 255:"},{"line_number":92,"context_line":"                return (False, \"hostname is too long: \u0027%s\u0027\" % host)"},{"line_number":93,"context_line":"            if host[-1] \u003d\u003d \u0027.\u0027:"},{"line_number":94,"context_line":"                host \u003d host[:-1]"},{"line_number":95,"context_line":"            legal_hostname \u003d re.compile("},{"line_number":96,"context_line":"                \"(?!-)[a-z0-9-]{1,63}(?\u003c!-)$\", re.IGNORECASE)"},{"line_number":97,"context_line":"            if not all(legal_hostname.match(host_part)"},{"line_number":98,"context_line":"                       for host_part in host.split(\".\")):"},{"line_number":99,"context_line":"                return (False, \"hostname \u0027%s\u0027 failed regex match \" % host)"},{"line_number":100,"context_line":"            try:"},{"line_number":101,"context_line":"                assert bool(1 \u003c\u003d int(port) \u003c\u003d 65535)"},{"line_number":102,"context_line":"            except (AssertionError, ValueError):"},{"line_number":103,"context_line":"                return (False, \"missing or invalid port number \u0027%s\u0027 \""},{"line_number":104,"context_line":"                        % port)"},{"line_number":105,"context_line":"            return (True, \"all good\")"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        _host_port \u003d CONF.prometheus_client.prometheus_host_port"},{"line_number":108,"context_line":"        if (not _host_port or not _host_port.strip()):"},{"line_number":109,"context_line":"            raise exception.MissingParameter("}],"source_content_type":"text/x-python","patch_set":29,"id":"99edf092_eeb755c1","line":106,"range":{"start_line":85,"start_character":6,"end_line":106,"end_character":1},"updated":"2025-01-08 16:30:40.000000000","message":"there are exisign oslo cofnig type sfor this validation that we can reuse to soem extend so we can remove or simplify this if we refactor them as noted elsewhere in teh review.","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":true,"context_lines":[{"line_number":82,"context_line":"                the prometheus_host_port cannot be validated as being"},{"line_number":83,"context_line":"                in host:port format (with a valid hostname and port)."},{"line_number":84,"context_line":"        \"\"\""},{"line_number":85,"context_line":"        def _validate_host_port(hp):"},{"line_number":86,"context_line":"            try:"},{"line_number":87,"context_line":"                host, port \u003d hp.split(\u0027:\u0027)"},{"line_number":88,"context_line":"            except (AttributeError, ValueError):"},{"line_number":89,"context_line":"                return (False, \"Does not contain exactly one \u0027:\u0027 in \u0027%s\u0027 \""},{"line_number":90,"context_line":"                        % hp)"},{"line_number":91,"context_line":"            if len(host) \u003e 255:"},{"line_number":92,"context_line":"                return (False, \"hostname is too long: \u0027%s\u0027\" % host)"},{"line_number":93,"context_line":"            if host[-1] \u003d\u003d \u0027.\u0027:"},{"line_number":94,"context_line":"                host \u003d host[:-1]"},{"line_number":95,"context_line":"            legal_hostname \u003d re.compile("},{"line_number":96,"context_line":"                \"(?!-)[a-z0-9-]{1,63}(?\u003c!-)$\", re.IGNORECASE)"},{"line_number":97,"context_line":"            if not all(legal_hostname.match(host_part)"},{"line_number":98,"context_line":"                       for host_part in host.split(\".\")):"},{"line_number":99,"context_line":"                return (False, \"hostname \u0027%s\u0027 failed regex match \" % host)"},{"line_number":100,"context_line":"            try:"},{"line_number":101,"context_line":"                assert bool(1 \u003c\u003d int(port) \u003c\u003d 65535)"},{"line_number":102,"context_line":"            except (AssertionError, ValueError):"},{"line_number":103,"context_line":"                return (False, \"missing or invalid port number \u0027%s\u0027 \""},{"line_number":104,"context_line":"                        % port)"},{"line_number":105,"context_line":"            return (True, \"all good\")"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        _host_port \u003d CONF.prometheus_client.prometheus_host_port"},{"line_number":108,"context_line":"        if (not _host_port or not _host_port.strip()):"},{"line_number":109,"context_line":"            raise exception.MissingParameter("}],"source_content_type":"text/x-python","patch_set":29,"id":"b1fad373_7ceb11c3","line":106,"range":{"start_line":85,"start_character":6,"end_line":106,"end_character":1},"in_reply_to":"99edf092_eeb755c1","updated":"2025-01-09 15:23:36.000000000","message":"i\u0027ll update the names to conform to the expected formats but will re-working this validation with oslo config types as future work agreed?","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c041481a683e2e3666032e193951ab6b0dfd1052","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                the prometheus_host_port cannot be validated as being"},{"line_number":83,"context_line":"                in host:port format (with a valid hostname and port)."},{"line_number":84,"context_line":"        \"\"\""},{"line_number":85,"context_line":"        def _validate_host_port(hp):"},{"line_number":86,"context_line":"            try:"},{"line_number":87,"context_line":"                host, port \u003d hp.split(\u0027:\u0027)"},{"line_number":88,"context_line":"            except (AttributeError, ValueError):"},{"line_number":89,"context_line":"                return (False, \"Does not contain exactly one \u0027:\u0027 in \u0027%s\u0027 \""},{"line_number":90,"context_line":"                        % hp)"},{"line_number":91,"context_line":"            if len(host) \u003e 255:"},{"line_number":92,"context_line":"                return (False, \"hostname is too long: \u0027%s\u0027\" % host)"},{"line_number":93,"context_line":"            if host[-1] \u003d\u003d \u0027.\u0027:"},{"line_number":94,"context_line":"                host \u003d host[:-1]"},{"line_number":95,"context_line":"            legal_hostname \u003d re.compile("},{"line_number":96,"context_line":"                \"(?!-)[a-z0-9-]{1,63}(?\u003c!-)$\", re.IGNORECASE)"},{"line_number":97,"context_line":"            if not all(legal_hostname.match(host_part)"},{"line_number":98,"context_line":"                       for host_part in host.split(\".\")):"},{"line_number":99,"context_line":"                return (False, \"hostname \u0027%s\u0027 failed regex match \" % host)"},{"line_number":100,"context_line":"            try:"},{"line_number":101,"context_line":"                assert bool(1 \u003c\u003d int(port) \u003c\u003d 65535)"},{"line_number":102,"context_line":"            except (AssertionError, ValueError):"},{"line_number":103,"context_line":"                return (False, \"missing or invalid port number \u0027%s\u0027 \""},{"line_number":104,"context_line":"                        % port)"},{"line_number":105,"context_line":"            return (True, \"all good\")"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        _host_port \u003d CONF.prometheus_client.prometheus_host_port"},{"line_number":108,"context_line":"        if (not _host_port or not _host_port.strip()):"},{"line_number":109,"context_line":"            raise exception.MissingParameter("}],"source_content_type":"text/x-python","patch_set":29,"id":"7adc435a_1e11dd96","line":106,"range":{"start_line":85,"start_character":6,"end_line":106,"end_character":1},"in_reply_to":"b1fad373_7ceb11c3","updated":"2025-01-10 10:35:12.000000000","message":"Acknowledged","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"0ac546c7ab034e7e2e1867c6caf78f1edc98dda0","unresolved":true,"context_lines":[{"line_number":224,"context_line":"        if not instance_label:"},{"line_number":225,"context_line":"            LOG.error(\"Cannot query prometheus without instance label. \""},{"line_number":226,"context_line":"                      \"Could not resolve %s\", node_name)"},{"line_number":227,"context_line":"            return None"},{"line_number":228,"context_line":"        return instance_label"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"    def _resolve_prometheus_aggregate(self, watcher_aggregate, meter):"}],"source_content_type":"text/x-python","patch_set":29,"id":"4343083c_a771d4cb","line":227,"updated":"2025-01-08 12:44:17.000000000","message":"rebuild the fqdn instance map here and retry","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"67a793366a63caa7429da568bf6f131c4f899ff9","unresolved":true,"context_lines":[{"line_number":224,"context_line":"        if not instance_label:"},{"line_number":225,"context_line":"            LOG.error(\"Cannot query prometheus without instance label. \""},{"line_number":226,"context_line":"                      \"Could not resolve %s\", node_name)"},{"line_number":227,"context_line":"            return None"},{"line_number":228,"context_line":"        return instance_label"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"    def _resolve_prometheus_aggregate(self, watcher_aggregate, meter):"}],"source_content_type":"text/x-python","patch_set":29,"id":"77fd0dfc_35e275f5","line":227,"in_reply_to":"4343083c_a771d4cb","updated":"2025-01-08 16:30:40.000000000","message":"for context of other we disccsoed this offline.\n\nthe intent of the prometheus_fqdn_instance_map is to act as a cache in memory so that we do not need to consuct this data stucture for every query.\n\nthe suggestion here to aovid needing to restart the deciosn engine every time a new host is added to the cloud is as follows.\n\nif instance_label is None then we shoudl attempt to rebuild the map once and see if we find the mapping.\nif that fail then we shoudl raise an error and return none.\n\n\nthe prometheus_fqdn_instance_map is intended to be a cache and like all caches it needs to be refreshsed form time to time and this is how we propsoe to refreh it without requireing a restart or perodic task to heal it.","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":false,"context_lines":[{"line_number":224,"context_line":"        if not instance_label:"},{"line_number":225,"context_line":"            LOG.error(\"Cannot query prometheus without instance label. \""},{"line_number":226,"context_line":"                      \"Could not resolve %s\", node_name)"},{"line_number":227,"context_line":"            return None"},{"line_number":228,"context_line":"        return instance_label"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"    def _resolve_prometheus_aggregate(self, watcher_aggregate, meter):"}],"source_content_type":"text/x-python","patch_set":29,"id":"aa130ed9_39f67a8e","line":227,"in_reply_to":"77fd0dfc_35e275f5","updated":"2025-01-09 15:23:36.000000000","message":"doing in v30","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"67a793366a63caa7429da568bf6f131c4f899ff9","unresolved":true,"context_lines":[{"line_number":250,"context_line":"                           \"resolve to any valid prometheus query aggregate.\")"},{"line_number":251,"context_line":"                         % watcher_aggregate)"},{"line_number":252,"context_line":"            )"},{"line_number":253,"context_line":"        \"\"\" Invert max and min for node/host metric queries from node-exporter"},{"line_number":254,"context_line":"            because we query for \u0027idle\u0027/\u0027unused\u0027 cpu and memory."},{"line_number":255,"context_line":"            For Watcher \u0027max cpu used\u0027 we query for prometheus \u0027min idle time\u0027."},{"line_number":256,"context_line":"            For Watcher \u0027max memory used\u0027 we retrieve min \u0027unused\u0027/\u0027available\u0027"},{"line_number":257,"context_line":"            memory from Prometheus."},{"line_number":258,"context_line":"        \"\"\""},{"line_number":259,"context_line":"        if \u0027node_\u0027 in meter:"},{"line_number":260,"context_line":"            promql_aggregate \u003d _invert_max_min(promql_aggregate)"},{"line_number":261,"context_line":"        return promql_aggregate"},{"line_number":262,"context_line":""},{"line_number":263,"context_line":"    def _build_prometheus_query(self, aggregate, meter, instance_label,"}],"source_content_type":"text/x-python","patch_set":29,"id":"22de4de8_d165df4f","line":260,"range":{"start_line":253,"start_character":7,"end_line":260,"end_character":64},"updated":"2025-01-08 16:30:40.000000000","message":"this is stil a bit fo a hack IMO.","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":false,"context_lines":[{"line_number":250,"context_line":"                           \"resolve to any valid prometheus query aggregate.\")"},{"line_number":251,"context_line":"                         % watcher_aggregate)"},{"line_number":252,"context_line":"            )"},{"line_number":253,"context_line":"        \"\"\" Invert max and min for node/host metric queries from node-exporter"},{"line_number":254,"context_line":"            because we query for \u0027idle\u0027/\u0027unused\u0027 cpu and memory."},{"line_number":255,"context_line":"            For Watcher \u0027max cpu used\u0027 we query for prometheus \u0027min idle time\u0027."},{"line_number":256,"context_line":"            For Watcher \u0027max memory used\u0027 we retrieve min \u0027unused\u0027/\u0027available\u0027"},{"line_number":257,"context_line":"            memory from Prometheus."},{"line_number":258,"context_line":"        \"\"\""},{"line_number":259,"context_line":"        if \u0027node_\u0027 in meter:"},{"line_number":260,"context_line":"            promql_aggregate \u003d _invert_max_min(promql_aggregate)"},{"line_number":261,"context_line":"        return promql_aggregate"},{"line_number":262,"context_line":""},{"line_number":263,"context_line":"    def _build_prometheus_query(self, aggregate, meter, instance_label,"}],"source_content_type":"text/x-python","patch_set":29,"id":"8f95557d_d441544a","line":260,"range":{"start_line":253,"start_character":7,"end_line":260,"end_character":64},"in_reply_to":"22de4de8_d165df4f","updated":"2025-01-09 15:23:36.000000000","message":"ok i\u0027ve given this a go as well for v30, pushed into the get_host functions as you suggested below","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"67a793366a63caa7429da568bf6f131c4f899ff9","unresolved":true,"context_lines":[{"line_number":306,"context_line":"                       \u0027inst\u0027: instance_label, \u0027prd\u0027: period})"},{"line_number":307,"context_line":"            )"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"        if meter \u003d\u003d \u0027node_cpu_seconds_total\u0027:"},{"line_number":310,"context_line":"            query_args \u003d ("},{"line_number":311,"context_line":"                \"100 - (%s by (instance)(rate(%s\""},{"line_number":312,"context_line":"                \"{mode\u003d\u0027idle\u0027,instance\u003d\u0027%s\u0027}[%ss])) * 100)\" %"},{"line_number":313,"context_line":"                (aggregate, meter, instance_label, period)"},{"line_number":314,"context_line":"            )"},{"line_number":315,"context_line":"        elif meter \u003d\u003d \u0027node_memory_MemAvailable_bytes\u0027:"},{"line_number":316,"context_line":"            query_args \u003d ("},{"line_number":317,"context_line":"                \"(node_memory_MemTotal_bytes{instance\u003d\u0027%s\u0027} \""},{"line_number":318,"context_line":"                \"- %s_over_time(%s{instance\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":319,"context_line":"                \"/ 1024 / 1024\" %"},{"line_number":320,"context_line":"                (instance_label, aggregate, meter,"},{"line_number":321,"context_line":"                 instance_label, period)"},{"line_number":322,"context_line":"            )"},{"line_number":323,"context_line":"        else:"},{"line_number":324,"context_line":"            raise exception.InvalidParameter("},{"line_number":325,"context_line":"                message\u003d(_(\"Cannot process prometheus meter %s\") % meter)"}],"source_content_type":"text/x-python","patch_set":29,"id":"29be44be_a7b2b368","line":322,"range":{"start_line":309,"start_character":6,"end_line":322,"end_character":13},"updated":"2025-01-08 16:30:40.000000000","message":"we coudl do the inversion here also but i think it would be better to keep this simple and externalise that to the calling funtions.","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":false,"context_lines":[{"line_number":306,"context_line":"                       \u0027inst\u0027: instance_label, \u0027prd\u0027: period})"},{"line_number":307,"context_line":"            )"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"        if meter \u003d\u003d \u0027node_cpu_seconds_total\u0027:"},{"line_number":310,"context_line":"            query_args \u003d ("},{"line_number":311,"context_line":"                \"100 - (%s by (instance)(rate(%s\""},{"line_number":312,"context_line":"                \"{mode\u003d\u0027idle\u0027,instance\u003d\u0027%s\u0027}[%ss])) * 100)\" %"},{"line_number":313,"context_line":"                (aggregate, meter, instance_label, period)"},{"line_number":314,"context_line":"            )"},{"line_number":315,"context_line":"        elif meter \u003d\u003d \u0027node_memory_MemAvailable_bytes\u0027:"},{"line_number":316,"context_line":"            query_args \u003d ("},{"line_number":317,"context_line":"                \"(node_memory_MemTotal_bytes{instance\u003d\u0027%s\u0027} \""},{"line_number":318,"context_line":"                \"- %s_over_time(%s{instance\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":319,"context_line":"                \"/ 1024 / 1024\" %"},{"line_number":320,"context_line":"                (instance_label, aggregate, meter,"},{"line_number":321,"context_line":"                 instance_label, period)"},{"line_number":322,"context_line":"            )"},{"line_number":323,"context_line":"        else:"},{"line_number":324,"context_line":"            raise exception.InvalidParameter("},{"line_number":325,"context_line":"                message\u003d(_(\"Cannot process prometheus meter %s\") % meter)"}],"source_content_type":"text/x-python","patch_set":29,"id":"0058e780_3d527898","line":322,"range":{"start_line":309,"start_character":6,"end_line":322,"end_character":13},"in_reply_to":"29be44be_a7b2b368","updated":"2025-01-09 15:23:36.000000000","message":"Acknowledged","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"67a793366a63caa7429da568bf6f131c4f899ff9","unresolved":true,"context_lines":[{"line_number":400,"context_line":"            _(\u0027Prometheus helper currently does not support statistic_series. \u0027"},{"line_number":401,"context_line":"              \u0027This can be considered for future enhancement.\u0027))"},{"line_number":402,"context_line":""},{"line_number":403,"context_line":"    def get_host_cpu_usage(self, resource, period\u003d300,"},{"line_number":404,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":405,"context_line":"        \"\"\"Query prometheus for node_cpu_seconds_total"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":"        This calculates the host cpu usage and returns it as a percentage"},{"line_number":408,"context_line":"        The calculation is made by using the cpu \u0027idle\u0027 time, per"},{"line_number":409,"context_line":"        instance (so all CPUs are included). For example the query looks like"},{"line_number":410,"context_line":"        (100 - (avg by (instance)(rate(node_cpu_seconds_total"},{"line_number":411,"context_line":"            {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100))"},{"line_number":412,"context_line":"        \"\"\""},{"line_number":413,"context_line":"        cpu_usage \u003d self.statistic_aggregation("},{"line_number":414,"context_line":"            resource, \u0027compute_node\u0027,"},{"line_number":415,"context_line":"            \u0027host_cpu_usage\u0027, period\u003dperiod,"},{"line_number":416,"context_line":"            granularity\u003dgranularity, aggregate\u003daggregate)"},{"line_number":417,"context_line":"        return float(cpu_usage) if cpu_usage else None"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":420,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":421,"context_line":"        ram_usage \u003d self.statistic_aggregation("},{"line_number":422,"context_line":"            resource, \u0027compute_node\u0027,"},{"line_number":423,"context_line":"            \u0027host_ram_usage\u0027, period\u003dperiod,"},{"line_number":424,"context_line":"            granularity\u003dgranularity, aggregate\u003daggregate)"},{"line_number":425,"context_line":"        return float(ram_usage) if ram_usage else None"}],"source_content_type":"text/x-python","patch_set":29,"id":"0154a3ba_e0b106ad","line":424,"range":{"start_line":403,"start_character":0,"end_line":424,"end_character":56},"updated":"2025-01-08 16:30:40.000000000","message":"or better ye do it here\n\ni think assumign we woudl want to invert any metric that begins with node_ as done in \n_resolve_prometheus_aggregate_resolve_prometheus_aggregate is likely going to be technial debth we may have to refactor later.","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b52715c22bc218558ecca7b6b756986c28d5bdf8","unresolved":false,"context_lines":[{"line_number":400,"context_line":"            _(\u0027Prometheus helper currently does not support statistic_series. \u0027"},{"line_number":401,"context_line":"              \u0027This can be considered for future enhancement.\u0027))"},{"line_number":402,"context_line":""},{"line_number":403,"context_line":"    def get_host_cpu_usage(self, resource, period\u003d300,"},{"line_number":404,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":405,"context_line":"        \"\"\"Query prometheus for node_cpu_seconds_total"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":"        This calculates the host cpu usage and returns it as a percentage"},{"line_number":408,"context_line":"        The calculation is made by using the cpu \u0027idle\u0027 time, per"},{"line_number":409,"context_line":"        instance (so all CPUs are included). For example the query looks like"},{"line_number":410,"context_line":"        (100 - (avg by (instance)(rate(node_cpu_seconds_total"},{"line_number":411,"context_line":"            {mode\u003d\u0027idle\u0027,instance\u003d\u0027localhost:9100\u0027}[300s])) * 100))"},{"line_number":412,"context_line":"        \"\"\""},{"line_number":413,"context_line":"        cpu_usage \u003d self.statistic_aggregation("},{"line_number":414,"context_line":"            resource, \u0027compute_node\u0027,"},{"line_number":415,"context_line":"            \u0027host_cpu_usage\u0027, period\u003dperiod,"},{"line_number":416,"context_line":"            granularity\u003dgranularity, aggregate\u003daggregate)"},{"line_number":417,"context_line":"        return float(cpu_usage) if cpu_usage else None"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":"    def get_host_ram_usage(self, resource, period\u003d300,"},{"line_number":420,"context_line":"                           aggregate\u003d\"mean\", granularity\u003dNone):"},{"line_number":421,"context_line":"        ram_usage \u003d self.statistic_aggregation("},{"line_number":422,"context_line":"            resource, \u0027compute_node\u0027,"},{"line_number":423,"context_line":"            \u0027host_ram_usage\u0027, period\u003dperiod,"},{"line_number":424,"context_line":"            granularity\u003dgranularity, aggregate\u003daggregate)"},{"line_number":425,"context_line":"        return float(ram_usage) if ram_usage else None"}],"source_content_type":"text/x-python","patch_set":29,"id":"98897d70_e081c48e","line":424,"range":{"start_line":403,"start_character":0,"end_line":424,"end_character":56},"in_reply_to":"0154a3ba_e0b106ad","updated":"2025-01-09 15:23:36.000000000","message":"ok i like the suggestion to push the inversion here. adding this for v30","commit_id":"244ce3387e0f07cddb56b29c468d8495225544bf"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"66d5ecf4333a1da53ee0b120b17e5d323eccd65c","unresolved":true,"context_lines":[{"line_number":388,"context_line":"            ignored_exc\u003dprometheus_client.PrometheusAPIClientError,"},{"line_number":389,"context_line":"        )"},{"line_number":390,"context_line":""},{"line_number":391,"context_line":"        return result[0].value if result else None"},{"line_number":392,"context_line":""},{"line_number":393,"context_line":"    def statistic_series(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":394,"context_line":"                         meter_name\u003dNone, start_time\u003dNone, end_time\u003dNone,"}],"source_content_type":"text/x-python","patch_set":32,"id":"105d7b02_a67ab17b","line":391,"updated":"2025-01-09 15:59:57.000000000","message":"statistic_aggregation is returning a string which is casted into a float in get_host* functions.\n\nHoever, statistic_aggregation is called directly from strategies and it expects a some numeric type that it can work with. An example:\n\nhttps://github.com/openstack/watcher/blob/master/watcher/decision_engine/strategy/strategies/workload_balance.py#L230-L232\n\nand:\n\nhttps://github.com/openstack/watcher/blob/master/watcher/decision_engine/strategy/strategies/workload_balance.py#L230-L232\n\nI\u0027d say we need to cast to a float here instead of in get_ methods?.","commit_id":"83b07fa8d308a4fbd05518f60b9d71804677d227"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d78f2e474feba6be404069a87bcf0f7b063ac9ba","unresolved":true,"context_lines":[{"line_number":388,"context_line":"            ignored_exc\u003dprometheus_client.PrometheusAPIClientError,"},{"line_number":389,"context_line":"        )"},{"line_number":390,"context_line":""},{"line_number":391,"context_line":"        return result[0].value if result else None"},{"line_number":392,"context_line":""},{"line_number":393,"context_line":"    def statistic_series(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":394,"context_line":"                         meter_name\u003dNone, start_time\u003dNone, end_time\u003dNone,"}],"source_content_type":"text/x-python","patch_set":32,"id":"62e2128c_9e180a0f","line":391,"in_reply_to":"105d7b02_a67ab17b","updated":"2025-01-09 21:03:47.000000000","message":"ya i think that makse sense\n\njust thinking about this logically the aggration function are all maticamatical meaning we shoudl aleasy return a number reuslt and defing that to alwasy be a float i think its ok for out useage.\n\nso \nupdating this to \n```\n\n return float(result[0].value) if result else None\n \n```\n\nis more correct i agree.","commit_id":"83b07fa8d308a4fbd05518f60b9d71804677d227"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"a7423f336bffef3b527ceff106ace4d338262a8a","unresolved":false,"context_lines":[{"line_number":388,"context_line":"            ignored_exc\u003dprometheus_client.PrometheusAPIClientError,"},{"line_number":389,"context_line":"        )"},{"line_number":390,"context_line":""},{"line_number":391,"context_line":"        return result[0].value if result else None"},{"line_number":392,"context_line":""},{"line_number":393,"context_line":"    def statistic_series(self, resource\u003dNone, resource_type\u003dNone,"},{"line_number":394,"context_line":"                         meter_name\u003dNone, start_time\u003dNone, end_time\u003dNone,"}],"source_content_type":"text/x-python","patch_set":32,"id":"f58eb148_6a31855b","line":391,"in_reply_to":"62e2128c_9e180a0f","updated":"2025-01-10 08:44:47.000000000","message":"i actually wanted to do this initially (cast in the statistic series before returning) however, according to base.py doctext the return type here \u0027depends\u0027 ;)\n\nlooking at the actual calling functions in base.py, it seems only ``def get_instance_l3_cache_usage`` is the odd one out returning an integer. the rest all return floats.\n\nI\u0027d say its safe enough for us to use float here and we can deal with ``get_instance_l3_cache_usage`` as the exception (we could cast to int there, if that function is implemented at some point)","commit_id":"83b07fa8d308a4fbd05518f60b9d71804677d227"}],"watcher/tests/decision_engine/datasources/test_prometheus_helper.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":22,"context_line":"from watcher.tests import base"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"@mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027query\u0027)"},{"line_number":26,"context_line":"@mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":27,"context_line":"class TestPrometheusHelper(base.BaseTestCase):"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    def setUp(self):"}],"source_content_type":"text/x-python","patch_set":12,"id":"0b69f090_97da7fd5","line":26,"range":{"start_line":25,"start_character":0,"end_line":26,"end_character":65},"updated":"2024-11-25 16:28:29.000000000","message":"you can do this but this is pretty uncommon in most openstack proejcts\n\nwe generally perfer to use fixtures set up in the setUp funciton\n\nas it makes it hard to reason about the order of mocks in the test if you have class and fucntionl level decorators.\n\nso in genreall we dont use teh class level ones at all.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"98f569cc1463cb3dcc2d8647e39bc77c4db012b5","unresolved":false,"context_lines":[{"line_number":22,"context_line":"from watcher.tests import base"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"@mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027query\u0027)"},{"line_number":26,"context_line":"@mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":27,"context_line":"class TestPrometheusHelper(base.BaseTestCase):"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    def setUp(self):"}],"source_content_type":"text/x-python","patch_set":12,"id":"998bba80_a0bb3b8e","line":26,"range":{"start_line":25,"start_character":0,"end_line":26,"end_character":65},"in_reply_to":"0b69f090_97da7fd5","updated":"2024-11-28 16:25:17.000000000","message":"ack moved these","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":41,"context_line":"                    }}"},{"line_number":42,"context_line":"                ]}}):"},{"line_number":43,"context_line":"            self.helper \u003d prometheus_helper.PrometheusHelper()"},{"line_number":44,"context_line":"        stat_agg_patcher \u003d mock.patch.object("},{"line_number":45,"context_line":"            self.helper, \u0027statistic_aggregation\u0027,"},{"line_number":46,"context_line":"            spec\u003dprometheus_helper.PrometheusHelper.statistic_aggregation)"},{"line_number":47,"context_line":"        self.mock_aggregation \u003d stat_agg_patcher.start()"},{"line_number":48,"context_line":"        self.addCleanup(stat_agg_patcher.stop)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def test_prometheus_statistic_aggregation(self, mock_prometheus_get,"},{"line_number":51,"context_line":"                                              mock_prometheus_query):"}],"source_content_type":"text/x-python","patch_set":12,"id":"477b253e_065c4ae8","line":48,"range":{"start_line":44,"start_character":0,"end_line":48,"end_character":46},"updated":"2024-11-25 16:28:29.000000000","message":"while techncally fine we should prefer usign \n\nself.useFixture(fixtures.MockFixture(...))\n\nwe can clean this up in a follow up.\n\nin general you shoudl not be starting the Patcher and adding the cleanup function manually.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"98f569cc1463cb3dcc2d8647e39bc77c4db012b5","unresolved":true,"context_lines":[{"line_number":41,"context_line":"                    }}"},{"line_number":42,"context_line":"                ]}}):"},{"line_number":43,"context_line":"            self.helper \u003d prometheus_helper.PrometheusHelper()"},{"line_number":44,"context_line":"        stat_agg_patcher \u003d mock.patch.object("},{"line_number":45,"context_line":"            self.helper, \u0027statistic_aggregation\u0027,"},{"line_number":46,"context_line":"            spec\u003dprometheus_helper.PrometheusHelper.statistic_aggregation)"},{"line_number":47,"context_line":"        self.mock_aggregation \u003d stat_agg_patcher.start()"},{"line_number":48,"context_line":"        self.addCleanup(stat_agg_patcher.stop)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def test_prometheus_statistic_aggregation(self, mock_prometheus_get,"},{"line_number":51,"context_line":"                                              mock_prometheus_query):"}],"source_content_type":"text/x-python","patch_set":12,"id":"d6b9650b_48f7e292","line":48,"range":{"start_line":44,"start_character":0,"end_line":48,"end_character":46},"in_reply_to":"477b253e_065c4ae8","updated":"2024-11-28 16:25:17.000000000","message":"for this i was again following convention from the other datasource tests. i can update but will need some more clarification please about the change you\u0027d like","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"dded3ad64a928b080bc80e98539de8a5315dad1e","unresolved":false,"context_lines":[{"line_number":41,"context_line":"                    }}"},{"line_number":42,"context_line":"                ]}}):"},{"line_number":43,"context_line":"            self.helper \u003d prometheus_helper.PrometheusHelper()"},{"line_number":44,"context_line":"        stat_agg_patcher \u003d mock.patch.object("},{"line_number":45,"context_line":"            self.helper, \u0027statistic_aggregation\u0027,"},{"line_number":46,"context_line":"            spec\u003dprometheus_helper.PrometheusHelper.statistic_aggregation)"},{"line_number":47,"context_line":"        self.mock_aggregation \u003d stat_agg_patcher.start()"},{"line_number":48,"context_line":"        self.addCleanup(stat_agg_patcher.stop)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def test_prometheus_statistic_aggregation(self, mock_prometheus_get,"},{"line_number":51,"context_line":"                                              mock_prometheus_query):"}],"source_content_type":"text/x-python","patch_set":12,"id":"81060982_f6211822","line":48,"range":{"start_line":44,"start_character":0,"end_line":48,"end_character":46},"in_reply_to":"d6b9650b_48f7e292","updated":"2024-12-11 18:58:26.000000000","message":"Acknowledged","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"41727a03cd2dfa850fffd4979a4e794be864f091","unresolved":true,"context_lines":[{"line_number":57,"context_line":""},{"line_number":58,"context_line":"        mock_prom_metric \u003d mock.Mock("},{"line_number":59,"context_line":"            labels\u003d{\u0027instance\u0027: \u002710.0.1.2:9100\u0027},"},{"line_number":60,"context_line":"            timestamp\u003d1731065985.408,"},{"line_number":61,"context_line":"            value\u003dexpected_cpu_usage"},{"line_number":62,"context_line":"        )"},{"line_number":63,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"cafac540_b6aec1c9","line":60,"updated":"2024-11-25 16:28:29.000000000","message":"just an aside \n\ni dont know if it applies in this case but we generally should be usign a datatime fixture ot stabilise timestamps when they are used in the test.\n\n\nIn this case you are hard coding it in test mock so its probaly fine but we need to be carful  when funciton use time.now() extra to mock that out correctly.","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":false,"context_lines":[{"line_number":57,"context_line":""},{"line_number":58,"context_line":"        mock_prom_metric \u003d mock.Mock("},{"line_number":59,"context_line":"            labels\u003d{\u0027instance\u0027: \u002710.0.1.2:9100\u0027},"},{"line_number":60,"context_line":"            timestamp\u003d1731065985.408,"},{"line_number":61,"context_line":"            value\u003dexpected_cpu_usage"},{"line_number":62,"context_line":"        )"},{"line_number":63,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"50401e40_357bfb64","line":60,"in_reply_to":"a30a11ee_ad338fbf","updated":"2024-12-11 17:52:21.000000000","message":"Acknowledged","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"98f569cc1463cb3dcc2d8647e39bc77c4db012b5","unresolved":true,"context_lines":[{"line_number":57,"context_line":""},{"line_number":58,"context_line":"        mock_prom_metric \u003d mock.Mock("},{"line_number":59,"context_line":"            labels\u003d{\u0027instance\u0027: \u002710.0.1.2:9100\u0027},"},{"line_number":60,"context_line":"            timestamp\u003d1731065985.408,"},{"line_number":61,"context_line":"            value\u003dexpected_cpu_usage"},{"line_number":62,"context_line":"        )"},{"line_number":63,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"a30a11ee_ad338fbf","line":60,"in_reply_to":"cafac540_b6aec1c9","updated":"2024-11-28 16:25:17.000000000","message":"i mean this is meant to mock out the raw metric as recieved from prometheus (I literally copy/pasted this from the response) so I don\u0027t want to convert it at least not here","commit_id":"67d61d384c99729f18d4fde289139a89e0c3e749"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":true,"context_lines":[{"line_number":61,"context_line":"        self.assertRaisesRegex("},{"line_number":62,"context_line":"            exception.MissingParameter, \u0027prometheus_host_port must be set\u0027,"},{"line_number":63,"context_line":"            prometheus_helper.PrometheusHelper"},{"line_number":64,"context_line":"        )"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027query\u0027)"},{"line_number":67,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"43b03b13_28f66a8b","line":64,"updated":"2024-12-11 17:52:21.000000000","message":"ack thats testing https://review.opendev.org/c/openstack/watcher/+/934423/18/watcher/decision_engine/datasources/prometheus.py#66","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[{"line_number":61,"context_line":"        self.assertRaisesRegex("},{"line_number":62,"context_line":"            exception.MissingParameter, \u0027prometheus_host_port must be set\u0027,"},{"line_number":63,"context_line":"            prometheus_helper.PrometheusHelper"},{"line_number":64,"context_line":"        )"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027query\u0027)"},{"line_number":67,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"57ffd5cd_e94d3c61","line":64,"in_reply_to":"43b03b13_28f66a8b","updated":"2024-12-13 11:34:38.000000000","message":"Acknowledged","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":true,"context_lines":[{"line_number":66,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027query\u0027)"},{"line_number":67,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":68,"context_line":"    def test_prometheus_statistic_aggregation(self, mock_prometheus_get,"},{"line_number":69,"context_line":"                                              mock_prometheus_query):"},{"line_number":70,"context_line":"        mock_node \u003d mock.Mock("},{"line_number":71,"context_line":"            uuid\u003d\u00271234\u0027,"},{"line_number":72,"context_line":"            hostname\u003d\u0027marios-env.controlplane.domain\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"0454ffd7_67ec58a7","line":69,"updated":"2024-12-11 17:52:21.000000000","message":"so this is testing \nhttps://review.opendev.org/c/openstack/watcher/+/934423/18/watcher/decision_engine/datasources/prometheus.py#267","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[{"line_number":66,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027query\u0027)"},{"line_number":67,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":68,"context_line":"    def test_prometheus_statistic_aggregation(self, mock_prometheus_get,"},{"line_number":69,"context_line":"                                              mock_prometheus_query):"},{"line_number":70,"context_line":"        mock_node \u003d mock.Mock("},{"line_number":71,"context_line":"            uuid\u003d\u00271234\u0027,"},{"line_number":72,"context_line":"            hostname\u003d\u0027marios-env.controlplane.domain\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"3432e8e7_9e314c9e","line":69,"in_reply_to":"0454ffd7_67ec58a7","updated":"2024-12-13 11:34:38.000000000","message":"Acknowledged","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":true,"context_lines":[{"line_number":94,"context_line":"            granularity\u003d300,"},{"line_number":95,"context_line":"            aggregate\u003d\u0027mean\u0027,"},{"line_number":96,"context_line":"        )"},{"line_number":97,"context_line":"        self.assertEqual(expected_cpu_usage, result)"},{"line_number":98,"context_line":"        mock_prometheus_query.assert_called_once_with("},{"line_number":99,"context_line":"            \"100 - (avg by (instance)(rate(node_cpu_seconds_total\""},{"line_number":100,"context_line":"            \"{mode\u003d\u0027idle\u0027,instance\u003d\u002710.0.1.2:9100\u0027}[300s])) * 100)\")"}],"source_content_type":"text/x-python","patch_set":18,"id":"7a84fb4f_ba344588","line":97,"updated":"2024-12-11 17:52:21.000000000","message":"ack we have a single value then yes the mean shoudl be the same as the signle value.\n\nwe dont really need to test each of the funtions in the aggreat map as really we are just assertign that the correct vlue is passed  in the query stirng below.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[{"line_number":94,"context_line":"            granularity\u003d300,"},{"line_number":95,"context_line":"            aggregate\u003d\u0027mean\u0027,"},{"line_number":96,"context_line":"        )"},{"line_number":97,"context_line":"        self.assertEqual(expected_cpu_usage, result)"},{"line_number":98,"context_line":"        mock_prometheus_query.assert_called_once_with("},{"line_number":99,"context_line":"            \"100 - (avg by (instance)(rate(node_cpu_seconds_total\""},{"line_number":100,"context_line":"            \"{mode\u003d\u0027idle\u0027,instance\u003d\u002710.0.1.2:9100\u0027}[300s])) * 100)\")"}],"source_content_type":"text/x-python","patch_set":18,"id":"6889150b_8bb1090f","line":97,"in_reply_to":"7a84fb4f_ba344588","updated":"2024-12-13 11:34:38.000000000","message":"Acknowledged","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":true,"context_lines":[{"line_number":102,"context_line":"    def test_statistic_aggregation_metric_unavailable(self):"},{"line_number":103,"context_line":"        self.assertRaisesRegex("},{"line_number":104,"context_line":"            NotImplementedError, \u0027does not support statistic_series\u0027,"},{"line_number":105,"context_line":"            self.helper.statistic_series"},{"line_number":106,"context_line":"        )"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"478fe443_fb12eb71","line":105,"updated":"2024-12-11 17:52:21.000000000","message":"ack that covers https://review.opendev.org/c/openstack/watcher/+/934423/18/watcher/decision_engine/datasources/prometheus.py#267","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[{"line_number":102,"context_line":"    def test_statistic_aggregation_metric_unavailable(self):"},{"line_number":103,"context_line":"        self.assertRaisesRegex("},{"line_number":104,"context_line":"            NotImplementedError, \u0027does not support statistic_series\u0027,"},{"line_number":105,"context_line":"            self.helper.statistic_series"},{"line_number":106,"context_line":"        )"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"362a666c_8eacff63","line":105,"in_reply_to":"478fe443_fb12eb71","updated":"2024-12-13 11:34:38.000000000","message":"Acknowledged","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":true,"context_lines":[{"line_number":105,"context_line":"            self.helper.statistic_series"},{"line_number":106,"context_line":"        )"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":109,"context_line":"    def test_prometheus_list_metrics(self, mock_prometheus_get):"},{"line_number":110,"context_line":"        expected_metrics \u003d set("},{"line_number":111,"context_line":"            [\u0027go_gc_duration_seconds\u0027, \u0027go_gc_duration_seconds_count\u0027,"},{"line_number":112,"context_line":"             \u0027go_gc_duration_seconds_sum\u0027, \u0027go_goroutines\u0027,]"},{"line_number":113,"context_line":"        )"},{"line_number":114,"context_line":"        mock_prometheus_get.return_value \u003d {"},{"line_number":115,"context_line":"            \u0027status\u0027: \u0027success\u0027, \u0027data\u0027: ["},{"line_number":116,"context_line":"                \u0027go_gc_duration_seconds\u0027, \u0027go_gc_duration_seconds_count\u0027,"},{"line_number":117,"context_line":"                \u0027go_gc_duration_seconds_sum\u0027, \u0027go_goroutines\u0027,"},{"line_number":118,"context_line":"            ]"},{"line_number":119,"context_line":"        }"},{"line_number":120,"context_line":"        result \u003d self.helper.list_metrics()"},{"line_number":121,"context_line":"        self.assertEqual(expected_metrics, result)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        mock_prometheus_get.side_effect \u003d ("},{"line_number":124,"context_line":"            prometheus_client.PrometheusAPIClientError(\"nope\"))"},{"line_number":125,"context_line":"        result \u003d self.helper.list_metrics()"},{"line_number":126,"context_line":"        self.assertEqual(set(), result)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":129,"context_line":"    def test_prometheus_check_availability(self, mock_prometheus_get):"}],"source_content_type":"text/x-python","patch_set":18,"id":"e6487c27_c3adff49","line":126,"range":{"start_line":108,"start_character":2,"end_line":126,"end_character":39},"updated":"2024-12-11 17:52:21.000000000","message":"nit: each testcase shoudl really be its onwn test function so this shoudl be\n\n\n```suggestion\n    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)\n    def test_prometheus_list_metrics(self, mock_prometheus_get):\n        expected_metrics \u003d set(\n            [\u0027go_gc_duration_seconds\u0027, \u0027go_gc_duration_seconds_count\u0027,\n             \u0027go_gc_duration_seconds_sum\u0027, \u0027go_goroutines\u0027,]\n        )\n        mock_prometheus_get.return_value \u003d {\n            \u0027status\u0027: \u0027success\u0027, \u0027data\u0027: [\n                \u0027go_gc_duration_seconds\u0027, \u0027go_gc_duration_seconds_count\u0027,\n                \u0027go_gc_duration_seconds_sum\u0027, \u0027go_goroutines\u0027,\n            ]\n        }\n        result \u003d self.helper.list_metrics()\n        self.assertEqual(expected_metrics, result)\n\n  @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)\n    def test_prometheus_list_metrics_error(self, mock_prometheus_get):\n        mock_prometheus_get.side_effect \u003d (\n            prometheus_client.PrometheusAPIClientError(\"nope\"))\n        result \u003d self.helper.list_metrics()\n        self.assertEqual(set(), result)\n```\n\nim also not entirly conviced we want to actully convert an api error into the empty set here \n\nhttps://review.opendev.org/c/openstack/watcher/+/934423/18/watcher/decision_engine/datasources/prometheus.py#267\n\ni would be more inclined to raise but that is what the exising api dose wo the content of the test is correct","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"474df18c7b97de09bb1481f19ae601879300e59f","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            self.helper.statistic_series"},{"line_number":106,"context_line":"        )"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":109,"context_line":"    def test_prometheus_list_metrics(self, mock_prometheus_get):"},{"line_number":110,"context_line":"        expected_metrics \u003d set("},{"line_number":111,"context_line":"            [\u0027go_gc_duration_seconds\u0027, \u0027go_gc_duration_seconds_count\u0027,"},{"line_number":112,"context_line":"             \u0027go_gc_duration_seconds_sum\u0027, \u0027go_goroutines\u0027,]"},{"line_number":113,"context_line":"        )"},{"line_number":114,"context_line":"        mock_prometheus_get.return_value \u003d {"},{"line_number":115,"context_line":"            \u0027status\u0027: \u0027success\u0027, \u0027data\u0027: ["},{"line_number":116,"context_line":"                \u0027go_gc_duration_seconds\u0027, \u0027go_gc_duration_seconds_count\u0027,"},{"line_number":117,"context_line":"                \u0027go_gc_duration_seconds_sum\u0027, \u0027go_goroutines\u0027,"},{"line_number":118,"context_line":"            ]"},{"line_number":119,"context_line":"        }"},{"line_number":120,"context_line":"        result \u003d self.helper.list_metrics()"},{"line_number":121,"context_line":"        self.assertEqual(expected_metrics, result)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        mock_prometheus_get.side_effect \u003d ("},{"line_number":124,"context_line":"            prometheus_client.PrometheusAPIClientError(\"nope\"))"},{"line_number":125,"context_line":"        result \u003d self.helper.list_metrics()"},{"line_number":126,"context_line":"        self.assertEqual(set(), result)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":129,"context_line":"    def test_prometheus_check_availability(self, mock_prometheus_get):"}],"source_content_type":"text/x-python","patch_set":18,"id":"efd912f8_d2c0fed9","line":126,"range":{"start_line":108,"start_character":2,"end_line":126,"end_character":39},"in_reply_to":"e6487c27_c3adff49","updated":"2024-12-16 10:21:30.000000000","message":"ACK on splitting the test doing in v21","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":true,"context_lines":[{"line_number":144,"context_line":"        mock_prometheus_get.side_effect \u003d ("},{"line_number":145,"context_line":"            prometheus_client.PrometheusAPIClientError(\"nope\"))"},{"line_number":146,"context_line":"        result \u003d self.helper.check_availability()"},{"line_number":147,"context_line":"        self.assertEqual(\u0027not available\u0027, result)"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"    def test_get_host_cpu_usage(self):"},{"line_number":150,"context_line":"        self.helper.get_host_cpu_usage(\u0027someNode\u0027, 345, \u0027mean\u0027, 300)"}],"source_content_type":"text/x-python","patch_set":18,"id":"0f90c1a5_a10dc8ff","line":147,"updated":"2024-12-11 17:52:21.000000000","message":"nit: as above the error and succes case shoud be seperate tests.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"474df18c7b97de09bb1481f19ae601879300e59f","unresolved":false,"context_lines":[{"line_number":144,"context_line":"        mock_prometheus_get.side_effect \u003d ("},{"line_number":145,"context_line":"            prometheus_client.PrometheusAPIClientError(\"nope\"))"},{"line_number":146,"context_line":"        result \u003d self.helper.check_availability()"},{"line_number":147,"context_line":"        self.assertEqual(\u0027not available\u0027, result)"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"    def test_get_host_cpu_usage(self):"},{"line_number":150,"context_line":"        self.helper.get_host_cpu_usage(\u0027someNode\u0027, 345, \u0027mean\u0027, 300)"}],"source_content_type":"text/x-python","patch_set":18,"id":"c2336bf3_289fa38e","line":147,"in_reply_to":"0f90c1a5_a10dc8ff","updated":"2024-12-16 10:21:30.000000000","message":"Acknowledged","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"e14fbd67c98c0a8ed1180e0691a28094f91c9960","unresolved":true,"context_lines":[{"line_number":146,"context_line":"        result \u003d self.helper.check_availability()"},{"line_number":147,"context_line":"        self.assertEqual(\u0027not available\u0027, result)"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"    def test_get_host_cpu_usage(self):"},{"line_number":150,"context_line":"        self.helper.get_host_cpu_usage(\u0027someNode\u0027, 345, \u0027mean\u0027, 300)"},{"line_number":151,"context_line":"        self.mock_aggregation.assert_called_once_with("},{"line_number":152,"context_line":"            \u0027someNode\u0027, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, 345, \u0027mean\u0027,"},{"line_number":153,"context_line":"            300)"},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"    def test_get_host_ram_usage(self):"},{"line_number":156,"context_line":"        self.helper.get_host_ram_usage(\u0027anotherNode\u0027, 456, \u0027mean\u0027, 300)"},{"line_number":157,"context_line":"        self.mock_aggregation.assert_called_once_with("},{"line_number":158,"context_line":"            \u0027anotherNode\u0027, \u0027compute_node\u0027, \u0027host_ram_usage\u0027, 456, \u0027mean\u0027,"},{"line_number":159,"context_line":"            300)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":162,"context_line":"    def test_build_prometheus_fqdn_host_instance_map("},{"line_number":163,"context_line":"            self, mock_prometheus_get):"}],"source_content_type":"text/x-python","patch_set":18,"id":"472dafca_747b66d9","line":160,"range":{"start_line":149,"start_character":3,"end_line":160,"end_character":1},"updated":"2024-12-11 20:13:35.000000000","message":"It\u0027d be great if we could modify these tests, or add new ones, so that we\u0027d catch issues as the wrong order when calling statistic_aggregation. I\u0027m not sure if that\u0027s something we\u0027d want to spot in unit tests or integraion/functional tests.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"6cc690ffba992638d44edb52a63879008ad4e0f5","unresolved":false,"context_lines":[{"line_number":146,"context_line":"        result \u003d self.helper.check_availability()"},{"line_number":147,"context_line":"        self.assertEqual(\u0027not available\u0027, result)"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"    def test_get_host_cpu_usage(self):"},{"line_number":150,"context_line":"        self.helper.get_host_cpu_usage(\u0027someNode\u0027, 345, \u0027mean\u0027, 300)"},{"line_number":151,"context_line":"        self.mock_aggregation.assert_called_once_with("},{"line_number":152,"context_line":"            \u0027someNode\u0027, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, 345, \u0027mean\u0027,"},{"line_number":153,"context_line":"            300)"},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"    def test_get_host_ram_usage(self):"},{"line_number":156,"context_line":"        self.helper.get_host_ram_usage(\u0027anotherNode\u0027, 456, \u0027mean\u0027, 300)"},{"line_number":157,"context_line":"        self.mock_aggregation.assert_called_once_with("},{"line_number":158,"context_line":"            \u0027anotherNode\u0027, \u0027compute_node\u0027, \u0027host_ram_usage\u0027, 456, \u0027mean\u0027,"},{"line_number":159,"context_line":"            300)"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"},{"line_number":162,"context_line":"    def test_build_prometheus_fqdn_host_instance_map("},{"line_number":163,"context_line":"            self, mock_prometheus_get):"}],"source_content_type":"text/x-python","patch_set":18,"id":"7c968ff8_696f5b44","line":160,"range":{"start_line":149,"start_character":3,"end_line":160,"end_character":1},"in_reply_to":"472dafca_747b66d9","updated":"2024-12-13 11:34:38.000000000","message":"we actually have a test that calls statistica aggregation and it was also setting the parameters in the wrong order :D ... if you notice diff v18 to 19 you can see the swap there https://review.opendev.org/c/openstack/watcher/+/934423/18..19/watcher/tests/decision_engine/datasources/test_prometheus_helper.py","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"616332196f254c772d071f66a265bae375fb8143","unresolved":true,"context_lines":[{"line_number":254,"context_line":"        result \u003d self.helper._resolve_prometheus_instance_label(\u0027nope\u0027)"},{"line_number":255,"context_line":"        self.assertIsNone(result)"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    def test_build_prometheus_query(self):"},{"line_number":258,"context_line":"        expected_query \u003d ("},{"line_number":259,"context_line":"            \"100 - (avg by (instance)(rate(node_cpu_seconds_total\""},{"line_number":260,"context_line":"            \"{mode\u003d\u0027idle\u0027,instance\u003d\u0027some_host\u0027}[111s])) * 100)\")"}],"source_content_type":"text/x-python","patch_set":18,"id":"921b1286_4b404e6e","line":257,"updated":"2024-12-11 17:52:21.000000000","message":"this should also be split into 4 test cases.","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"474df18c7b97de09bb1481f19ae601879300e59f","unresolved":false,"context_lines":[{"line_number":254,"context_line":"        result \u003d self.helper._resolve_prometheus_instance_label(\u0027nope\u0027)"},{"line_number":255,"context_line":"        self.assertIsNone(result)"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    def test_build_prometheus_query(self):"},{"line_number":258,"context_line":"        expected_query \u003d ("},{"line_number":259,"context_line":"            \"100 - (avg by (instance)(rate(node_cpu_seconds_total\""},{"line_number":260,"context_line":"            \"{mode\u003d\u0027idle\u0027,instance\u003d\u0027some_host\u0027}[111s])) * 100)\")"}],"source_content_type":"text/x-python","patch_set":18,"id":"550a0611_806f51c8","line":257,"in_reply_to":"921b1286_4b404e6e","updated":"2024-12-16 10:21:30.000000000","message":"Acknowledged","commit_id":"55c86c434aa3efc8f30322f9dbe76ae10e374fe9"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"b50adb3a487f5edcd64cc98f208d5a25b9fbc787","unresolved":true,"context_lines":[{"line_number":155,"context_line":"        self.assertIsInstance(cpu_use, float)"},{"line_number":156,"context_line":"        self.mock_aggregation.assert_called_once_with("},{"line_number":157,"context_line":"            \u0027someNode\u0027, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, 345, 300, \u0027mean\u0027)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    def test_get_host_cpu_usage_none(self):"},{"line_number":160,"context_line":"        self.mock_aggregation.return_value \u003d None"},{"line_number":161,"context_line":"        cpu_use \u003d self.helper.get_host_cpu_usage(\u0027someNode\u0027, 345, \u0027mean\u0027, 300)"}],"source_content_type":"text/x-python","patch_set":23,"id":"a45f92f7_31bf216b","line":158,"updated":"2024-12-18 11:38:41.000000000","message":"weird... after making the last change to add named params when calling statistic aggregation i cannot get this test assert to pass...\n\n```\n\n*** AssertionError: expected call not found.\nExpected: statistic_aggregation(resource\u003d\u0027someNode\u0027, resource_type\u003d\u0027compute_node\u0027, meter_name\u003d\u0027host_cpu_usage\u0027, period\u003d345, granularity\u003d300, aggregate\u003d\u0027mean\u0027)\n  Actual: statistic_aggregation(resource\u003d\u0027someNode\u0027, resource_type\u003d\u0027compute_node\u0027, meter_name\u003d\u0027host_cpu_usage\u0027, period\u003d345, granularity\u003d300, aggregate\u003d\u0027mean\u0027)\n\n```","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"dc06d1e347f230ce9de52aae488bd0df2ed3d9da","unresolved":true,"context_lines":[{"line_number":155,"context_line":"        self.assertIsInstance(cpu_use, float)"},{"line_number":156,"context_line":"        self.mock_aggregation.assert_called_once_with("},{"line_number":157,"context_line":"            \u0027someNode\u0027, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, 345, 300, \u0027mean\u0027)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    def test_get_host_cpu_usage_none(self):"},{"line_number":160,"context_line":"        self.mock_aggregation.return_value \u003d None"},{"line_number":161,"context_line":"        cpu_use \u003d self.helper.get_host_cpu_usage(\u0027someNode\u0027, 345, \u0027mean\u0027, 300)"}],"source_content_type":"text/x-python","patch_set":23,"id":"ac938c9a_6293ec67","line":158,"in_reply_to":"a45f92f7_31bf216b","updated":"2024-12-18 12:06:38.000000000","message":"resolved by making the call only have some of the args as kwargs","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"7a4f0520c797a56fe6e5ab89eb85f89e1b6c40d0","unresolved":true,"context_lines":[{"line_number":155,"context_line":"        self.assertIsInstance(cpu_use, float)"},{"line_number":156,"context_line":"        self.mock_aggregation.assert_called_once_with("},{"line_number":157,"context_line":"            \u0027someNode\u0027, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, 345, 300, \u0027mean\u0027)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    def test_get_host_cpu_usage_none(self):"},{"line_number":160,"context_line":"        self.mock_aggregation.return_value \u003d None"},{"line_number":161,"context_line":"        cpu_use \u003d self.helper.get_host_cpu_usage(\u0027someNode\u0027, 345, \u0027mean\u0027, 300)"}],"source_content_type":"text/x-python","patch_set":23,"id":"fa1c6b14_060e57e5","line":158,"in_reply_to":"ac938c9a_6293ec67","updated":"2024-12-18 12:39:10.000000000","message":"WFM","commit_id":"35975b1241261fa2fc84c95ff073451543384854"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"e098eb8d2b32a453e1d36e05d84916c4b11ba724","unresolved":false,"context_lines":[{"line_number":155,"context_line":"        self.assertIsInstance(cpu_use, float)"},{"line_number":156,"context_line":"        self.mock_aggregation.assert_called_once_with("},{"line_number":157,"context_line":"            \u0027someNode\u0027, \u0027compute_node\u0027, \u0027host_cpu_usage\u0027, 345, 300, \u0027mean\u0027)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    def test_get_host_cpu_usage_none(self):"},{"line_number":160,"context_line":"        self.mock_aggregation.return_value \u003d None"},{"line_number":161,"context_line":"        cpu_use \u003d self.helper.get_host_cpu_usage(\u0027someNode\u0027, 345, \u0027mean\u0027, 300)"}],"source_content_type":"text/x-python","patch_set":23,"id":"5672842e_d4c94a83","line":158,"in_reply_to":"fa1c6b14_060e57e5","updated":"2024-12-18 13:23:38.000000000","message":"Done","commit_id":"35975b1241261fa2fc84c95ff073451543384854"}]}
