)]}'
{"conf.d/prometheus.yaml.example":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"  - metric_endpoint: \"http://127.0.0.1:9000\""},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"  # Kubernetes labels to match on when using auto detection in a Kubernetes environment"},{"line_number":19,"context_line":"  - kubernetes_labels: [\u0027app\u0027]"}],"source_content_type":"application/octet-stream","patch_set":21,"id":"3a1ff146_382291ba","line":18,"range":{"start_line":18,"start_character":0,"end_line":18,"end_character":87},"updated":"2017-03-14 15:30:02.000000000","message":"Should say only one instance is allowed when auto_detect_endpoints is True","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"  - metric_endpoint: \"http://127.0.0.1:9000\""},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"  # Kubernetes labels to match on when using auto detection in a Kubernetes environment"},{"line_number":19,"context_line":"  - kubernetes_labels: [\u0027app\u0027]"}],"source_content_type":"application/octet-stream","patch_set":21,"id":"3a1ff146_109493e0","line":18,"range":{"start_line":18,"start_character":0,"end_line":18,"end_character":87},"in_reply_to":"3a1ff146_382291ba","updated":"2017-03-15 17:36:28.000000000","message":"will add","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"}],"docker-agent/docker.sh":[{"author":{"_account_id":12133,"name":"Cindy O\u0027Neill","email":"cindy.o-neill@hpe.com","username":"oneilcin"},"change_message_id":"8dbae377c8440d76e516fdcaabc0b338aee30567","unresolved":false,"context_lines":[{"line_number":14,"context_line":"    cp /home/monasca-agent/docker-agent/prometheus_client.yaml /etc/monasca/agent/conf.d/prometheus_client.yaml"},{"line_number":15,"context_line":"else"},{"line_number":16,"context_line":"    cp /home/monasca-agent/docker-agent/docker.yaml /etc/monasca/agent/conf.d/docker.yaml"},{"line_number":17,"context_line":"fi"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"# this is ugly, but we need to trick monasca-setup into thinking we\u0027re installed"},{"line_number":20,"context_line":"# normally"}],"source_content_type":"text/x-sh","patch_set":6,"id":"5a74a57a_63f88e7d","line":17,"updated":"2016-11-30 17:59:07.000000000","message":"Could more than one of these sources by used by the agent?  I.E. both kubernetes api and prometheus client.","commit_id":"83104657bc2c484fcbecc0f17c7536ac6d9b2a9c"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"d81b5f375c878404433a7a7a56cca7669320ee32","unresolved":false,"context_lines":[{"line_number":14,"context_line":"    cp /home/monasca-agent/docker-agent/prometheus_client.yaml /etc/monasca/agent/conf.d/prometheus_client.yaml"},{"line_number":15,"context_line":"else"},{"line_number":16,"context_line":"    cp /home/monasca-agent/docker-agent/docker.yaml /etc/monasca/agent/conf.d/docker.yaml"},{"line_number":17,"context_line":"fi"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"# this is ugly, but we need to trick monasca-setup into thinking we\u0027re installed"},{"line_number":20,"context_line":"# normally"}],"source_content_type":"text/x-sh","patch_set":6,"id":"5a74a57a_8607781c","line":17,"in_reply_to":"5a74a57a_63f88e7d","updated":"2016-11-30 20:29:07.000000000","message":"ideally yeah but i eventually want to horizontally scale the prometheus client and the kubernetes api doesnt need to. Kind of want to leave them separate until we work with them more and fully understand what we want and what works","commit_id":"83104657bc2c484fcbecc0f17c7536ac6d9b2a9c"}],"docs/Plugins.md":[{"author":{"_account_id":12133,"name":"Cindy O\u0027Neill","email":"cindy.o-neill@hpe.com","username":"oneilcin"},"change_message_id":"8dbae377c8440d76e516fdcaabc0b338aee30567","unresolved":false,"context_lines":[{"line_number":1764,"context_line":"init_config:"},{"line_number":1765,"context_line":"  timeout: 3"},{"line_number":1766,"context_line":"  auto_detect_applications: True"},{"line_number":1767,"context_line":"instances:"},{"line_number":1768,"context_line":"  # Labels to match on when going through endpoints"},{"line_number":1769,"context_line":"  - detection_labels:"},{"line_number":1770,"context_line":"        monitoring_client: prometheus"}],"source_content_type":"text/x-markdown","patch_set":6,"id":"5a74a57a_0677e89f","line":1767,"updated":"2016-11-30 17:59:07.000000000","message":"Can you document what auto_detect_applications does?  I didn\u0027t see any documentation on this argument.","commit_id":"83104657bc2c484fcbecc0f17c7536ac6d9b2a9c"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"d81b5f375c878404433a7a7a56cca7669320ee32","unresolved":false,"context_lines":[{"line_number":1764,"context_line":"init_config:"},{"line_number":1765,"context_line":"  timeout: 3"},{"line_number":1766,"context_line":"  auto_detect_applications: True"},{"line_number":1767,"context_line":"instances:"},{"line_number":1768,"context_line":"  # Labels to match on when going through endpoints"},{"line_number":1769,"context_line":"  - detection_labels:"},{"line_number":1770,"context_line":"        monitoring_client: prometheus"}],"source_content_type":"text/x-markdown","patch_set":6,"id":"5a74a57a_b134b0de","line":1767,"in_reply_to":"5a74a57a_0677e89f","updated":"2016-11-30 20:29:07.000000000","message":"yes i can add documentation it pretty much is what I explained above just telling the plugin to go to the kubernetes api to grab endpoints","commit_id":"83104657bc2c484fcbecc0f17c7536ac6d9b2a9c"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":1752,"context_line":"```"},{"line_number":1753,"context_line":""},{"line_number":1754,"context_line":"### Running in a Kubernetes Environment with detection of available endpoints"},{"line_number":1755,"context_line":"In this instance we expect to the plugin to be running in a Kubernetes pod (directions for deploying it in a Kubernetes environment can be found [here](../../kubernetes/README.md))"},{"line_number":1756,"context_line":""},{"line_number":1757,"context_line":"How the plugin works is it goes to the Kubernetes API and grabs all endpoints. It then goes through each and checks if the endpoint contains a configured set of kubernetes labels. It if does it then looks at the ports exposed on that endpoint and if there is more then one checks if it matches a configured port_name. If it matches that it will hit that endpoint for metrics."},{"line_number":1758,"context_line":""}],"source_content_type":"text/x-markdown","patch_set":10,"id":"3a71b18c_d27dcfb2","line":1755,"range":{"start_line":1755,"start_character":27,"end_line":1755,"end_character":33},"updated":"2016-12-08 16:01:04.000000000","message":"just \u0027the\u0027","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":17001,"name":"Tim Buckley","email":"timothy.jas.buckley@hpe.com","username":"timothy.jas.buckley"},"change_message_id":"65876497db04170ed91bfcc288ced78aff836014","unresolved":false,"context_lines":[{"line_number":1842,"context_line":"- kubernetes_labels: [\u0027app\u0027]"},{"line_number":1843,"context_line":"```"},{"line_number":1844,"context_line":""},{"line_number":1845,"context_line":"**NOTE** This Plugin can only have one configured instance"},{"line_number":1846,"context_line":""},{"line_number":1847,"context_line":"## RabbitMQ Checks"},{"line_number":1848,"context_line":"This section describes the RabbitMQ check that can be performed by the Agent.  The RabbitMQ check gathers metrics on Nodes, Exchanges and Queues from the rabbit server.  The RabbitMQ check requires a configuration file called rabbitmq.yaml to be available in the agent conf.d configuration directory.  The config file must contain the names of the Exchanges and Queues that you are interested in monitoring."}],"source_content_type":"text/x-markdown","patch_set":15,"id":"1a430d35_b1288134","line":1845,"range":{"start_line":1845,"start_character":0,"end_line":1845,"end_character":58},"updated":"2017-02-08 18:35:12.000000000","message":"Is this only true when using auto_detect_endpoints: true?","commit_id":"6af1ca9c5dbf097df4109bd035dc6d38b4c1bba7"}],"monasca_agent/collector/checks/utils.py":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":214,"context_line":"        replica_set \u003d kubernetes_connector.get_request(replica_set_endpoint)"},{"line_number":215,"context_line":"        replica_set_annotations \u003d replica_set[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":216,"context_line":"        if \"deployment.kubernetes.io/revision\" in replica_set_annotations:"},{"line_number":217,"context_line":"            return \"-\".join(pod_owner_name.split(\"-\")[:-1])"},{"line_number":218,"context_line":"    except Exception as e:"},{"line_number":219,"context_line":"        log.warn(\"Could not connect to api to get replicaset data - {}\".format(e))"},{"line_number":220,"context_line":"        return None"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_6ae273a1","line":217,"range":{"start_line":217,"start_character":12,"end_line":217,"end_character":18},"updated":"2017-03-14 15:30:02.000000000","message":"Call me old fashioned, but I like to see a \"return None\" instead of the implicit one. The implicit one always makes you wonder if it was on purpose or just an oversight.","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":214,"context_line":"        replica_set \u003d kubernetes_connector.get_request(replica_set_endpoint)"},{"line_number":215,"context_line":"        replica_set_annotations \u003d replica_set[\u0027metadata\u0027][\u0027annotations\u0027]"},{"line_number":216,"context_line":"        if \"deployment.kubernetes.io/revision\" in replica_set_annotations:"},{"line_number":217,"context_line":"            return \"-\".join(pod_owner_name.split(\"-\")[:-1])"},{"line_number":218,"context_line":"    except Exception as e:"},{"line_number":219,"context_line":"        log.warn(\"Could not connect to api to get replicaset data - {}\".format(e))"},{"line_number":220,"context_line":"        return None"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_50bc4b6c","line":217,"range":{"start_line":217,"start_character":12,"end_line":217,"end_character":18},"in_reply_to":"3a1ff146_6ae273a1","updated":"2017-03-15 17:36:28.000000000","message":"will add :)","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"}],"monasca_agent/collector/checks_d/kubernetes.py":[{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"55d01a2a454b10b653da53101597a541ff8f12b7","unresolved":false,"context_lines":[{"line_number":27,"context_line":"        \"user\": \"cpu.user_time\""},{"line_number":28,"context_line":"    },"},{"line_number":29,"context_line":"    \"memory_metrics\": {"},{"line_number":30,"context_line":"        \"rss\": \"mem.rss_bytes\","},{"line_number":31,"context_line":"        \"swap\": \"mem.swap_bytes\","},{"line_number":32,"context_line":"        \"cache\": \"mem.cache_bytes\","},{"line_number":33,"context_line":"        \"usage\": \"mem.used_bytes\","}],"source_content_type":"text/x-python","patch_set":22,"id":"3a1ff146_0fde313f","line":30,"range":{"start_line":30,"start_character":8,"end_line":30,"end_character":31},"updated":"2017-03-15 18:35:52.000000000","message":"and remove this?","commit_id":"581d3ecd79448a02f5c5b8bf0cd9a7968a4b33be"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"55d01a2a454b10b653da53101597a541ff8f12b7","unresolved":false,"context_lines":[{"line_number":31,"context_line":"        \"swap\": \"mem.swap_bytes\","},{"line_number":32,"context_line":"        \"cache\": \"mem.cache_bytes\","},{"line_number":33,"context_line":"        \"usage\": \"mem.used_bytes\","},{"line_number":34,"context_line":"        \"failcnt\": \"mem.fail_count\","},{"line_number":35,"context_line":"    },"},{"line_number":36,"context_line":"    \"filesystem_metrics\": {"},{"line_number":37,"context_line":"        \"capacity\": \"fs.total_bytes\","}],"source_content_type":"text/x-python","patch_set":22,"id":"3a1ff146_efd63526","line":34,"range":{"start_line":34,"start_character":7,"end_line":34,"end_character":36},"updated":"2017-03-15 18:35:52.000000000","message":"need to remove this too","commit_id":"581d3ecd79448a02f5c5b8bf0cd9a7968a4b33be"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"650a8a68146b73dcf9245f4211b3b4e47674fe50","unresolved":false,"context_lines":[{"line_number":31,"context_line":"        \"swap\": \"mem.swap_bytes\","},{"line_number":32,"context_line":"        \"cache\": \"mem.cache_bytes\","},{"line_number":33,"context_line":"        \"usage\": \"mem.used_bytes\","},{"line_number":34,"context_line":"        \"failcnt\": \"mem.fail_count\","},{"line_number":35,"context_line":"    },"},{"line_number":36,"context_line":"    \"filesystem_metrics\": {"},{"line_number":37,"context_line":"        \"capacity\": \"fs.total_bytes\","}],"source_content_type":"text/x-python","patch_set":22,"id":"3a1ff146_75acd235","line":34,"range":{"start_line":34,"start_character":7,"end_line":34,"end_character":36},"in_reply_to":"3a1ff146_4f7d891b","updated":"2017-03-15 19:35:43.000000000","message":"Yeah I think it make sense in container situation hmm not the host one.","commit_id":"581d3ecd79448a02f5c5b8bf0cd9a7968a4b33be"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"69213c73c120e6a8bc9e271d7f37d1cd29610447","unresolved":false,"context_lines":[{"line_number":31,"context_line":"        \"swap\": \"mem.swap_bytes\","},{"line_number":32,"context_line":"        \"cache\": \"mem.cache_bytes\","},{"line_number":33,"context_line":"        \"usage\": \"mem.used_bytes\","},{"line_number":34,"context_line":"        \"failcnt\": \"mem.fail_count\","},{"line_number":35,"context_line":"    },"},{"line_number":36,"context_line":"    \"filesystem_metrics\": {"},{"line_number":37,"context_line":"        \"capacity\": \"fs.total_bytes\","}],"source_content_type":"text/x-python","patch_set":22,"id":"3a1ff146_4f7d891b","line":34,"range":{"start_line":34,"start_character":7,"end_line":34,"end_character":36},"in_reply_to":"3a1ff146_efd63526","updated":"2017-03-15 18:36:51.000000000","message":"it makes sense though in a container situation doesnt it?","commit_id":"581d3ecd79448a02f5c5b8bf0cd9a7968a4b33be"}],"monasca_agent/collector/checks_d/prometheus.py":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":34,"context_line":"            self.kubernetes_connector \u003d None"},{"line_number":35,"context_line":"            self.detect_method \u003d init_config.get(\"detect_method\", \"pod\").lower()"},{"line_number":36,"context_line":"            self.kubelet_url \u003d None"},{"line_number":37,"context_line":"            self.kubernetes_labels \u003d None"},{"line_number":38,"context_line":"            if instances is not None and len(instances) \u003e 1:"},{"line_number":39,"context_line":"                raise Exception(\u0027Prometheus Client only supports one configured instance if auto detection is set\u0027)"},{"line_number":40,"context_line":"            if self.detect_method not in [\u0027pod\u0027, \u0027service\u0027]:"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_9849c591","line":37,"range":{"start_line":37,"start_character":12,"end_line":37,"end_character":34},"updated":"2017-03-14 15:30:02.000000000","message":"No need to initialize this","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":34,"context_line":"            self.kubernetes_connector \u003d None"},{"line_number":35,"context_line":"            self.detect_method \u003d init_config.get(\"detect_method\", \"pod\").lower()"},{"line_number":36,"context_line":"            self.kubelet_url \u003d None"},{"line_number":37,"context_line":"            self.kubernetes_labels \u003d None"},{"line_number":38,"context_line":"            if instances is not None and len(instances) \u003e 1:"},{"line_number":39,"context_line":"                raise Exception(\u0027Prometheus Client only supports one configured instance if auto detection is set\u0027)"},{"line_number":40,"context_line":"            if self.detect_method not in [\u0027pod\u0027, \u0027service\u0027]:"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_3fed098c","line":37,"range":{"start_line":37,"start_character":12,"end_line":37,"end_character":34},"in_reply_to":"3a1ff146_9849c591","updated":"2017-03-15 17:36:28.000000000","message":"good call","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":105,"context_line":"                pod_dimensions \u003d dimensions.copy()"},{"line_number":106,"context_line":"                pod_dimensions.update(utils.get_pod_dimensions(self.kubernetes_connector, pod[\u0027metadata\u0027],"},{"line_number":107,"context_line":"                                                               self.kubernetes_labels))"},{"line_number":108,"context_line":"                scrape_endpoints[scrape_endpoint] \u003d pod_dimensions"},{"line_number":109,"context_line":"            except Exception as e:"},{"line_number":110,"context_line":"                self.log.warn(\"Error parsing {} to detect for scraping - {}\".format(pod, e))"},{"line_number":111,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_1826b516","line":108,"range":{"start_line":108,"start_character":0,"end_line":108,"end_character":66},"updated":"2017-03-14 15:30:02.000000000","message":"This would be a good place for a self.log.info() on which one made it all the way","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":105,"context_line":"                pod_dimensions \u003d dimensions.copy()"},{"line_number":106,"context_line":"                pod_dimensions.update(utils.get_pod_dimensions(self.kubernetes_connector, pod[\u0027metadata\u0027],"},{"line_number":107,"context_line":"                                                               self.kubernetes_labels))"},{"line_number":108,"context_line":"                scrape_endpoints[scrape_endpoint] \u003d pod_dimensions"},{"line_number":109,"context_line":"            except Exception as e:"},{"line_number":110,"context_line":"                self.log.warn(\"Error parsing {} to detect for scraping - {}\".format(pod, e))"},{"line_number":111,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_30a8af1f","line":108,"range":{"start_line":108,"start_character":0,"end_line":108,"end_character":66},"in_reply_to":"3a1ff146_1826b516","updated":"2017-03-15 17:36:28.000000000","message":"yeah probably right, would have used that several times by now","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":73,"context_line":"                self.report_endpoint_metrics(metric_endpoint, endpoint_dimensions)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    def _get_metric_endpoints_by_pod(self, dimensions):"},{"line_number":76,"context_line":"        scrape_endpoints \u003d {}"},{"line_number":77,"context_line":"        try:"},{"line_number":78,"context_line":"            pods \u003d requests.get(self.kubelet_url, timeout\u003dself.connection_timeout).json()"},{"line_number":79,"context_line":"        except Exception as e:"},{"line_number":80,"context_line":"            exception_message \u003d \"Could not get pods from local kubelet with error - {}\".format(e)"},{"line_number":81,"context_line":"            self.log.exception(exception_message)"},{"line_number":82,"context_line":"            raise Exception(exception_message)"},{"line_number":83,"context_line":"        for pod in pods[\u0027items\u0027]:"},{"line_number":84,"context_line":"            try:"},{"line_number":85,"context_line":"                pod_metadata \u003d pod[\u0027metadata\u0027]"},{"line_number":86,"context_line":"                pod_spec \u003d pod[\u0027spec\u0027]"},{"line_number":87,"context_line":"                pod_status \u003d pod[\u0027status\u0027]"},{"line_number":88,"context_line":"                if \"annotations\" not in pod_metadata or not (\u0027containers\u0027 in pod_spec and \u0027podIP\u0027 in pod_status):"},{"line_number":89,"context_line":"                    continue"},{"line_number":90,"context_line":"                pod_annotations \u003d pod_metadata[\u0027annotations\u0027]"},{"line_number":91,"context_line":"                prometheus_scrape \u003d pod_annotations.get(\"prometheus.io/scrape\", \"false\").lower()"},{"line_number":92,"context_line":"                if prometheus_scrape !\u003d \"true\":"},{"line_number":93,"context_line":"                    continue"},{"line_number":94,"context_line":"                pod_ports \u003d []"},{"line_number":95,"context_line":"                pod_containers \u003d pod_spec[\u0027containers\u0027]"},{"line_number":96,"context_line":"                for container in pod_containers:"},{"line_number":97,"context_line":"                    if \"ports\" in container:"},{"line_number":98,"context_line":"                        pod_ports +\u003d container[\u0027ports\u0027]"},{"line_number":99,"context_line":"                pod_name \u003d pod_metadata[\u0027name\u0027]"},{"line_number":100,"context_line":"                endpoint \u003d self._get_prometheus_endpoint(pod_annotations, pod_ports, pod_name)"},{"line_number":101,"context_line":"                if not endpoint:"},{"line_number":102,"context_line":"                    continue"},{"line_number":103,"context_line":"                pod_ip \u003d pod_status[\u0027podIP\u0027]"},{"line_number":104,"context_line":"                scrape_endpoint \u003d \"http://{}:{}\".format(pod_ip, endpoint)"},{"line_number":105,"context_line":"                pod_dimensions \u003d dimensions.copy()"},{"line_number":106,"context_line":"                pod_dimensions.update(utils.get_pod_dimensions(self.kubernetes_connector, pod[\u0027metadata\u0027],"},{"line_number":107,"context_line":"                                                               self.kubernetes_labels))"},{"line_number":108,"context_line":"                scrape_endpoints[scrape_endpoint] \u003d pod_dimensions"},{"line_number":109,"context_line":"            except Exception as e:"},{"line_number":110,"context_line":"                self.log.warn(\"Error parsing {} to detect for scraping - {}\".format(pod, e))"},{"line_number":111,"context_line":"                continue"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"        return scrape_endpoints"},{"line_number":114,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_78c5e959","line":111,"range":{"start_line":76,"start_character":0,"end_line":111,"end_character":24},"updated":"2017-03-14 15:30:02.000000000","message":"Some blank lines in this method would make it easier to follow","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":73,"context_line":"                self.report_endpoint_metrics(metric_endpoint, endpoint_dimensions)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    def _get_metric_endpoints_by_pod(self, dimensions):"},{"line_number":76,"context_line":"        scrape_endpoints \u003d {}"},{"line_number":77,"context_line":"        try:"},{"line_number":78,"context_line":"            pods \u003d requests.get(self.kubelet_url, timeout\u003dself.connection_timeout).json()"},{"line_number":79,"context_line":"        except Exception as e:"},{"line_number":80,"context_line":"            exception_message \u003d \"Could not get pods from local kubelet with error - {}\".format(e)"},{"line_number":81,"context_line":"            self.log.exception(exception_message)"},{"line_number":82,"context_line":"            raise Exception(exception_message)"},{"line_number":83,"context_line":"        for pod in pods[\u0027items\u0027]:"},{"line_number":84,"context_line":"            try:"},{"line_number":85,"context_line":"                pod_metadata \u003d pod[\u0027metadata\u0027]"},{"line_number":86,"context_line":"                pod_spec \u003d pod[\u0027spec\u0027]"},{"line_number":87,"context_line":"                pod_status \u003d pod[\u0027status\u0027]"},{"line_number":88,"context_line":"                if \"annotations\" not in pod_metadata or not (\u0027containers\u0027 in pod_spec and \u0027podIP\u0027 in pod_status):"},{"line_number":89,"context_line":"                    continue"},{"line_number":90,"context_line":"                pod_annotations \u003d pod_metadata[\u0027annotations\u0027]"},{"line_number":91,"context_line":"                prometheus_scrape \u003d pod_annotations.get(\"prometheus.io/scrape\", \"false\").lower()"},{"line_number":92,"context_line":"                if prometheus_scrape !\u003d \"true\":"},{"line_number":93,"context_line":"                    continue"},{"line_number":94,"context_line":"                pod_ports \u003d []"},{"line_number":95,"context_line":"                pod_containers \u003d pod_spec[\u0027containers\u0027]"},{"line_number":96,"context_line":"                for container in pod_containers:"},{"line_number":97,"context_line":"                    if \"ports\" in container:"},{"line_number":98,"context_line":"                        pod_ports +\u003d container[\u0027ports\u0027]"},{"line_number":99,"context_line":"                pod_name \u003d pod_metadata[\u0027name\u0027]"},{"line_number":100,"context_line":"                endpoint \u003d self._get_prometheus_endpoint(pod_annotations, pod_ports, pod_name)"},{"line_number":101,"context_line":"                if not endpoint:"},{"line_number":102,"context_line":"                    continue"},{"line_number":103,"context_line":"                pod_ip \u003d pod_status[\u0027podIP\u0027]"},{"line_number":104,"context_line":"                scrape_endpoint \u003d \"http://{}:{}\".format(pod_ip, endpoint)"},{"line_number":105,"context_line":"                pod_dimensions \u003d dimensions.copy()"},{"line_number":106,"context_line":"                pod_dimensions.update(utils.get_pod_dimensions(self.kubernetes_connector, pod[\u0027metadata\u0027],"},{"line_number":107,"context_line":"                                                               self.kubernetes_labels))"},{"line_number":108,"context_line":"                scrape_endpoints[scrape_endpoint] \u003d pod_dimensions"},{"line_number":109,"context_line":"            except Exception as e:"},{"line_number":110,"context_line":"                self.log.warn(\"Error parsing {} to detect for scraping - {}\".format(pod, e))"},{"line_number":111,"context_line":"                continue"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"        return scrape_endpoints"},{"line_number":114,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_706867f6","line":111,"range":{"start_line":76,"start_character":0,"end_line":111,"end_character":24},"in_reply_to":"3a1ff146_78c5e959","updated":"2017-03-15 17:36:28.000000000","message":"will add","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":138,"context_line":"            scrape_endpoint \u003d \"http://{}:{}\".format(cluster_ip, endpoint)"},{"line_number":139,"context_line":"            service_dimensions \u003d dimensions.copy()"},{"line_number":140,"context_line":"            service_dimensions.update(self._get_service_dimensions(service_metadata))"},{"line_number":141,"context_line":"            scrape_endpoints[scrape_endpoint] \u003d service_dimensions"},{"line_number":142,"context_line":"        return scrape_endpoints"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"    def _get_service_dimensions(self, service_metadata):"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_38237107","line":141,"range":{"start_line":141,"start_character":0,"end_line":141,"end_character":66},"updated":"2017-03-14 15:30:02.000000000","message":"This would be a good place for a self.log.info() on which one made it all the way","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":138,"context_line":"            scrape_endpoint \u003d \"http://{}:{}\".format(cluster_ip, endpoint)"},{"line_number":139,"context_line":"            service_dimensions \u003d dimensions.copy()"},{"line_number":140,"context_line":"            service_dimensions.update(self._get_service_dimensions(service_metadata))"},{"line_number":141,"context_line":"            scrape_endpoints[scrape_endpoint] \u003d service_dimensions"},{"line_number":142,"context_line":"        return scrape_endpoints"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"    def _get_service_dimensions(self, service_metadata):"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_b072dfe3","line":141,"range":{"start_line":141,"start_character":0,"end_line":141,"end_character":66},"in_reply_to":"3a1ff146_38237107","updated":"2017-03-15 17:36:28.000000000","message":"agreed","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        return scrape_endpoints"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    def _get_metric_endpoints_by_service(self, dimensions):"},{"line_number":116,"context_line":"        scrape_endpoints \u003d {}"},{"line_number":117,"context_line":"        try:"},{"line_number":118,"context_line":"            services \u003d self.kubernetes_connector.get_request(\"/api/v1/services\")"},{"line_number":119,"context_line":"        except Exception as e:"},{"line_number":120,"context_line":"            exception_message \u003d \"Could not get services from Kubernetes API with error - {}\".format(e)"},{"line_number":121,"context_line":"            self.log.exception(exception_message)"},{"line_number":122,"context_line":"            raise Exception(exception_message)"},{"line_number":123,"context_line":"        for service in services[\u0027items\u0027]:"},{"line_number":124,"context_line":"            service_metadata \u003d service[\u0027metadata\u0027]"},{"line_number":125,"context_line":"            service_spec \u003d service[\u0027spec\u0027]"},{"line_number":126,"context_line":"            if \"annotations\" not in service_metadata or \"ports\" not in service_spec:"},{"line_number":127,"context_line":"                continue"},{"line_number":128,"context_line":"            service_annotations \u003d service_metadata[\u0027annotations\u0027]"},{"line_number":129,"context_line":"            prometheus_scrape \u003d service_annotations.get(\"prometheus.io/scrape\", \"false\").lower()"},{"line_number":130,"context_line":"            if prometheus_scrape !\u003d \"true\":"},{"line_number":131,"context_line":"                continue"},{"line_number":132,"context_line":"            service_name \u003d service_metadata[\u0027name\u0027]"},{"line_number":133,"context_line":"            service_ports \u003d service_spec[\u0027ports\u0027]"},{"line_number":134,"context_line":"            endpoint \u003d self._get_prometheus_endpoint(service_annotations, service_ports, service_name)"},{"line_number":135,"context_line":"            if not endpoint:"},{"line_number":136,"context_line":"                continue"},{"line_number":137,"context_line":"            cluster_ip \u003d service_spec[\u0027clusterIP\u0027]"},{"line_number":138,"context_line":"            scrape_endpoint \u003d \"http://{}:{}\".format(cluster_ip, endpoint)"},{"line_number":139,"context_line":"            service_dimensions \u003d dimensions.copy()"},{"line_number":140,"context_line":"            service_dimensions.update(self._get_service_dimensions(service_metadata))"},{"line_number":141,"context_line":"            scrape_endpoints[scrape_endpoint] \u003d service_dimensions"},{"line_number":142,"context_line":"        return scrape_endpoints"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"    def _get_service_dimensions(self, service_metadata):"},{"line_number":145,"context_line":"        service_dimensions \u003d {\u0027service_name\u0027: service_metadata[\u0027name\u0027],"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_38c1b181","line":142,"range":{"start_line":116,"start_character":0,"end_line":142,"end_character":31},"updated":"2017-03-14 15:30:02.000000000","message":"Some blank lines in this method would make it easier to follow","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        return scrape_endpoints"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    def _get_metric_endpoints_by_service(self, dimensions):"},{"line_number":116,"context_line":"        scrape_endpoints \u003d {}"},{"line_number":117,"context_line":"        try:"},{"line_number":118,"context_line":"            services \u003d self.kubernetes_connector.get_request(\"/api/v1/services\")"},{"line_number":119,"context_line":"        except Exception as e:"},{"line_number":120,"context_line":"            exception_message \u003d \"Could not get services from Kubernetes API with error - {}\".format(e)"},{"line_number":121,"context_line":"            self.log.exception(exception_message)"},{"line_number":122,"context_line":"            raise Exception(exception_message)"},{"line_number":123,"context_line":"        for service in services[\u0027items\u0027]:"},{"line_number":124,"context_line":"            service_metadata \u003d service[\u0027metadata\u0027]"},{"line_number":125,"context_line":"            service_spec \u003d service[\u0027spec\u0027]"},{"line_number":126,"context_line":"            if \"annotations\" not in service_metadata or \"ports\" not in service_spec:"},{"line_number":127,"context_line":"                continue"},{"line_number":128,"context_line":"            service_annotations \u003d service_metadata[\u0027annotations\u0027]"},{"line_number":129,"context_line":"            prometheus_scrape \u003d service_annotations.get(\"prometheus.io/scrape\", \"false\").lower()"},{"line_number":130,"context_line":"            if prometheus_scrape !\u003d \"true\":"},{"line_number":131,"context_line":"                continue"},{"line_number":132,"context_line":"            service_name \u003d service_metadata[\u0027name\u0027]"},{"line_number":133,"context_line":"            service_ports \u003d service_spec[\u0027ports\u0027]"},{"line_number":134,"context_line":"            endpoint \u003d self._get_prometheus_endpoint(service_annotations, service_ports, service_name)"},{"line_number":135,"context_line":"            if not endpoint:"},{"line_number":136,"context_line":"                continue"},{"line_number":137,"context_line":"            cluster_ip \u003d service_spec[\u0027clusterIP\u0027]"},{"line_number":138,"context_line":"            scrape_endpoint \u003d \"http://{}:{}\".format(cluster_ip, endpoint)"},{"line_number":139,"context_line":"            service_dimensions \u003d dimensions.copy()"},{"line_number":140,"context_line":"            service_dimensions.update(self._get_service_dimensions(service_metadata))"},{"line_number":141,"context_line":"            scrape_endpoints[scrape_endpoint] \u003d service_dimensions"},{"line_number":142,"context_line":"        return scrape_endpoints"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"    def _get_service_dimensions(self, service_metadata):"},{"line_number":145,"context_line":"        service_dimensions \u003d {\u0027service_name\u0027: service_metadata[\u0027name\u0027],"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_d0775bd2","line":142,"range":{"start_line":116,"start_character":0,"end_line":142,"end_character":31},"in_reply_to":"3a1ff146_38c1b181","updated":"2017-03-15 17:36:28.000000000","message":"will add","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":159,"context_line":"            configured_port \u003d 9102"},{"line_number":160,"context_line":"        prometheus_endpoint \u003d annotations.get(\"prometheus.io/path\", \"/metrics\")"},{"line_number":161,"context_line":"        for port in ports:"},{"line_number":162,"context_line":"            if port[pod_index] \u003d\u003d configured_port:"},{"line_number":163,"context_line":"                return \"{}/{}\".format(configured_port, prometheus_endpoint)"},{"line_number":164,"context_line":"            elif len(ports) \u003d\u003d 1:"},{"line_number":165,"context_line":"                self.log.info(\"Could not find matching port using only port configured\")"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_38ac51ed","line":162,"range":{"start_line":162,"start_character":34,"end_line":162,"end_character":49},"updated":"2017-03-14 15:30:02.000000000","message":"It seems like configured_port could be None depending on the ifs above. What does that mean?","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":159,"context_line":"            configured_port \u003d 9102"},{"line_number":160,"context_line":"        prometheus_endpoint \u003d annotations.get(\"prometheus.io/path\", \"/metrics\")"},{"line_number":161,"context_line":"        for port in ports:"},{"line_number":162,"context_line":"            if port[pod_index] \u003d\u003d configured_port:"},{"line_number":163,"context_line":"                return \"{}/{}\".format(configured_port, prometheus_endpoint)"},{"line_number":164,"context_line":"            elif len(ports) \u003d\u003d 1:"},{"line_number":165,"context_line":"                self.log.info(\"Could not find matching port using only port configured\")"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_8bd138d0","line":162,"range":{"start_line":162,"start_character":34,"end_line":162,"end_character":49},"in_reply_to":"3a1ff146_38ac51ed","updated":"2017-03-15 17:36:28.000000000","message":"yes, in prometheus autodetection they use a default port on pod autodetection but not services that is what i am attempting to match. That is why i set it is 9102 in case of pod autodetection","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":161,"context_line":"        for port in ports:"},{"line_number":162,"context_line":"            if port[pod_index] \u003d\u003d configured_port:"},{"line_number":163,"context_line":"                return \"{}/{}\".format(configured_port, prometheus_endpoint)"},{"line_number":164,"context_line":"            elif len(ports) \u003d\u003d 1:"},{"line_number":165,"context_line":"                self.log.info(\"Could not find matching port using only port configured\")"},{"line_number":166,"context_line":"                return \"{}/{}\".format(port[pod_index], prometheus_endpoint)"},{"line_number":167,"context_line":"        self.log.error(\"Can not derive which port to use. Due to more then one port configured and none of them \""},{"line_number":168,"context_line":"                       \"selected via configurations. {} {} skipped for scraping\".format(self.detect_method, name))"},{"line_number":169,"context_line":"        return None"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_1841553a","line":166,"range":{"start_line":164,"start_character":1,"end_line":166,"end_character":75},"updated":"2017-03-14 15:30:02.000000000","message":"This would be clearer if it wasn\u0027t in the for loop","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":161,"context_line":"        for port in ports:"},{"line_number":162,"context_line":"            if port[pod_index] \u003d\u003d configured_port:"},{"line_number":163,"context_line":"                return \"{}/{}\".format(configured_port, prometheus_endpoint)"},{"line_number":164,"context_line":"            elif len(ports) \u003d\u003d 1:"},{"line_number":165,"context_line":"                self.log.info(\"Could not find matching port using only port configured\")"},{"line_number":166,"context_line":"                return \"{}/{}\".format(port[pod_index], prometheus_endpoint)"},{"line_number":167,"context_line":"        self.log.error(\"Can not derive which port to use. Due to more then one port configured and none of them \""},{"line_number":168,"context_line":"                       \"selected via configurations. {} {} skipped for scraping\".format(self.detect_method, name))"},{"line_number":169,"context_line":"        return None"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_2bf04490","line":166,"range":{"start_line":164,"start_character":1,"end_line":166,"end_character":75},"in_reply_to":"3a1ff146_1841553a","updated":"2017-03-15 17:36:28.000000000","message":"Done","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":176,"context_line":"                metric_labels \u003d metric[1]"},{"line_number":177,"context_line":"                metric_value \u003d float(metric[2])"},{"line_number":178,"context_line":"                if math.isnan(metric_value):"},{"line_number":179,"context_line":"                    self.log.debug(\u0027filtering out NaN value provided for metric %s{%s}\u0027, metric_name, metric_dimensions)"},{"line_number":180,"context_line":"                    return"},{"line_number":181,"context_line":"                metric_dimensions.update(metric_labels)"},{"line_number":182,"context_line":"                self.gauge(metric_name, metric_value, dimensions\u003dmetric_dimensions, hostname\u003d\"SUPPRESS\")"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_8d626915","line":179,"range":{"start_line":179,"start_character":102,"end_line":179,"end_character":119},"updated":"2017-03-14 15:30:02.000000000","message":"Would metric_labels be better to identify this?","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":176,"context_line":"                metric_labels \u003d metric[1]"},{"line_number":177,"context_line":"                metric_value \u003d float(metric[2])"},{"line_number":178,"context_line":"                if math.isnan(metric_value):"},{"line_number":179,"context_line":"                    self.log.debug(\u0027filtering out NaN value provided for metric %s{%s}\u0027, metric_name, metric_dimensions)"},{"line_number":180,"context_line":"                    return"},{"line_number":181,"context_line":"                metric_dimensions.update(metric_labels)"},{"line_number":182,"context_line":"                self.gauge(metric_name, metric_value, dimensions\u003dmetric_dimensions, hostname\u003d\"SUPPRESS\")"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_2bd92422","line":179,"range":{"start_line":179,"start_character":102,"end_line":179,"end_character":119},"in_reply_to":"3a1ff146_8d626915","updated":"2017-03-15 17:36:28.000000000","message":"Done","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9e878205f4ae54d5a46265f2e286ca1de24741d9","unresolved":false,"context_lines":[{"line_number":177,"context_line":"                metric_value \u003d float(metric[2])"},{"line_number":178,"context_line":"                if math.isnan(metric_value):"},{"line_number":179,"context_line":"                    self.log.debug(\u0027filtering out NaN value provided for metric %s{%s}\u0027, metric_name, metric_dimensions)"},{"line_number":180,"context_line":"                    return"},{"line_number":181,"context_line":"                metric_dimensions.update(metric_labels)"},{"line_number":182,"context_line":"                self.gauge(metric_name, metric_value, dimensions\u003dmetric_dimensions, hostname\u003d\"SUPPRESS\")"},{"line_number":183,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_4dfcf13e","line":180,"range":{"start_line":180,"start_character":20,"end_line":180,"end_character":26},"updated":"2017-03-14 15:30:02.000000000","message":"Should this be a continue? Seems like it would be throwing away all following metrics?","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"769a91976dffa91f322a4569bfdefba1e6cc87d5","unresolved":false,"context_lines":[{"line_number":177,"context_line":"                metric_value \u003d float(metric[2])"},{"line_number":178,"context_line":"                if math.isnan(metric_value):"},{"line_number":179,"context_line":"                    self.log.debug(\u0027filtering out NaN value provided for metric %s{%s}\u0027, metric_name, metric_dimensions)"},{"line_number":180,"context_line":"                    return"},{"line_number":181,"context_line":"                metric_dimensions.update(metric_labels)"},{"line_number":182,"context_line":"                self.gauge(metric_name, metric_value, dimensions\u003dmetric_dimensions, hostname\u003d\"SUPPRESS\")"},{"line_number":183,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"3a1ff146_0bdc6811","line":180,"range":{"start_line":180,"start_character":20,"end_line":180,"end_character":26},"in_reply_to":"3a1ff146_4dfcf13e","updated":"2017-03-15 17:36:28.000000000","message":"Done","commit_id":"94298432339e5d30f5163c29e946d68ee0c5b8ba"}],"monasca_agent/collector/checks_d/prometheus_client.py":[{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"d5cfa5afe9ee234f2db443fae54e00c5524a2393","unresolved":false,"context_lines":[{"line_number":13,"context_line":"    def check(self, instance):"},{"line_number":14,"context_line":"        metric_endpoint \u003d instance.get(\"metric_endpoint\", None)"},{"line_number":15,"context_line":"        if not metric_endpoint:"},{"line_number":16,"context_line":"            self.log.error(\"metric_endpoint must be defined for each instance\")"},{"line_number":17,"context_line":"        default_dimensions \u003d instance.get(\"default_dimensions\", None)"},{"line_number":18,"context_line":"        dimensions \u003d self._set_dimensions(default_dimensions, instance)"},{"line_number":19,"context_line":"        # Hit metric endpoint"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_2de158ff","line":16,"range":{"start_line":16,"start_character":0,"end_line":16,"end_character":79},"updated":"2016-11-29 20:46:00.000000000","message":"Should this raise an error at this point?","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"d5cfa5afe9ee234f2db443fae54e00c5524a2393","unresolved":false,"context_lines":[{"line_number":20,"context_line":"        try:"},{"line_number":21,"context_line":"            result \u003d requests.get(metric_endpoint, timeout\u003dself.connection_timeout)"},{"line_number":22,"context_line":"        except Exception as e:"},{"line_number":23,"context_line":"            self.log.error(\"Could not get metrics from {} with error {}\".format(metric_endpoint, e))"},{"line_number":24,"context_line":"        else:"},{"line_number":25,"context_line":"            result_content_type \u003d result.headers[\u0027Content-Type\u0027]"},{"line_number":26,"context_line":"            if \"text/plain\" in result_content_type:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_287226ae","line":23,"range":{"start_line":23,"start_character":0,"end_line":23,"end_character":100},"updated":"2016-11-29 20:46:00.000000000","message":"Should we be raising an error here?","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"12f88051b998b156b6dc4c9dc6d1b77c650b9cf9","unresolved":false,"context_lines":[{"line_number":20,"context_line":"        try:"},{"line_number":21,"context_line":"            result \u003d requests.get(metric_endpoint, timeout\u003dself.connection_timeout)"},{"line_number":22,"context_line":"        except Exception as e:"},{"line_number":23,"context_line":"            self.log.error(\"Could not get metrics from {} with error {}\".format(metric_endpoint, e))"},{"line_number":24,"context_line":"        else:"},{"line_number":25,"context_line":"            result_content_type \u003d result.headers[\u0027Content-Type\u0027]"},{"line_number":26,"context_line":"            if \"text/plain\" in result_content_type:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_69dcf618","line":23,"range":{"start_line":23,"start_character":0,"end_line":23,"end_character":100},"in_reply_to":"5a74a57a_287226ae","updated":"2016-11-30 15:55:20.000000000","message":"do we want to raise exceptions for all our log.errors i didnt think that is what we do in other plugins or in general maybe i am wrong.","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"5139ebb49c390dc7e0eab711ed52969e56d3d153","unresolved":false,"context_lines":[{"line_number":20,"context_line":"        try:"},{"line_number":21,"context_line":"            result \u003d requests.get(metric_endpoint, timeout\u003dself.connection_timeout)"},{"line_number":22,"context_line":"        except Exception as e:"},{"line_number":23,"context_line":"            self.log.error(\"Could not get metrics from {} with error {}\".format(metric_endpoint, e))"},{"line_number":24,"context_line":"        else:"},{"line_number":25,"context_line":"            result_content_type \u003d result.headers[\u0027Content-Type\u0027]"},{"line_number":26,"context_line":"            if \"text/plain\" in result_content_type:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_e4c3cd88","line":23,"range":{"start_line":23,"start_character":0,"end_line":23,"end_character":100},"in_reply_to":"5a74a57a_69dcf618","updated":"2016-11-30 16:09:58.000000000","message":"I\u0027d argue that if you fail to hit the metric endpoint it should be an exception.  Dealing with timeout exceptions or invalid response codes should be handled outside of the \"it broke and I don\u0027t know why\" case.\n\nIn the case where we don\u0027t know what broke we should raise an exception and let the AgentCheck class trap it properly and log.  In the case of this code converting that overall exception trap to just deal with timeouts and then checking the response code prior to parsing should cover most of our errors.  I think any exceptions we didn\u0027t plan for could be handled in the AgentCheck trap though I\u0027d want to see it work to verify that it gives enough information when it logs.","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"4affd6f9dcac0cc868f970aef9b4bf89f6339907","unresolved":false,"context_lines":[{"line_number":20,"context_line":"        try:"},{"line_number":21,"context_line":"            result \u003d requests.get(metric_endpoint, timeout\u003dself.connection_timeout)"},{"line_number":22,"context_line":"        except Exception as e:"},{"line_number":23,"context_line":"            self.log.error(\"Could not get metrics from {} with error {}\".format(metric_endpoint, e))"},{"line_number":24,"context_line":"        else:"},{"line_number":25,"context_line":"            result_content_type \u003d result.headers[\u0027Content-Type\u0027]"},{"line_number":26,"context_line":"            if \"text/plain\" in result_content_type:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_9ae6f2e6","line":23,"range":{"start_line":23,"start_character":0,"end_line":23,"end_character":100},"in_reply_to":"5a74a57a_e4c3cd88","updated":"2016-11-30 16:34:52.000000000","message":"Agree with ^ will put raise in here and as we encounter errors through testing we can put more sophisticate exception catching","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"d5cfa5afe9ee234f2db443fae54e00c5524a2393","unresolved":false,"context_lines":[{"line_number":21,"context_line":"            result \u003d requests.get(metric_endpoint, timeout\u003dself.connection_timeout)"},{"line_number":22,"context_line":"        except Exception as e:"},{"line_number":23,"context_line":"            self.log.error(\"Could not get metrics from {} with error {}\".format(metric_endpoint, e))"},{"line_number":24,"context_line":"        else:"},{"line_number":25,"context_line":"            result_content_type \u003d result.headers[\u0027Content-Type\u0027]"},{"line_number":26,"context_line":"            if \"text/plain\" in result_content_type:"},{"line_number":27,"context_line":"                self._parse_plain_text(result, dimensions)"},{"line_number":28,"context_line":"            else:"},{"line_number":29,"context_line":"                self.log.error(\"Unsupported content type - {}\".format(result_content_type))"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def _parse_plain_text(self, result, dimensions):"},{"line_number":32,"context_line":"        metric_type \u003d \"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_a819d67b","line":29,"range":{"start_line":24,"start_character":13,"end_line":29,"end_character":91},"updated":"2016-11-29 20:46:00.000000000","message":"I think we should also wrap the parsing in a try and log a reasonable error message if we can\u0027t parse the data.","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"12f88051b998b156b6dc4c9dc6d1b77c650b9cf9","unresolved":false,"context_lines":[{"line_number":21,"context_line":"            result \u003d requests.get(metric_endpoint, timeout\u003dself.connection_timeout)"},{"line_number":22,"context_line":"        except Exception as e:"},{"line_number":23,"context_line":"            self.log.error(\"Could not get metrics from {} with error {}\".format(metric_endpoint, e))"},{"line_number":24,"context_line":"        else:"},{"line_number":25,"context_line":"            result_content_type \u003d result.headers[\u0027Content-Type\u0027]"},{"line_number":26,"context_line":"            if \"text/plain\" in result_content_type:"},{"line_number":27,"context_line":"                self._parse_plain_text(result, dimensions)"},{"line_number":28,"context_line":"            else:"},{"line_number":29,"context_line":"                self.log.error(\"Unsupported content type - {}\".format(result_content_type))"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def _parse_plain_text(self, result, dimensions):"},{"line_number":32,"context_line":"        metric_type \u003d \"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_49bbba0e","line":29,"range":{"start_line":24,"start_character":13,"end_line":29,"end_character":91},"in_reply_to":"5a74a57a_a819d67b","updated":"2016-11-30 15:55:20.000000000","message":"Done","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"d5cfa5afe9ee234f2db443fae54e00c5524a2393","unresolved":false,"context_lines":[{"line_number":28,"context_line":"            else:"},{"line_number":29,"context_line":"                self.log.error(\"Unsupported content type - {}\".format(result_content_type))"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def _parse_plain_text(self, result, dimensions):"},{"line_number":32,"context_line":"        metric_type \u003d \"\""},{"line_number":33,"context_line":"        metric_name \u003d \"\""},{"line_number":34,"context_line":"        metric_dimensions \u003d {}"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_0d257c5b","line":31,"range":{"start_line":31,"start_character":8,"end_line":31,"end_character":25},"updated":"2016-11-29 20:46:00.000000000","message":"I think we should take a look at using the python prometheus client library here.  I think it can deal with parsing the data for us.","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"5139ebb49c390dc7e0eab711ed52969e56d3d153","unresolved":false,"context_lines":[{"line_number":28,"context_line":"            else:"},{"line_number":29,"context_line":"                self.log.error(\"Unsupported content type - {}\".format(result_content_type))"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def _parse_plain_text(self, result, dimensions):"},{"line_number":32,"context_line":"        metric_type \u003d \"\""},{"line_number":33,"context_line":"        metric_name \u003d \"\""},{"line_number":34,"context_line":"        metric_dimensions \u003d {}"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_c4afb192","line":31,"range":{"start_line":31,"start_character":8,"end_line":31,"end_character":25},"in_reply_to":"5a74a57a_0979c22f","updated":"2016-11-30 16:09:58.000000000","message":"We took histograms out of the Agent not too long ago because we couldn\u0027t deal with them correctly.  I\u0027d be fine with ignoring histogram for now assuming we can figure out what to do with the data in the future.\n\nIf the client library parsing doesn\u0027t maintain the metric type how do they report the type to prometheus?  Is this a problem with the python client or a general problem?","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"12f88051b998b156b6dc4c9dc6d1b77c650b9cf9","unresolved":false,"context_lines":[{"line_number":28,"context_line":"            else:"},{"line_number":29,"context_line":"                self.log.error(\"Unsupported content type - {}\".format(result_content_type))"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def _parse_plain_text(self, result, dimensions):"},{"line_number":32,"context_line":"        metric_type \u003d \"\""},{"line_number":33,"context_line":"        metric_name \u003d \"\""},{"line_number":34,"context_line":"        metric_dimensions \u003d {}"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_0979c22f","line":31,"range":{"start_line":31,"start_character":8,"end_line":31,"end_character":25},"in_reply_to":"5a74a57a_0d257c5b","updated":"2016-11-30 15:55:20.000000000","message":"it does but it doesnt carry the type of the metric in its return structure. GAUGE, COUNTER, SUMMARY, HISTOGRAM. I am not sure how we would handle the histogram. Should that be a gauge as i am treating the others? Example -\n\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00270.005\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00270.01\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00270.025\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00270.05\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00270.075\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00270.1\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00270.25\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00270.5\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00270.75\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00271.0\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00272.5\u0027}, 0.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00275.0\u0027}, 1.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u00277.5\u0027}, 1.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u002710.0\u0027}, 1.0)\n(u\u0027request_latency_seconds_bucket\u0027, {u\u0027le\u0027: u\u0027+Inf\u0027}, 1.0)\n(u\u0027request_latency_seconds_count\u0027, {}, 1.0)\n(u\u0027request_latency_seconds_sum\u0027, {}, 4.7)\n\nRight now I ignore histogram which not be the right answer either. If we want to treat all data as gauges then yes their parser would be easy to use.","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"7616f7e76f6d02dad66013dbf5ebce96651d62aa","unresolved":false,"context_lines":[{"line_number":28,"context_line":"            else:"},{"line_number":29,"context_line":"                self.log.error(\"Unsupported content type - {}\".format(result_content_type))"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def _parse_plain_text(self, result, dimensions):"},{"line_number":32,"context_line":"        metric_type \u003d \"\""},{"line_number":33,"context_line":"        metric_name \u003d \"\""},{"line_number":34,"context_line":"        metric_dimensions \u003d {}"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_1fc81474","line":31,"range":{"start_line":31,"start_character":8,"end_line":31,"end_character":25},"in_reply_to":"5a74a57a_c4afb192","updated":"2016-11-30 16:19:02.000000000","message":"i do not know how prometheus scrapes the metrics of type histogram or how it handles it internally. \n\nIf you look at the return data in raw text it has a description of the metric on the line before the metric with the type it is. \n\nThe python client just returns a list of metrics with labels, name and value no type or anything","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"5447bb710fa41f4db3874ce258ab6fa43fc4b9f0","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        return metric_dimensions"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":"    def _submit_metric(self, metric_type, metric_name, metric_value, metric_dimensions):"},{"line_number":67,"context_line":"        if metric_type \u003d\u003d \"gauge\" or metric_type \u003d\u003d \"summary\" or metric_type \u003d\u003d \"counter\":"},{"line_number":68,"context_line":"            self.gauge(metric_name, metric_value, dimensions\u003dmetric_dimensions)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_39aac219","line":67,"range":{"start_line":67,"start_character":11,"end_line":67,"end_character":22},"updated":"2016-11-28 16:56:41.000000000","message":"This can be written as:\nexpected_type \u003d [\"gauge\", \"summary\", \"counter]\nif metric_type in expected_type:\n   ......","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"12f88051b998b156b6dc4c9dc6d1b77c650b9cf9","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        return metric_dimensions"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":"    def _submit_metric(self, metric_type, metric_name, metric_value, metric_dimensions):"},{"line_number":67,"context_line":"        if metric_type \u003d\u003d \"gauge\" or metric_type \u003d\u003d \"summary\" or metric_type \u003d\u003d \"counter\":"},{"line_number":68,"context_line":"            self.gauge(metric_name, metric_value, dimensions\u003dmetric_dimensions)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_4973ba4d","line":67,"range":{"start_line":67,"start_character":11,"end_line":67,"end_character":22},"in_reply_to":"5a74a57a_39aac219","updated":"2016-11-30 15:55:20.000000000","message":"Done","commit_id":"135f5447b2f5c5a60ef4d0517d820aa6bbfdef72"},{"author":{"_account_id":12133,"name":"Cindy O\u0027Neill","email":"cindy.o-neill@hpe.com","username":"oneilcin"},"change_message_id":"8dbae377c8440d76e516fdcaabc0b338aee30567","unresolved":false,"context_lines":[{"line_number":22,"context_line":"            self.request_header \u003d None"},{"line_number":23,"context_line":"            self.verify \u003d None"},{"line_number":24,"context_line":"            if instances is not None and len(instances) \u003e 1:"},{"line_number":25,"context_line":"                raise Exception(\u0027Prometheus Client only supports one configured instance if auto detection is set\u0027)"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"    def check(self, instance):"},{"line_number":28,"context_line":"        dimensions \u003d self._set_dimensions(None, instance)"}],"source_content_type":"text/x-python","patch_set":6,"id":"5a74a57a_467f2066","line":25,"updated":"2016-11-30 17:59:07.000000000","message":"Not sure why this is, please see earlier comment about documenting auto_detect_applications","commit_id":"83104657bc2c484fcbecc0f17c7536ac6d9b2a9c"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":33,"context_line":"                self.log.error(\"metric_endpoint must be defined for each instance\")"},{"line_number":34,"context_line":"                return"},{"line_number":35,"context_line":"            default_dimensions \u003d instance.get(\"default_dimensions\", None)"},{"line_number":36,"context_line":"            endpoint_dimensions \u003d default_dimensions.copy(dimensions)"},{"line_number":37,"context_line":"            self.report_endpoint_metrics(metric_endpoint, endpoint_dimensions)"},{"line_number":38,"context_line":"        else:"},{"line_number":39,"context_line":"            detection_labels \u003d instance.get(\u0027detection_labels\u0027, DETECTION_LABEL_PAIRS)"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_78577dca","line":36,"range":{"start_line":36,"start_character":53,"end_line":36,"end_character":57},"updated":"2016-12-08 16:01:04.000000000","message":"I think this will fail if the above line returns \u0027None\u0027","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":37,"context_line":"            self.report_endpoint_metrics(metric_endpoint, endpoint_dimensions)"},{"line_number":38,"context_line":"        else:"},{"line_number":39,"context_line":"            detection_labels \u003d instance.get(\u0027detection_labels\u0027, DETECTION_LABEL_PAIRS)"},{"line_number":40,"context_line":"            kubernetes_labels \u003d instance.get(\u0027kubernetes_labels\u0027, KUBERNETES_LABELS)"},{"line_number":41,"context_line":"            port_name \u003d instance.get(\u0027port_name\u0027, None)"},{"line_number":42,"context_line":"            metric_endpoints \u003d self._get_metric_endpoints(detection_labels, kubernetes_labels, port_name)"},{"line_number":43,"context_line":"            for metric_endpoint, endpoint_dimensions in metric_endpoints.iteritems():"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_25e85c7c","line":40,"range":{"start_line":40,"start_character":66,"end_line":40,"end_character":83},"updated":"2016-12-08 16:01:04.000000000","message":"is it invalid to give no kubernetes labels?","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":38,"context_line":"        else:"},{"line_number":39,"context_line":"            detection_labels \u003d instance.get(\u0027detection_labels\u0027, DETECTION_LABEL_PAIRS)"},{"line_number":40,"context_line":"            kubernetes_labels \u003d instance.get(\u0027kubernetes_labels\u0027, KUBERNETES_LABELS)"},{"line_number":41,"context_line":"            port_name \u003d instance.get(\u0027port_name\u0027, None)"},{"line_number":42,"context_line":"            metric_endpoints \u003d self._get_metric_endpoints(detection_labels, kubernetes_labels, port_name)"},{"line_number":43,"context_line":"            for metric_endpoint, endpoint_dimensions in metric_endpoints.iteritems():"},{"line_number":44,"context_line":"                endpoint_dimensions.update(dimensions)"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_38b985ed","line":41,"range":{"start_line":41,"start_character":50,"end_line":41,"end_character":54},"updated":"2016-12-08 16:01:04.000000000","message":"should this return the default name listed at the top of the file?","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":58,"context_line":"                    metric_type \u003d comment_line[3]"},{"line_number":59,"context_line":"                    metric_dimensions \u003d dimensions.copy()"},{"line_number":60,"context_line":"                    got_dimensions_from_metric \u003d False"},{"line_number":61,"context_line":"            elif metric_type !\u003d \u0027histogram\u0027:"},{"line_number":62,"context_line":"                metric \u003d line.split(\" \")"},{"line_number":63,"context_line":"                metric_definition \u003d metric[0]"},{"line_number":64,"context_line":"                metric_value \u003d float(metric[1])"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_c2febead","line":61,"range":{"start_line":61,"start_character":17,"end_line":61,"end_character":43},"updated":"2016-12-08 16:01:04.000000000","message":"should this be \u0027metric_type in SUPPORTED_TYPES\u0027?","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":65,"context_line":"                if not got_dimensions_from_metric and \u0027{\u0027 in metric_definition:"},{"line_number":66,"context_line":"                    got_dimensions_from_metric \u003d True"},{"line_number":67,"context_line":"                    metric_dimensions \u003d self._get_metric_dimensions(metric_dimensions,"},{"line_number":68,"context_line":"                                                                    metric_definition.split(\"{\")[1][:-1])"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"                self._submit_metric(metric_type, metric_name, metric_value, metric_dimensions)"},{"line_number":71,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_a23462de","line":68,"range":{"start_line":68,"start_character":100,"end_line":68,"end_character":103},"updated":"2016-12-08 16:01:04.000000000","message":"is there more than one \u0027{\u0027 one each line?","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                    metric_dimensions \u003d self._get_metric_dimensions(metric_dimensions,"},{"line_number":68,"context_line":"                                                                    metric_definition.split(\"{\")[1][:-1])"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"                self._submit_metric(metric_type, metric_name, metric_value, metric_dimensions)"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def _get_metric_dimensions(self, metric_dimensions, metric_dimensions_string):"},{"line_number":73,"context_line":"        dimension_entries \u003d metric_dimensions_string.split(\",\")"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_c244feb8","line":70,"range":{"start_line":70,"start_character":21,"end_line":70,"end_character":35},"updated":"2016-12-08 16:01:04.000000000","message":"It seems a little confusing that the parsing method also submits the metrics.","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":72,"context_line":"    def _get_metric_dimensions(self, metric_dimensions, metric_dimensions_string):"},{"line_number":73,"context_line":"        dimension_entries \u003d metric_dimensions_string.split(\",\")"},{"line_number":74,"context_line":"        for dimension in dimension_entries:"},{"line_number":75,"context_line":"            dimension_split \u003d dimension.split(\u0027\u003d\u0027)"},{"line_number":76,"context_line":"            dimension_name \u003d dimension_split[0]"},{"line_number":77,"context_line":"            dimension_value \u003d dimension_split[1][1:-1]  # take off quotes"},{"line_number":78,"context_line":"            if dimension_name not in metric_dimensions:"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_82aa06d1","line":75,"range":{"start_line":75,"start_character":22,"end_line":75,"end_character":27},"updated":"2016-12-08 16:01:04.000000000","message":"nit: I think this could be called something like dimension_components or dimension_pieces to avoid reusing \u0027split\u0027","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":74,"context_line":"        for dimension in dimension_entries:"},{"line_number":75,"context_line":"            dimension_split \u003d dimension.split(\u0027\u003d\u0027)"},{"line_number":76,"context_line":"            dimension_name \u003d dimension_split[0]"},{"line_number":77,"context_line":"            dimension_value \u003d dimension_split[1][1:-1]  # take off quotes"},{"line_number":78,"context_line":"            if dimension_name not in metric_dimensions:"},{"line_number":79,"context_line":"                metric_dimensions[dimension_name] \u003d dimension_value"},{"line_number":80,"context_line":"        return metric_dimensions"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_02d35660","line":77,"range":{"start_line":77,"start_character":48,"end_line":77,"end_character":54},"updated":"2016-12-08 16:01:04.000000000","message":"are there only ever quotes on the value and not the name?","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        except Exception as e:"},{"line_number":114,"context_line":"            exception_message \u003d \"Could not get endpoints from kubernetes api with error - {}\".format(e)"},{"line_number":115,"context_line":"            self.log.exception(exception_message)"},{"line_number":116,"context_line":"            raise Exception(exception_message)"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"        for endpoint_entry in endpoints[\u0027items\u0027]:"},{"line_number":119,"context_line":"            endpoint_metadata \u003d endpoint_entry[\u0027metadata\u0027]"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_223bf2ec","line":116,"range":{"start_line":116,"start_character":18,"end_line":116,"end_character":46},"updated":"2016-12-08 16:01:04.000000000","message":"why not raise the original exception? Or else raise a more specific exception?","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"b19784ee91d0f4479a5754de023c0a758f99b143","unresolved":false,"context_lines":[{"line_number":156,"context_line":""},{"line_number":157,"context_line":"    def _is_prometheus_client_endpoint(self, endpoint_labels, detection_labels):"},{"line_number":158,"context_line":"        for label_key, label_value in detection_labels.iteritems():"},{"line_number":159,"context_line":"            if label_key in endpoint_labels and endpoint_labels[label_key] \u003d\u003d label_value:"},{"line_number":160,"context_line":"                continue"},{"line_number":161,"context_line":"            else:"},{"line_number":162,"context_line":"                return False"},{"line_number":163,"context_line":"        return True"},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    def _get_endpoint_dimensions(self, endpoint_labels, kubernetes_labels):"}],"source_content_type":"text/x-python","patch_set":10,"id":"3a71b18c_45855805","line":162,"range":{"start_line":159,"start_character":12,"end_line":162,"end_character":28},"updated":"2016-12-08 16:01:04.000000000","message":"could invert this if and just return false.","commit_id":"4e0f78138393d5123ba846be818fd56da8c78a77"}]}
