{"id":26059703,"url":"https://github.com/orange-cloudfoundry/promconsulfetcher","last_synced_at":"2026-04-17T14:34:20.504Z","repository":{"id":39068052,"uuid":"437313268","full_name":"orange-cloudfoundry/promconsulfetcher","owner":"orange-cloudfoundry","description":"fetch metrics from all services instance queried in a consul","archived":false,"fork":false,"pushed_at":"2025-10-28T18:03:12.000Z","size":8483,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-12-10T06:26:54.290Z","etag":null,"topics":["consul","fetch","metrics","prometheus"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orange-cloudfoundry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-12-11T15:06:25.000Z","updated_at":"2023-01-31T19:21:48.000Z","dependencies_parsed_at":"2023-10-23T20:26:00.510Z","dependency_job_id":"db9eb7c9-77dd-4f02-9270-5742f92cb3a5","html_url":"https://github.com/orange-cloudfoundry/promconsulfetcher","commit_stats":{"total_commits":78,"total_committers":3,"mean_commits":26.0,"dds":"0.14102564102564108","last_synced_commit":"df36aac1e8c3105e8fc809205f233fa8645c9d48"},"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"purl":"pkg:github/orange-cloudfoundry/promconsulfetcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orange-cloudfoundry%2Fpromconsulfetcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orange-cloudfoundry%2Fpromconsulfetcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orange-cloudfoundry%2Fpromconsulfetcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orange-cloudfoundry%2Fpromconsulfetcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orange-cloudfoundry","download_url":"https://codeload.github.com/orange-cloudfoundry/promconsulfetcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orange-cloudfoundry%2Fpromconsulfetcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31933314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T12:37:54.787Z","status":"ssl_error","status_checked_at":"2026-04-17T12:37:25.095Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["consul","fetch","metrics","prometheus"],"created_at":"2025-03-08T13:27:56.259Z","updated_at":"2026-04-17T14:34:20.486Z","avatar_url":"https://github.com/orange-cloudfoundry.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Promconsulfetcher\n\nPromconsulfetcher was made for [consul](https://www.consul.io/) and the idea behind is to give ability to fetch metrics\nfrom all services instance queried in a consul. This allow to aggregate metrics from a consul cluster where node and\ntheir port is not accessible by a prometheus instance.\n\nUser can retrieve is metrics by simply call `/v1/services/[consul template style query]/metrics` which will merge all\nmetrics from service instances and add labels:\n- `node_name`\n- `node_id`\n- `node_address`\n- `datacenter`\n- `service_id`\n- `service_name`\n- `service_address`\n- `service_port`\n\n## Example\n\nMetrics from app instance 0:\n\n```\ngo_memstats_mspan_sys_bytes{} 65536\n```\n\nMetrics from app instance 1:\n\n```\ngo_memstats_mspan_sys_bytes{} 5600\n```\n\nbecome:\n\n```\ngo_memstats_mspan_sys_bytes{node=\"node1\",id=\"id1\",address=\"host1\",datacenter=\"dc1\",service_id=\"id1\",service_name=\"name\",service_address=\"host1\",service_port=\"4646\",instance=\"172.76.112.90:61038\"} 65536\ngo_memstats_mspan_sys_bytes{node=\"node2\",id=\"id2\",address=\"host2\",datacenter=\"dc1\",service_id=\"id2\",service_name=\"name\",service_address=\"host2\",service_port=\"4646\",instance=\"172.76.112.91:61010\"} 65536\n```\n\n## How to use ?\n\n## Consul-template style query\n\nThis is the same query style described\nhere: https://github.com/hashicorp/consul-template/blob/master/docs/templating-language.md#service\n\nIt must have the form `\u003cTAG\u003e.\u003cNAME\u003e@\u003cDATACENTER\u003e~\u003cNEAR\u003e`\n\nThe `\u003cTAG\u003e` attribute is optional; if omitted, all nodes will be queried.\n\nThe `\u003cDATACENTER\u003e` attribute is optional; if omitted, the local datacenter is used.\n\nThe `\u003cNEAR\u003e` attribute is optional; if omitted, results are specified in lexical order. If provided a node name, results\nare ordered by shortest round-trip time to the provided node. If provided `_agent`, results are ordered by shortest\nround-trip time to the local agent.\n\n## If metrics available on `/metrics` on your app\n\nYou have nothing to do, you can retrieve app instances metrics by simply call one of:\n\n- [my.promconsulfetcher.com/v1/services/\\[consul template style query\\]/metrics](my.promconsulfetcher.com/v1/services/{consul template style query}/metrics)\n- [my.promconsulfetcher.com/v1/services/metrics?consul_query=\"\\[consul template style query\\]\"](my.promconsulfetcher.com/v1/services/metrics?consul_query=\"\\[consul template style query\\]\")\n\n## Set a different endpoint\n\n## Consul tag\n\nAdd tag `promconsulfetcher.metric_path=/my-metrics/endpoint`\n\n## In fetch URL\n\nAdd url param `metric_path=/my-metrics/endpoint`, e.g.:\n\n- [my.promconsulfetcher.com/v1/services/\\[consul template style query\\]/metrics?metric_path=/my-metrics/endpoint](my.promconsulfetcher.com/v1/services/{consul template style query}/metrics?metric_path=/my-metrics/endpoint)\n\n## Set a different scheme\n\n## Consul tag\n\nAdd tag `promconsulfetcher.scheme=https`\n\n## In fetch URL\n\nAdd url param `scheme=https`, e.g.:\n\n- [my.promconsulfetcher.com/v1/services/\\[consul template style query\\]/metrics?scheme=https](my.promconsulfetcher.com/v1/services/{consul template style query}/metrics?scheme=https)\n\n## Pass http headers to app, useful for authentication\n\nIf you do a request with headers, they are all passed to app.\n\nThis is useful for authentication purpose, example on basic auth\n\n1. I have an app with metrics on `/metrics` but it is protected with basic auth `foo`/`bar`\n2. You can perform curl: `curl https://foo:bar@my.promconsulfetcher.com/v1/services/my-app/metrics`\n3. Basic auth header are passed to app and you can retrieve information (note that promconsulfetcher do not store\n   anything)\n\n## Retrieving only metrics from your app and not those from external\n\nUse `/only-app-metrics` instead of `/metrics`, e.g.:\n\n- [my.promconsulfetcher.com/v1/services/\\[org_name\\]/\\[space_name\\]/\\[app_name\\]/only-app-metrics](my.promconsulfetcher.com/v1/services/{org_name}/{space_name}/{app_name}/only-app-metrics)\n- [my.promconsulfetcher.com/v1/services/only-app-metrics?app=\"\\[app_id\\]\"](my.promconsulfetcher.com/v1/services/only-app-metrics?app=\"\\[app_id\\]\")\n\n## How to deploy ?\n\nPlease download [latest release](/releases) for your platform and run it with `./promconsulfetcher`, you will now have\naccess to `http://localhost:8085` which is the user doc.\n\n### Configure\n\nOf course, default configuration will not work in most context, to configure you write a `config.yml` and configure as\ndescribed:\n\nFor understanding config definition format:\n\n- `[]` means optional (by default parameter is required)\n- `\u003c\u003e` means type to use\n\n### Root configuration in config.yml\n\n```yaml\n# Port for listening\n[ port: \u003cint\u003e | default = 8085]\n\n# Port for listening health check\n[ health_check_port: \u003cint\u003e | default = 8080]\n\n# External url which give docs url to user\n# This is an url pointing on this service of course\n# using it let you separate logs part from user part\n[ base_url: \u003cstring\u003e | default = \"http://localhost:8085\" ]\n\n# skip ssl validation when connecting to services found\n[ skip_ssl_validation: \u003cbool\u003e ]\n\n# set to true to enable ssl server\n# you will need to set `tls_pem.cert_chain` and `tls_pem.private_key`\n[ enable_ssl: \u003cbool\u003e ]\n\n# CA(s) in pem format (multiple can bet set inside) \n# which will be use when connecting on service\n[ ca_certs: \u003cstring\u003e ]\n\n# tls cert and private key in pem format if you want to enable ssl\ntls_pem:\n  cert_chain: \u003cstring\u003e\n  private_key: \u003cstring\u003e\n\nlog:\n  # log level to use for server\n  # you can chose: `trace`, `debug`, `info`, `warn`, `error`, `fatal` or `panic`\n  [ level: \u003cstring\u003e | default = info ]\n  # Set to true to force not have color when seeing logs\n  [ no_color: \u003cbool\u003e ]\n  # et to true to see logs as json format\n  [ in_json: \u003cbool\u003e ]\n\n# consul configuration for connecting\nconsul:\n  # Defines the address of the Consul server\n  [ address: \u003cstring\u003e | default = \"127.0.0.1:8500\" ]\n  \n  # Defines the URI scheme for the Consul server\n  [ scheme: \u003cstring\u003e | default = \"http\" ]\n  \n  # Defines the datacenter to use.\n  # If not provided, Consul uses the default agent datacenter\n  [ datacenter: \u003cstring\u003e ]\n  \n  # Token is used to provide a per-request ACL \n  # token which overwrites the agent's default token.\n  [ token: \u003cstring\u003e ]\n  \n  # Limits the duration for which a Watch can block. \n  # If not provided, the agent default values will be used.\n  [ endpoint_wait_time: \u003cstring\u003e ]\n  \n  # Defines the TLS configuration used for the secure connection to Consul Catalog\n  tls:\n    # the path to the certificate authority used for the secure \n    # connection to Consul Catalog, it defaults to the system bundle\n    [ ca: \u003cstring\u003e ]\n    # the path to the public certificate used for the secure \n    # connection to Consul Catalog. When using this option, \n    # setting the key option is required\n    [ cert: \u003cstring\u003e ]\n    # the path to the private key used for the secure \n    # connection to Consul Catalog. When using this option, \n    # setting the cert option is required\n    [ key: \u003cstring\u003e ]\n    # if true, the TLS connection to Consul accepts any certificate \n    # presented by the server regardless of the hostnames it covers\n    [ skip_ssl_validation: \u003cbool\u003e ]\n  \n  # Used to authenticate the HTTP client using HTTP Basic Authentication\n  http_auth:\n    # Username to use for HTTP Basic Authentication\n    [ username: \u003cstring\u003e ]\n    # Password to use for HTTP Basic Authentication\n    [ password: \u003cstring\u003e ]\n\n```\n\n## Metrics\n\nPromconsulfetcher expose metrics on `/metrics`:\n\n- `promconsulfetcher_metric_fetch_failed_total`: Number of non fetched metrics without be an normal error.\n- `promconsulfetcher_metric_fetch_success_total`: Number of fetched metrics succeeded for an app (app instance call are\n  summed).\n- `promconsulfetcher_latest_time_scrape_route`: Last time that route has been scraped in seconds.\n- `promconsulfetcher_scrape_route_failed_total`: Number of non fetched metrics without be an normal error.\n\n## Graceful shutdown\n\nPromconsulfetcher when receiving a SIGINT or SIGTERM or SIGUSR1 signal will stop listening new connections and will wait\nto finish opened requests before stopping. If opened requests are not finished after 15 seconds the server will be hard\nclosed.\n\n## Health Check\n\nHealth check is available by default on port 8080. If promconsulfetcher is not healthy or not yet healthy it will\nrespond a 503 error, if not it will respond a 200.\n\nUser can send a `USR1` signal on promconsulfetcher to set unhealthy on health check in addition to stop gracefully.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forange-cloudfoundry%2Fpromconsulfetcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forange-cloudfoundry%2Fpromconsulfetcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forange-cloudfoundry%2Fpromconsulfetcher/lists"}