)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"37f54ad6325892048abf10ecf1904a96b9276503","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"6e27ae20_c035e24f","updated":"2025-03-18 07:32:46.000000000","message":"seems reasonable Alfredo thanks for picking that up and digging. \nminor nit on the log/error text","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":12393,"name":"chandan kumar","display_name":"Chandan Kumar","email":"chkumar@redhat.com","username":"chkumar246"},"change_message_id":"dafcd7a84da69819a1cc9660bfde255fbfdf9613","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"3ce231fd_5869c93f","updated":"2025-03-18 12:41:10.000000000","message":"Thanks Alfredo!","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"e577e4846a13467fb41eda12826d050beb367feb","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":4,"id":"e5b45c94_2d0d09c0","updated":"2025-03-18 18:59:48.000000000","message":"some minor nits inline but for the most part i think\nthis is ok.\ncan you add a fixes release note for this\notherwise this is mostly good to go.\n\nit would be nice to see some ci results form our operator jobs too to confirm this works as expected with fqdns.\nits not strictly required but would be good to do.","commit_id":"e13cbd45138634582e97032e534c7c154cfc78ed"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"36630b7a06d263f4764e8059138c0491f4801f42","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"c9215eb6_41c13e81","in_reply_to":"7465ac4b_2139cf1e","updated":"2025-03-20 07:26:04.000000000","message":"Done","commit_id":"e13cbd45138634582e97032e534c7c154cfc78ed"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"1f0666a320105c5e40232c349c0f4569d67210a8","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":4,"id":"7465ac4b_2139cf1e","in_reply_to":"e5b45c94_2d0d09c0","updated":"2025-03-19 08:49:36.000000000","message":"release note added.\n\nI\u0027ve created https://github.com/openstack-k8s-operators/watcher-operator/pull/117 to test this, let\u0027s see how it goes.","commit_id":"e13cbd45138634582e97032e534c7c154cfc78ed"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"176e3ca79953d3365a5e685a6b795ce9974607e7","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"a135ce05_355a161f","updated":"2025-03-19 13:10:06.000000000","message":"Logs from decision-engine in operators job for https://github.com/openstack-k8s-operators/watcher-operator/pull/117\n\nhttps://logserver.rdoproject.org/17/117/15d40cd21b889efd6139c4ad397ca35219a7320d/github-check/watcher-operator-validation-master/375ebef/controller/ci-framework-data/logs/openstack-k8s-operators-openstack-must-gather/namespaces/openstack/pods/watcher-decision-engine-0/logs/watcher-decision-engine.log\n\n\nExample of query:\n\n2025-03-19 11:01:04.077 1 DEBUG observabilityclient.prometheus_client [None req-29c8c1b2-dffd-4db5-a6b1-51671145703f - - - - - -] Querying prometheus with query: 100 - (avg by (instance)(rate(node_cpu_seconds_total{mode\u003d\u0027idle\u0027,fqdn\u003d\u0027compute-1.ctlplane.example.com\u0027}[72000s])) * 100) query /usr/lib/python3.9/site-packages/observabilityclient/prometheus_client.py:102\n\nquerying by fqdn\u003d\u0027compute-1.ctlplane.example.com\u0027\n\nNo traces of query by instance\u003d...","commit_id":"2c3a3dfabe044ad785fd74512b268999f53b3d74"},{"author":{"_account_id":34452,"name":"Joan Gilabert","display_name":"jgilaber","email":"jgilaber@redhat.com","username":"jgilaber"},"change_message_id":"05afe286929cd10c65d50669eb63668beaecfe2b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"2838d17f_ef86c76c","updated":"2025-03-19 14:13:36.000000000","message":"lgtm, just left a minor comment","commit_id":"2c3a3dfabe044ad785fd74512b268999f53b3d74"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"22b4b14a832c7992aad69735d67500776bc22931","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"febc610c_ff31f63f","updated":"2025-03-19 10:56:46.000000000","message":"recheck","commit_id":"2c3a3dfabe044ad785fd74512b268999f53b3d74"},{"author":{"_account_id":34620,"name":"Francisco Seruca Salgado","email":"fserucas@redhat.com","username":"fserucas"},"change_message_id":"d686ada58fbbbeb1ed35eeb108731dc4891bec4c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":7,"id":"d511f2e8_280dbe7d","updated":"2025-03-19 15:54:01.000000000","message":"recheck","commit_id":"a65e7e9b59451cc1deb905df935ecb7900eef339"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"a699c05e0789d02cccd9c8d9cb88e46beda5479f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":7,"id":"558c0e24_ae6bd77d","updated":"2025-03-19 14:34:19.000000000","message":"still looks good to me","commit_id":"a65e7e9b59451cc1deb905df935ecb7900eef339"}],"releasenotes/notes/bug-2103451-fixes-prometheus-queries-with-multiple-target-0e65d20711d1abe2.yaml":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"bfce0da790b8e8bcd5340974aad5484c195cc830","unresolved":true,"context_lines":[{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    When using prometheus datasource and more that one target has the same value"},{"line_number":5,"context_line":"    for the `fqdn_label`, the driver used the wrong instance label to query for host"},{"line_number":6,"context_line":"    metrics. The `instance` label is not longer used in the queries but the `fqdn_label`"},{"line_number":7,"context_line":"    which identifies all the metrics for a specific compute node."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"    .. _Bug 2103451: https://bugs.launchpad.net/watcher/+bug/2103451"}],"source_content_type":"text/x-yaml","patch_set":5,"id":"b79329f4_1bb6811d","line":6,"range":{"start_line":6,"start_character":37,"end_line":6,"end_character":40},"updated":"2025-03-19 14:20:40.000000000","message":"nit: no","commit_id":"2c3a3dfabe044ad785fd74512b268999f53b3d74"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"a699c05e0789d02cccd9c8d9cb88e46beda5479f","unresolved":false,"context_lines":[{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    When using prometheus datasource and more that one target has the same value"},{"line_number":5,"context_line":"    for the `fqdn_label`, the driver used the wrong instance label to query for host"},{"line_number":6,"context_line":"    metrics. The `instance` label is not longer used in the queries but the `fqdn_label`"},{"line_number":7,"context_line":"    which identifies all the metrics for a specific compute node."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"    .. _Bug 2103451: https://bugs.launchpad.net/watcher/+bug/2103451"}],"source_content_type":"text/x-yaml","patch_set":5,"id":"116d3d84_15e99141","line":6,"range":{"start_line":6,"start_character":37,"end_line":6,"end_character":40},"in_reply_to":"b79329f4_1bb6811d","updated":"2025-03-19 14:34:19.000000000","message":"Done","commit_id":"2c3a3dfabe044ad785fd74512b268999f53b3d74"}],"watcher/decision_engine/datasources/prometheus.py":[{"author":{"_account_id":12393,"name":"chandan kumar","display_name":"Chandan Kumar","email":"chkumar@redhat.com","username":"chkumar246"},"change_message_id":"5b73c717db0bf2826a9df060ce9358ce2ddaf4e7","unresolved":true,"context_lines":[{"line_number":157,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":158,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":159,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":160,"context_line":"        fqdn_instance_list \u003d []"},{"line_number":161,"context_line":"        for target in prometheus_targets:"},{"line_number":162,"context_line":"            if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label):"},{"line_number":163,"context_line":"                fqdn_instance_list.append("}],"source_content_type":"text/x-python","patch_set":1,"id":"0f0271e3_1cf3de29","line":160,"updated":"2025-03-18 06:37:47.000000000","message":"I think we can replace this whole code with list comprehension:\n```\nfqdn_instance_list \u003d []\nfor target in prometheus_targets:\n            if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label):\n                fqdn_instance_list.append(\n                    target[\u0027labels\u0027].get(self.prometheus_fqdn_label))\n```\nLike this\n```\nfqdn_instance_list \u003d [\n    target[\u0027labels\u0027][self.prometheus_fqdn_label]\n    for target in prometheus_targets\n    if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label)\n]\n```","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":34452,"name":"Joan Gilabert","display_name":"jgilaber","email":"jgilaber@redhat.com","username":"jgilaber"},"change_message_id":"7dc1275b143ebd646cd0d261ce97198a287b9e39","unresolved":true,"context_lines":[{"line_number":157,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":158,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":159,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":160,"context_line":"        fqdn_instance_list \u003d []"},{"line_number":161,"context_line":"        for target in prometheus_targets:"},{"line_number":162,"context_line":"            if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label):"},{"line_number":163,"context_line":"                fqdn_instance_list.append("}],"source_content_type":"text/x-python","patch_set":1,"id":"e351dbf5_0b826825","line":160,"in_reply_to":"02e9104b_fd07f5f1","updated":"2025-03-18 12:34:10.000000000","message":"I\u0027d +1 to keeping  this in for loops, I think this is too complex to be readable in a list comprehension","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c8a866a930a3bdea68bd4b921ac3a1690c783ab1","unresolved":true,"context_lines":[{"line_number":157,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":158,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":159,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":160,"context_line":"        fqdn_instance_list \u003d []"},{"line_number":161,"context_line":"        for target in prometheus_targets:"},{"line_number":162,"context_line":"            if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label):"},{"line_number":163,"context_line":"                fqdn_instance_list.append("}],"source_content_type":"text/x-python","patch_set":1,"id":"2404b6cd_fbf7763c","line":160,"in_reply_to":"02e9104b_fd07f5f1","updated":"2025-03-18 13:51:48.000000000","message":"its not actually only a personal preference, there is a performance element\nlist comparison are actually faster than the current approach.\nit has to do with how the memory is allocated for the list and the\ntemporary values are created.\n\nin a hot code path we should prefer the list comprehensions\n\nThis is cached and only invoked if we have a cache miss, so either will be okay.\n\nin general we shoudl prefer comprehensions for that reason but i agree that sometimes it more readable to unroll it into a loop, i do that too when the comprehension is more then 3-4 lines\n\nit would be better to not regress this but this isnt enough to -1 on its own.\n\nthis should also likely return a set not a list.\n\nlooping over a set has the same performance as a list more or less but if we need to check if at fqdn is in the set it will be much faster.","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"c9a8e37c9fcd5ec7b1b0fe0d9840d526915553b6","unresolved":true,"context_lines":[{"line_number":157,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":158,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":159,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":160,"context_line":"        fqdn_instance_list \u003d []"},{"line_number":161,"context_line":"        for target in prometheus_targets:"},{"line_number":162,"context_line":"            if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label):"},{"line_number":163,"context_line":"                fqdn_instance_list.append("}],"source_content_type":"text/x-python","patch_set":1,"id":"02e9104b_fd07f5f1","line":160,"in_reply_to":"0f0271e3_1cf3de29","updated":"2025-03-18 07:09:17.000000000","message":"It\u0027s personal preference, I find comprehensions much less readable and this is just a nested condition inside a loop, which i think it\u0027s acceptable. Anyway, if you prefer, i can change it.","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"378e4d79ce647e1c025e55c7cf493e84c38d70c1","unresolved":true,"context_lines":[{"line_number":157,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":158,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":159,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":160,"context_line":"        fqdn_instance_list \u003d []"},{"line_number":161,"context_line":"        for target in prometheus_targets:"},{"line_number":162,"context_line":"            if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label):"},{"line_number":163,"context_line":"                fqdn_instance_list.append("}],"source_content_type":"text/x-python","patch_set":1,"id":"b47fd185_206fd0d9","line":160,"in_reply_to":"2404b6cd_fbf7763c","updated":"2025-03-18 16:37:15.000000000","message":"Thanks for the info, good point about sets.","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"e577e4846a13467fb41eda12826d050beb367feb","unresolved":false,"context_lines":[{"line_number":157,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":158,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":159,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":160,"context_line":"        fqdn_instance_list \u003d []"},{"line_number":161,"context_line":"        for target in prometheus_targets:"},{"line_number":162,"context_line":"            if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label):"},{"line_number":163,"context_line":"                fqdn_instance_list.append("}],"source_content_type":"text/x-python","patch_set":1,"id":"2b5184ce_fec746aa","line":160,"in_reply_to":"b47fd185_206fd0d9","updated":"2025-03-18 18:59:48.000000000","message":"Done","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"b6916aeeb94628d22927c83fa4868d22d435edb3","unresolved":false,"context_lines":[{"line_number":157,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":158,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":159,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":160,"context_line":"        fqdn_instance_list \u003d []"},{"line_number":161,"context_line":"        for target in prometheus_targets:"},{"line_number":162,"context_line":"            if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label):"},{"line_number":163,"context_line":"                fqdn_instance_list.append("}],"source_content_type":"text/x-python","patch_set":1,"id":"5a33830c_0114ed90","line":160,"in_reply_to":"b47fd185_206fd0d9","updated":"2025-03-18 17:26:04.000000000","message":"Done","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":12393,"name":"chandan kumar","display_name":"Chandan Kumar","email":"chkumar@redhat.com","username":"chkumar246"},"change_message_id":"dafcd7a84da69819a1cc9660bfde255fbfdf9613","unresolved":false,"context_lines":[{"line_number":157,"context_line":"        # \u003e\u003e\u003e prometheus_targets[0][\u0027labels\u0027]"},{"line_number":158,"context_line":"        # {\u0027fqdn\u0027: \u0027marios-env-again.controlplane.domain\u0027,"},{"line_number":159,"context_line":"        #  \u0027instance\u0027: \u0027localhost:9100\u0027, \u0027job\u0027: \u0027node\u0027}"},{"line_number":160,"context_line":"        fqdn_instance_list \u003d []"},{"line_number":161,"context_line":"        for target in prometheus_targets:"},{"line_number":162,"context_line":"            if target.get(\u0027labels\u0027, {}).get(self.prometheus_fqdn_label):"},{"line_number":163,"context_line":"                fqdn_instance_list.append("}],"source_content_type":"text/x-python","patch_set":1,"id":"cb8bd9c0_b451574f","line":160,"in_reply_to":"e351dbf5_0b826825","updated":"2025-03-18 12:41:10.000000000","message":"Works for me to keeping the loop.","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"37f54ad6325892048abf10ecf1904a96b9276503","unresolved":true,"context_lines":[{"line_number":165,"context_line":""},{"line_number":166,"context_line":"        if not fqdn_instance_list:"},{"line_number":167,"context_line":"            LOG.error("},{"line_number":168,"context_line":"                \"Could not create fqdn instance map from Prometheus \""},{"line_number":169,"context_line":"                \"targets config. Prometheus returned the following: %s\","},{"line_number":170,"context_line":"                prometheus_targets"},{"line_number":171,"context_line":"            )"}],"source_content_type":"text/x-python","patch_set":1,"id":"0c8da93e_fc1584e6","line":168,"range":{"start_line":168,"start_character":39,"end_line":168,"end_character":51},"updated":"2025-03-18 07:32:46.000000000","message":"let\u0027s also update the text to avoid confusion (previously a map now a list)","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"48b24402d46476366d85c75cfb2120029d7fd93c","unresolved":false,"context_lines":[{"line_number":165,"context_line":""},{"line_number":166,"context_line":"        if not fqdn_instance_list:"},{"line_number":167,"context_line":"            LOG.error("},{"line_number":168,"context_line":"                \"Could not create fqdn instance map from Prometheus \""},{"line_number":169,"context_line":"                \"targets config. Prometheus returned the following: %s\","},{"line_number":170,"context_line":"                prometheus_targets"},{"line_number":171,"context_line":"            )"}],"source_content_type":"text/x-python","patch_set":1,"id":"fad6917e_c7f2c4a1","line":168,"range":{"start_line":168,"start_character":39,"end_line":168,"end_character":51},"in_reply_to":"0c8da93e_fc1584e6","updated":"2025-03-18 07:48:14.000000000","message":"Thanks! Done","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"37f54ad6325892048abf10ecf1904a96b9276503","unresolved":true,"context_lines":[{"line_number":188,"context_line":"        \"\"\""},{"line_number":189,"context_line":"        if not self.prometheus_fqdn_instance_list:"},{"line_number":190,"context_line":"            LOG.error(\"Cannot build host_instance_map without \""},{"line_number":191,"context_line":"                      \"fqdn_instance_map\")"},{"line_number":192,"context_line":"            return {}"},{"line_number":193,"context_line":"        host_instance_map \u003d {}"},{"line_number":194,"context_line":"        for fqdn in self.prometheus_fqdn_instance_list:"}],"source_content_type":"text/x-python","patch_set":1,"id":"b1df46a7_d40f83c6","line":191,"range":{"start_line":191,"start_character":23,"end_line":191,"end_character":40},"updated":"2025-03-18 07:32:46.000000000","message":"fqdn_instance_list","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"48b24402d46476366d85c75cfb2120029d7fd93c","unresolved":false,"context_lines":[{"line_number":188,"context_line":"        \"\"\""},{"line_number":189,"context_line":"        if not self.prometheus_fqdn_instance_list:"},{"line_number":190,"context_line":"            LOG.error(\"Cannot build host_instance_map without \""},{"line_number":191,"context_line":"                      \"fqdn_instance_map\")"},{"line_number":192,"context_line":"            return {}"},{"line_number":193,"context_line":"        host_instance_map \u003d {}"},{"line_number":194,"context_line":"        for fqdn in self.prometheus_fqdn_instance_list:"}],"source_content_type":"text/x-python","patch_set":1,"id":"f84de34d_5debc5dd","line":191,"range":{"start_line":191,"start_character":23,"end_line":191,"end_character":40},"in_reply_to":"b1df46a7_d40f83c6","updated":"2025-03-18 07:48:14.000000000","message":"Done","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":12393,"name":"chandan kumar","display_name":"Chandan Kumar","email":"chkumar@redhat.com","username":"chkumar246"},"change_message_id":"5b73c717db0bf2826a9df060ce9358ce2ddaf4e7","unresolved":true,"context_lines":[{"line_number":315,"context_line":"                \"- %s_over_time(%s{%s\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":316,"context_line":"                \"/ 1024 / 1024\" %"},{"line_number":317,"context_line":"                (self.prometheus_fqdn_label, instance_label, aggregate, meter,"},{"line_number":318,"context_line":"                 self.prometheus_fqdn_label, instance_label, period)"},{"line_number":319,"context_line":"            )"},{"line_number":320,"context_line":"        elif meter \u003d\u003d \u0027ceilometer_memory_usage\u0027:"},{"line_number":321,"context_line":"            query_args \u003d ("}],"source_content_type":"text/x-python","patch_set":1,"id":"0134ecac_589f77a7","line":318,"updated":"2025-03-18 06:37:47.000000000","message":"Based on https://storage.gra.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_29f/944795/1/check/watcher-prometheus-integration/29f17a7/controller/logs/prometheus_yml.txt\nLabels are\n```\nlabels:\n          fqdn: \"np0040189241\"\n```\nand results from https://storage.gra.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_29f/944795/1/check/watcher-prometheus-integration/29f17a7/controller/logs/screen-watcher-decision-engine.txt\n\n```\nMar 17 19:08:32.240344 np0040189240 watcher-decision-engine[98231]: WARNING watcher.decision_engine.datasources.prometheus [None req-f6c90368-92c4-48b7-8ff0-e31c58be55af None None] Creating empty host instance map. Are the keys in prometheus_fqdn_instance_map valid fqdn?\nMar 17 19:08:32.241551 np0040189240 watcher-decision-engine[98231]: DEBUG observabilityclient.prometheus_client [None req-f6c90368-92c4-48b7-8ff0-e31c58be55af None None] Querying prometheus with query: 100 - (avg by (instance)(rate(node_cpu_seconds_total{mode\u003d\u0027idle\u0027,fqdn\u003d\u0027np0040189241\u0027}[300s])) * 100) {{(pid\u003d98231) query /opt/stack/data/venv/lib/python3.12/site-packages/observabilityclient/prometheus_client.py:102}}\n```\n```\nMar 17 19:22:18.996644 np0040189240 watcher-decision-engine[98231]: DEBUG observabilityclient.prometheus_client [None req-10f17038-154f-4ac0-9755-043bd9902765 None None] Querying prometheus with query: (node_memory_MemTotal_bytes{fqdn\u003d\u0027np0040189241\u0027} - avg_over_time(node_memory_MemAvailable_bytes{fqdn\u003d\u0027np0040189241\u0027}[300s])) / 1024 / 1024 {{(pid\u003d98231) query /opt/stack/data/venv/lib/python3.12/site-packages/observabilityclient/prometheus_client.py:102}}\n```\nThere is no fully qualified hostname in CI Not sure how we can test it here. Apart from that codewise look good.","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c8a866a930a3bdea68bd4b921ac3a1690c783ab1","unresolved":true,"context_lines":[{"line_number":315,"context_line":"                \"- %s_over_time(%s{%s\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":316,"context_line":"                \"/ 1024 / 1024\" %"},{"line_number":317,"context_line":"                (self.prometheus_fqdn_label, instance_label, aggregate, meter,"},{"line_number":318,"context_line":"                 self.prometheus_fqdn_label, instance_label, period)"},{"line_number":319,"context_line":"            )"},{"line_number":320,"context_line":"        elif meter \u003d\u003d \u0027ceilometer_memory_usage\u0027:"},{"line_number":321,"context_line":"            query_args \u003d ("}],"source_content_type":"text/x-python","patch_set":1,"id":"8e606a78_b541beb5","line":318,"in_reply_to":"0134ecac_589f77a7","updated":"2025-03-18 13:51:48.000000000","message":"im not a huge fan of % strings but at this poitn this is too complex to use them without changign to the dict format.\n\ncan you update this so its not using postional or convert to f stings?\n\nregading ci, ci is configure correctly we cannot and should not require fqdns\nnova does not require the host to have fqdns and we cant depend on that in watcher.","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"b6916aeeb94628d22927c83fa4868d22d435edb3","unresolved":false,"context_lines":[{"line_number":315,"context_line":"                \"- %s_over_time(%s{%s\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":316,"context_line":"                \"/ 1024 / 1024\" %"},{"line_number":317,"context_line":"                (self.prometheus_fqdn_label, instance_label, aggregate, meter,"},{"line_number":318,"context_line":"                 self.prometheus_fqdn_label, instance_label, period)"},{"line_number":319,"context_line":"            )"},{"line_number":320,"context_line":"        elif meter \u003d\u003d \u0027ceilometer_memory_usage\u0027:"},{"line_number":321,"context_line":"            query_args \u003d ("}],"source_content_type":"text/x-python","patch_set":1,"id":"afdb3200_184ff32b","line":318,"in_reply_to":"7d4d3413_c218a5d5","updated":"2025-03-18 17:26:04.000000000","message":"Done","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"e577e4846a13467fb41eda12826d050beb367feb","unresolved":false,"context_lines":[{"line_number":315,"context_line":"                \"- %s_over_time(%s{%s\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":316,"context_line":"                \"/ 1024 / 1024\" %"},{"line_number":317,"context_line":"                (self.prometheus_fqdn_label, instance_label, aggregate, meter,"},{"line_number":318,"context_line":"                 self.prometheus_fqdn_label, instance_label, period)"},{"line_number":319,"context_line":"            )"},{"line_number":320,"context_line":"        elif meter \u003d\u003d \u0027ceilometer_memory_usage\u0027:"},{"line_number":321,"context_line":"            query_args \u003d ("}],"source_content_type":"text/x-python","patch_set":1,"id":"500812b8_083e0418","line":318,"in_reply_to":"7d4d3413_c218a5d5","updated":"2025-03-18 18:59:48.000000000","message":"Done\nthis is much simple to read.","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"378e4d79ce647e1c025e55c7cf493e84c38d70c1","unresolved":true,"context_lines":[{"line_number":315,"context_line":"                \"- %s_over_time(%s{%s\u003d\u0027%s\u0027}[%ss])) \""},{"line_number":316,"context_line":"                \"/ 1024 / 1024\" %"},{"line_number":317,"context_line":"                (self.prometheus_fqdn_label, instance_label, aggregate, meter,"},{"line_number":318,"context_line":"                 self.prometheus_fqdn_label, instance_label, period)"},{"line_number":319,"context_line":"            )"},{"line_number":320,"context_line":"        elif meter \u003d\u003d \u0027ceilometer_memory_usage\u0027:"},{"line_number":321,"context_line":"            query_args \u003d ("}],"source_content_type":"text/x-python","patch_set":1,"id":"7d4d3413_c218a5d5","line":318,"in_reply_to":"8e606a78_b541beb5","updated":"2025-03-18 16:37:15.000000000","message":"After testing multiple ways, i think that moving to a dict is our best option.\n\nBoth the code before this patch and after that patch will work fine with whatever values (hostnames or fqdns) if the content in the fqdn label match whatever is used in nova to identify the compute node. It also covers the case where nova uses hostname while fqdn contains fqdn.","commit_id":"ba45e82159232cbba0d94416eabe723d71922572"},{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"d2343a18cf9889a214f0c5f3b68bf7d64133f33a","unresolved":true,"context_lines":[{"line_number":51,"context_line":""},{"line_number":52,"context_line":"        The prometheus helper uses the PrometheusAPIClient provided by"},{"line_number":53,"context_line":"        python-observabilityclient."},{"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"},{"line_number":56,"context_line":"        making queries to Prometheus we use the instance label to specify"},{"line_number":57,"context_line":"        the node for which metrics are to be retrieved."}],"source_content_type":"text/x-python","patch_set":2,"id":"67c2d6e7_41f43ce9","line":54,"updated":"2025-03-18 10:53:40.000000000","message":"sorry for missing it but there are a few more @amoralej@redhat.com\n\nmaybe best to grep\n\nincluding the datasource docs there https://github.com/openstack/watcher/blob/52bba70fec38053bd3a50b030970d427d2597450/doc/source/datasources/prometheus.rst?plain\u003d1#L36","commit_id":"f910ac3fa40a8ced70fadd62f3ccfd4eb18a58e5"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"90a95c24d476b0bf3ab234a82b0933cccea7b694","unresolved":false,"context_lines":[{"line_number":51,"context_line":""},{"line_number":52,"context_line":"        The prometheus helper uses the PrometheusAPIClient provided by"},{"line_number":53,"context_line":"        python-observabilityclient."},{"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"},{"line_number":56,"context_line":"        making queries to Prometheus we use the instance label to specify"},{"line_number":57,"context_line":"        the node for which metrics are to be retrieved."}],"source_content_type":"text/x-python","patch_set":2,"id":"21c77901_96c3fa2c","line":54,"in_reply_to":"67c2d6e7_41f43ce9","updated":"2025-03-18 12:16:10.000000000","message":"Done, i think now it\u0027s complete. Thanks!","commit_id":"f910ac3fa40a8ced70fadd62f3ccfd4eb18a58e5"},{"author":{"_account_id":34452,"name":"Joan Gilabert","display_name":"jgilaber","email":"jgilaber@redhat.com","username":"jgilaber"},"change_message_id":"7dc1275b143ebd646cd0d261ce97198a287b9e39","unresolved":true,"context_lines":[{"line_number":205,"context_line":"        \"\"\"Resolve the prometheus instance label to use in queries"},{"line_number":206,"context_line":""},{"line_number":207,"context_line":"        Given the watcher node.hostname, resolve the prometheus instance"},{"line_number":208,"context_line":"        label for use in queries, first trying the fqdn_instance_map and"},{"line_number":209,"context_line":"        then the host_instance_map (watcher.node_name can be fqdn or hostname)."},{"line_number":210,"context_line":"        If the name is not resolved after the first attempt, rebuild the fqdn"},{"line_number":211,"context_line":"        and host instance maps and try again. This allows for new hosts added"}],"source_content_type":"text/x-python","patch_set":2,"id":"5393ce41_99a7d4ae","line":208,"updated":"2025-03-18 12:34:10.000000000","message":"s/fqdn_instance_map/fqdn_instance_list","commit_id":"f910ac3fa40a8ced70fadd62f3ccfd4eb18a58e5"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"ddeafc7cf444eed7e9f010f0fcd83c05c5478b4b","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        \"\"\"Resolve the prometheus instance label to use in queries"},{"line_number":206,"context_line":""},{"line_number":207,"context_line":"        Given the watcher node.hostname, resolve the prometheus instance"},{"line_number":208,"context_line":"        label for use in queries, first trying the fqdn_instance_map and"},{"line_number":209,"context_line":"        then the host_instance_map (watcher.node_name can be fqdn or hostname)."},{"line_number":210,"context_line":"        If the name is not resolved after the first attempt, rebuild the fqdn"},{"line_number":211,"context_line":"        and host instance maps and try again. This allows for new hosts added"}],"source_content_type":"text/x-python","patch_set":2,"id":"e06a6736_41e852f2","line":208,"in_reply_to":"5393ce41_99a7d4ae","updated":"2025-03-18 12:38:55.000000000","message":"Fixed in PS3","commit_id":"f910ac3fa40a8ced70fadd62f3ccfd4eb18a58e5"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c8a866a930a3bdea68bd4b921ac3a1690c783ab1","unresolved":true,"context_lines":[{"line_number":63,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":64,"context_line":"            CONF.prometheus_client.fqdn_label"},{"line_number":65,"context_line":"        )"},{"line_number":66,"context_line":"        self.prometheus_fqdn_instance_list \u003d ("},{"line_number":67,"context_line":"            self._build_prometheus_fqdn_instance_list()"},{"line_number":68,"context_line":"        )"},{"line_number":69,"context_line":"        self.prometheus_host_instance_map \u003d ("}],"source_content_type":"text/x-python","patch_set":3,"id":"5615ec69_8102780a","line":66,"range":{"start_line":66,"start_character":13,"end_line":66,"end_character":42},"updated":"2025-03-18 13:51:48.000000000","message":"```suggestion\n        self.prometheus_fqdn_lables \u003d (\n```","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"378e4d79ce647e1c025e55c7cf493e84c38d70c1","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        self.prometheus_fqdn_label \u003d ("},{"line_number":64,"context_line":"            CONF.prometheus_client.fqdn_label"},{"line_number":65,"context_line":"        )"},{"line_number":66,"context_line":"        self.prometheus_fqdn_instance_list \u003d ("},{"line_number":67,"context_line":"            self._build_prometheus_fqdn_instance_list()"},{"line_number":68,"context_line":"        )"},{"line_number":69,"context_line":"        self.prometheus_host_instance_map \u003d ("}],"source_content_type":"text/x-python","patch_set":3,"id":"d2a50b1d_0c3a8f35","line":66,"range":{"start_line":66,"start_character":13,"end_line":66,"end_character":42},"in_reply_to":"5615ec69_8102780a","updated":"2025-03-18 16:37:15.000000000","message":"Done","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c8a866a930a3bdea68bd4b921ac3a1690c783ab1","unresolved":true,"context_lines":[{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return the_client"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def _build_prometheus_fqdn_instance_list(self):"},{"line_number":140,"context_line":"        \"\"\"Build the list of fqdn_label values to be used in host queries"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"        Watcher knows nodes by their hostname. In Prometheus however the"}],"source_content_type":"text/x-python","patch_set":3,"id":"43b9818c_ef45d076","line":139,"updated":"2025-03-18 13:51:48.000000000","message":"you have completely changed what this function is doing.\nnow it\u0027s just a filter function over the Prometheus targets from the scrape config\n\nin general, I would avoid including the return type in function names.\nwe can probably give this a more semantic name.\nlike  `_build_prometheus_fqdn_lables`","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"378e4d79ce647e1c025e55c7cf493e84c38d70c1","unresolved":false,"context_lines":[{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return the_client"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def _build_prometheus_fqdn_instance_list(self):"},{"line_number":140,"context_line":"        \"\"\"Build the list of fqdn_label values to be used in host queries"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"        Watcher knows nodes by their hostname. In Prometheus however the"}],"source_content_type":"text/x-python","patch_set":3,"id":"028e4773_07777e45","line":139,"in_reply_to":"43b9818c_ef45d076","updated":"2025-03-18 16:37:15.000000000","message":"Done","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c8a866a930a3bdea68bd4b921ac3a1690c783ab1","unresolved":true,"context_lines":[{"line_number":194,"context_line":"        for fqdn in self.prometheus_fqdn_instance_list:"},{"line_number":195,"context_line":"            if \u0027.\u0027 in fqdn:"},{"line_number":196,"context_line":"                hostname \u003d fqdn.split(\u0027.\u0027)[0]"},{"line_number":197,"context_line":"                host_instance_map[hostname] \u003d fqdn"},{"line_number":198,"context_line":"        if not host_instance_map:"},{"line_number":199,"context_line":"            LOG.warning(\"Creating empty host instance map. Are the keys \""},{"line_number":200,"context_line":"                        \"in prometheus_fqdn_instance_list valid fqdn?\")"}],"source_content_type":"text/x-python","patch_set":3,"id":"8ec6c2ec_45cbae05","line":197,"updated":"2025-03-18 13:51:48.000000000","message":"again this is a performance regression\ni also wonder if the logic is correct.\nwe likely should have somthing like this \n\n```\n host_instance_map \u003d {\n                (fqdn.split(\u0027.\u0027)[0]  if \u0027.\u0027 in fqdn else fqdn, fqdn)\n                for fqdn in self.prometheus_fqdn_lables\n        }\n```\n\nthe `fqdn` will not be an fqdn and will only be a hostname in devstack and nova does not require actual fqdns it default to using the short host name so we proably should not be filtering them out.","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"e577e4846a13467fb41eda12826d050beb367feb","unresolved":false,"context_lines":[{"line_number":194,"context_line":"        for fqdn in self.prometheus_fqdn_instance_list:"},{"line_number":195,"context_line":"            if \u0027.\u0027 in fqdn:"},{"line_number":196,"context_line":"                hostname \u003d fqdn.split(\u0027.\u0027)[0]"},{"line_number":197,"context_line":"                host_instance_map[hostname] \u003d fqdn"},{"line_number":198,"context_line":"        if not host_instance_map:"},{"line_number":199,"context_line":"            LOG.warning(\"Creating empty host instance map. Are the keys \""},{"line_number":200,"context_line":"                        \"in prometheus_fqdn_instance_list valid fqdn?\")"}],"source_content_type":"text/x-python","patch_set":3,"id":"2ca25f5c_5c134520","line":197,"in_reply_to":"35242944_5620aab7","updated":"2025-03-18 18:59:48.000000000","message":"ah i see. ok that counter intuitive but that not a problem yoru intoducing it jsut hte current code flow.\n\nthanks for the extra context.","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"378e4d79ce647e1c025e55c7cf493e84c38d70c1","unresolved":true,"context_lines":[{"line_number":194,"context_line":"        for fqdn in self.prometheus_fqdn_instance_list:"},{"line_number":195,"context_line":"            if \u0027.\u0027 in fqdn:"},{"line_number":196,"context_line":"                hostname \u003d fqdn.split(\u0027.\u0027)[0]"},{"line_number":197,"context_line":"                host_instance_map[hostname] \u003d fqdn"},{"line_number":198,"context_line":"        if not host_instance_map:"},{"line_number":199,"context_line":"            LOG.warning(\"Creating empty host instance map. Are the keys \""},{"line_number":200,"context_line":"                        \"in prometheus_fqdn_instance_list valid fqdn?\")"}],"source_content_type":"text/x-python","patch_set":3,"id":"35242944_5620aab7","line":197,"in_reply_to":"8ec6c2ec_45cbae05","updated":"2025-03-18 16:37:15.000000000","message":"How this was conceived to work is:\n\n- fqdn_instance_map contained a map of \"whatever value is in the fqdn_label\": \"value of instance label\" for each target.\n- if (only if) the content of the fqdn_label was a fqdn (actually, if it had a `.`) it creates host_intance_map which has \"hostname\": \"value of instance label\". If content of the label does not contain \u0027.\u0027, host_intance_map is empty as the that was just in case the compute node was identified by hostname (instead of fqdn) while the label is a real fqdn. If the label is actually a hostname, it will just work as it will match the value in nova (this is the devstack case).\n\nThis is how it was intended since the beginning.\n\nIn that sense, this patch is not changing the behavior.\n\nHowever, we are not longer using the instance label to query so we don\u0027t need the values.\n\nI\u0027m moving it back to a comprehension.","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"e577e4846a13467fb41eda12826d050beb367feb","unresolved":true,"context_lines":[{"line_number":170,"context_line":"                \"targets config. Prometheus returned the following: %s\","},{"line_number":171,"context_line":"                prometheus_targets"},{"line_number":172,"context_line":"            )"},{"line_number":173,"context_line":"            return []"},{"line_number":174,"context_line":"        return fqdn_instance_labels"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def _build_prometheus_host_instance_map(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"801df0a1_9cd73957","line":173,"range":{"start_line":173,"start_character":19,"end_line":173,"end_character":21},"updated":"2025-03-18 18:59:48.000000000","message":"this shoudl be set()","commit_id":"e13cbd45138634582e97032e534c7c154cfc78ed"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"1f0666a320105c5e40232c349c0f4569d67210a8","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                \"targets config. Prometheus returned the following: %s\","},{"line_number":171,"context_line":"                prometheus_targets"},{"line_number":172,"context_line":"            )"},{"line_number":173,"context_line":"            return []"},{"line_number":174,"context_line":"        return fqdn_instance_labels"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def _build_prometheus_host_instance_map(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"0411e4a8_c4dbe2a4","line":173,"range":{"start_line":173,"start_character":19,"end_line":173,"end_character":21},"in_reply_to":"801df0a1_9cd73957","updated":"2025-03-19 08:49:36.000000000","message":"Thanks!","commit_id":"e13cbd45138634582e97032e534c7c154cfc78ed"},{"author":{"_account_id":34452,"name":"Joan Gilabert","display_name":"jgilaber","email":"jgilaber@redhat.com","username":"jgilaber"},"change_message_id":"a6f6b43f0151fd169c28c31240c68f952bed268a","unresolved":true,"context_lines":[{"line_number":219,"context_line":"        def _query_maps(node):"},{"line_number":220,"context_line":"            if node in self.prometheus_fqdn_labels:"},{"line_number":221,"context_line":"                return node"},{"line_number":222,"context_line":"            elif node in self.prometheus_host_instance_map.keys():"},{"line_number":223,"context_line":"                return self.prometheus_host_instance_map[node]"},{"line_number":224,"context_line":""},{"line_number":225,"context_line":"        instance_label \u003d _query_maps(node_name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"c4a07f31_dfcca0c5","line":222,"updated":"2025-03-19 14:10:37.000000000","message":"nit, but the call to keys seems redundant here, simply checking if node is in self.prometheus_host_instnace_map should be enough IIUC. We could also replace the elif by a get call as we currently do in master","commit_id":"2c3a3dfabe044ad785fd74512b268999f53b3d74"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"a699c05e0789d02cccd9c8d9cb88e46beda5479f","unresolved":false,"context_lines":[{"line_number":219,"context_line":"        def _query_maps(node):"},{"line_number":220,"context_line":"            if node in self.prometheus_fqdn_labels:"},{"line_number":221,"context_line":"                return node"},{"line_number":222,"context_line":"            elif node in self.prometheus_host_instance_map.keys():"},{"line_number":223,"context_line":"                return self.prometheus_host_instance_map[node]"},{"line_number":224,"context_line":""},{"line_number":225,"context_line":"        instance_label \u003d _query_maps(node_name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"9e657657_0fefa644","line":222,"in_reply_to":"2588bcd2_622c88da","updated":"2025-03-19 14:34:19.000000000","message":"Done","commit_id":"2c3a3dfabe044ad785fd74512b268999f53b3d74"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"fa64b3f9339d021669b3df9404001c889c62c847","unresolved":true,"context_lines":[{"line_number":219,"context_line":"        def _query_maps(node):"},{"line_number":220,"context_line":"            if node in self.prometheus_fqdn_labels:"},{"line_number":221,"context_line":"                return node"},{"line_number":222,"context_line":"            elif node in self.prometheus_host_instance_map.keys():"},{"line_number":223,"context_line":"                return self.prometheus_host_instance_map[node]"},{"line_number":224,"context_line":""},{"line_number":225,"context_line":"        instance_label \u003d _query_maps(node_name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"2588bcd2_622c88da","line":222,"in_reply_to":"c4a07f31_dfcca0c5","updated":"2025-03-19 14:24:07.000000000","message":"Thanks, replacing the elif by a get with default to None seems a cleaner way.","commit_id":"2c3a3dfabe044ad785fd74512b268999f53b3d74"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"707bd510a9be06d8d79bac6456f394236a308dac","unresolved":true,"context_lines":[{"line_number":219,"context_line":"        def _query_maps(node):"},{"line_number":220,"context_line":"            if node in self.prometheus_fqdn_labels:"},{"line_number":221,"context_line":"                return node"},{"line_number":222,"context_line":"            elif node in self.prometheus_host_instance_map.keys():"},{"line_number":223,"context_line":"                return self.prometheus_host_instance_map[node]"},{"line_number":224,"context_line":""},{"line_number":225,"context_line":"        instance_label \u003d _query_maps(node_name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"f7a61e23_e352eee0","line":222,"in_reply_to":"c4a07f31_dfcca0c5","updated":"2025-03-19 14:22:25.000000000","message":"__iter__ on map is defiend over the keys and so is __contians__\nso yes .keys() is implied if not specified but it does not hurt in this case.\n\ni would drop it if this needs a rebase but its ok as it is.","commit_id":"2c3a3dfabe044ad785fd74512b268999f53b3d74"}],"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":"c8a866a930a3bdea68bd4b921ac3a1690c783ab1","unresolved":true,"context_lines":[{"line_number":440,"context_line":"        ]}}"},{"line_number":441,"context_line":"        expected_fqdn_list \u003d [\u0027foo.controlplane.domain\u0027,"},{"line_number":442,"context_line":"                              \u0027bar.controlplane.domain\u0027,"},{"line_number":443,"context_line":"                              \u0027baz.controlplane.domain\u0027]"},{"line_number":444,"context_line":"        expected_host_map \u003d {\u0027foo\u0027: \u0027foo.controlplane.domain\u0027,"},{"line_number":445,"context_line":"                             \u0027bar\u0027: \u0027bar.controlplane.domain\u0027,"},{"line_number":446,"context_line":"                             \u0027baz\u0027: \u0027baz.controlplane.domain\u0027}"}],"source_content_type":"text/x-python","patch_set":3,"id":"3b29c194_ea79246c","line":443,"updated":"2025-03-18 13:51:48.000000000","message":"we should keep at least one example of ips because again that is alos valid.\nyou cannot assume that the fqdn lable will be an fqdn.\n\nit can be an ip (v4 or v6) a host name of an fqdn.","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"378e4d79ce647e1c025e55c7cf493e84c38d70c1","unresolved":true,"context_lines":[{"line_number":440,"context_line":"        ]}}"},{"line_number":441,"context_line":"        expected_fqdn_list \u003d [\u0027foo.controlplane.domain\u0027,"},{"line_number":442,"context_line":"                              \u0027bar.controlplane.domain\u0027,"},{"line_number":443,"context_line":"                              \u0027baz.controlplane.domain\u0027]"},{"line_number":444,"context_line":"        expected_host_map \u003d {\u0027foo\u0027: \u0027foo.controlplane.domain\u0027,"},{"line_number":445,"context_line":"                             \u0027bar\u0027: \u0027bar.controlplane.domain\u0027,"},{"line_number":446,"context_line":"                             \u0027baz\u0027: \u0027baz.controlplane.domain\u0027}"}],"source_content_type":"text/x-python","patch_set":3,"id":"a9d12190_1e9b7e94","line":443,"in_reply_to":"3b29c194_ea79246c","updated":"2025-03-18 16:37:15.000000000","message":"You mean, the case where the content of the fqdn label in prometheus is an IP address and the compute node `ComputeNode.hostname` is also that ip address, right?\n\nI\u0027m adding a new test to cover a case with a custom label to make it more clear.","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"b6916aeeb94628d22927c83fa4868d22d435edb3","unresolved":false,"context_lines":[{"line_number":440,"context_line":"        ]}}"},{"line_number":441,"context_line":"        expected_fqdn_list \u003d [\u0027foo.controlplane.domain\u0027,"},{"line_number":442,"context_line":"                              \u0027bar.controlplane.domain\u0027,"},{"line_number":443,"context_line":"                              \u0027baz.controlplane.domain\u0027]"},{"line_number":444,"context_line":"        expected_host_map \u003d {\u0027foo\u0027: \u0027foo.controlplane.domain\u0027,"},{"line_number":445,"context_line":"                             \u0027bar\u0027: \u0027bar.controlplane.domain\u0027,"},{"line_number":446,"context_line":"                             \u0027baz\u0027: \u0027baz.controlplane.domain\u0027}"}],"source_content_type":"text/x-python","patch_set":3,"id":"ab26964b_581c48f3","line":443,"in_reply_to":"a9d12190_1e9b7e94","updated":"2025-03-18 17:26:04.000000000","message":"Done","commit_id":"3b93f5e7bb12fa247b86a40a7b0f09ddc6175ba9"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"e577e4846a13467fb41eda12826d050beb367feb","unresolved":true,"context_lines":[{"line_number":494,"context_line":"            }},"},{"line_number":495,"context_line":"        ]}}"},{"line_number":496,"context_line":"        helper \u003d prometheus_helper.PrometheusHelper()"},{"line_number":497,"context_line":"        self.assertEqual([], helper.prometheus_fqdn_labels)"},{"line_number":498,"context_line":"        self.assertEqual({}, helper.prometheus_host_instance_map)"},{"line_number":499,"context_line":""},{"line_number":500,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9c6c2c5f_21ad4ec8","line":497,"range":{"start_line":497,"start_character":25,"end_line":497,"end_character":28},"updated":"2025-03-18 18:59:48.000000000","message":"set()","commit_id":"e13cbd45138634582e97032e534c7c154cfc78ed"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"1f0666a320105c5e40232c349c0f4569d67210a8","unresolved":false,"context_lines":[{"line_number":494,"context_line":"            }},"},{"line_number":495,"context_line":"        ]}}"},{"line_number":496,"context_line":"        helper \u003d prometheus_helper.PrometheusHelper()"},{"line_number":497,"context_line":"        self.assertEqual([], helper.prometheus_fqdn_labels)"},{"line_number":498,"context_line":"        self.assertEqual({}, helper.prometheus_host_instance_map)"},{"line_number":499,"context_line":""},{"line_number":500,"context_line":"    @mock.patch.object(prometheus_client.PrometheusAPIClient, \u0027_get\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba41ddcf_3d72a83d","line":497,"range":{"start_line":497,"start_character":25,"end_line":497,"end_character":28},"in_reply_to":"9c6c2c5f_21ad4ec8","updated":"2025-03-19 08:49:36.000000000","message":"Done","commit_id":"e13cbd45138634582e97032e534c7c154cfc78ed"}]}
