{"id":18793010,"url":"https://github.com/autometrics-dev/render-prometheus","last_synced_at":"2025-06-18T21:43:40.277Z","repository":{"id":189725062,"uuid":"681179102","full_name":"autometrics-dev/render-prometheus","owner":"autometrics-dev","description":"Cooking ground for Prometheus render blueprint","archived":false,"fork":false,"pushed_at":"2023-08-25T09:29:25.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-18T07:58:19.156Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/autometrics-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-08-21T12:49:44.000Z","updated_at":"2023-08-24T07:40:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2abed7a-0b2b-42dc-a72a-448be2c5d34c","html_url":"https://github.com/autometrics-dev/render-prometheus","commit_stats":null,"previous_names":["gagbo/render-prometheus"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Frender-prometheus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Frender-prometheus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Frender-prometheus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Frender-prometheus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autometrics-dev","download_url":"https://codeload.github.com/autometrics-dev/render-prometheus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239718367,"owners_count":19685725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-07T21:23:06.282Z","updated_at":"2025-02-19T19:15:38.542Z","avatar_url":"https://github.com/autometrics-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Render blueprint for Prometheus\n\nA wrapper-based docker service for your Render blueprints. This allows setting\nup a Prometheus instance scrapping your other services.\n\n## Quickstart\n\nAdd this service in your `render.yaml`\n\n```yaml\n- type: worker\n  name: prometheus\n  runtime: docker\n  repo: https://github.com/autometrics-dev/render-prometheus\n  dockerContext: ./docker\n  envVars:\n    # Setting root/global options for Prometheus configuration\n    - key: PROM_GLOBAL_OPTS\n      value: \"global.scrape_interval=3s;global.scrape_timeout=1s;global.external_labels.monitor=Render;rule_files.1=/mount/rules/*.yml\"\n    # Setting up a Front-end target\n    - key: PROM_TARGET_FRONT_END\n      fromService:\n        type: web\n        name: front-end\n        property: hostport\n    - key: PROM_OPTS_FRONT_END\n      value: \"scheme=https;metrics_path=/prometheus\"\n    # Setting up a Back-end target\n    - key: PROM_TARGET_BACK_END\n      fromService:\n        type: web\n        name: back-end\n        property: hostport\n    - key: PROM_OPTS_BACK_END\n      value: \"honor_labels=true\"\n```\n\n## Options\n\nManipulating the configuration for Prometheus all come down to using\nenvironment variables.\n\n### Configuring monitored targets\n\nAll flags are passed as environment variables. When they allow multiple values,\nthey are separated by `;`.\n\nKey-value pairs in `;` separated lists have a `=` sign between the key and the\nvalue: `key=value`. The pairs are split on the first `=` only, so passing\n`aie=joé=tsr` will become a pair with `aie` as the key, and `joé=tsr` as the\nvalue.\n\nKeys are `.` separated path into the configuration. For example, to target the\nglobal `scrape_interval` in a configuration, you must use `global.scrape_interval`.\n\nFor values that are lists, like `alerting.alertmanagers`, you can use integers to\ntarget elements in the list (it will auto append a new element if the index is\nexactly the next available element): `alerting.alertmanagers.0.timeout=2s` will set\nthe timeout of the first alertmanager to `2s`, creating it if necessary.\n\nintegers, floating-point numbers, and `true`/`false` are interpreted as numbers and\nbooleans by default. To have actual strings for those values, wrap these values in `\"\"`:\n`honor_labels=true` affects a boolean to `honor_labels`, whereas\n`alerting.alertmanagers.0.api_version=\"true\"` affects a string to `api_version`.\n\n\n#### Global flags\n\nFlags that do not concern the scrape targets must go in `PROM_GLOBAL_OPTS`. This environment variable\ncontains a list of `=` key-value pairs that define the values to use for each key we want non-default.\n\n#### Per target flag\n\nTo define a new target, you can choose any name (let's say `nitrogen`), and then\nbuild environment variables that allow creating a monitorng job for prometheus\nwith that name:\n\n- `PROM_TARGET_NITROGEN` is a `;`-separated list of the targets to scrape for\n  this job. This environment variable is separate from the rest to allow reusing\n  the `hostport` variable from `fromService` in Blueprints.\n- `PROM_OPTS_NITROGEN` is a list of options that will go under the\n  `scrape_config` with `job_name: nitrogen`. This allows for example to set the\n  `scheme` or the `metrics_path` for a monitoring job.\n\n### Passing flags to Prometheus\n\nAll the command line arguments passed to the image are given as-is to the\nprometheus instance being wrapped. Note that using `config.file` and \n`web.listen-address` flags is forbidden, as:\n- `config.file` is hardcoded to use the generated configuration from\n  environment variables, and\n- `web.listen-address` is hardcoded to listen to `$PORT` on all interfaces\n  (`0.0.0.0`) so that Prometheus is correctly detected by Render.\n\n## Limitations\n\n### Autoscaled services\n\nCurrently, Render does not give access to [per-instance\nmetrics](https://feedback.render.com/features/p/per-instance-metrics-for-multi-instance-services),\ntherefore the metrics collected here will only work on single-instance\nservices.\n\n**Targeting multi-instance services will produce semi-random data (because of load-balancing) and produce wrong alerts/SLOs**\n\n### Pulling metrics\n\nThis service will only work with scraping metrics for now, as it's the\nrecommended way to deal with long running services, notably to have\nbetter uptime metrics and control data usage.\n\n### Prometheus does not work on Free Tier\n\n_Technically_ Prometheus works, but with instances shutting down after some\ninactivity, it makes everything unreliable:\n- the Prometheus instance itself might shutdown, and lose all its data (free\n  tier doesn't have access to persistent disks).\n- once shutdown, the restart of Prometheus might take time, and\n- the monitored services can also shutdown, and then Prometheus will mark the\n  services as down, as the `/metrics` endpoint response time gets longer than\n  the configured\n  [scrape_timeout](https://prometheus.io/docs/prometheus/latest/configuration/configuration)\n\n\n## Following tasks/Tentative roadmap\n\n- [ ] Set up [file-based service\n      discovery](https://prometheus.io/docs/guides/file-sd/#use-file-based-service-discovery-to-discover-scrape-targets)\n      somehow.\n\n## Open questions\n\n- Are we sure that the service is going to be restarted if the `hostport` changes?\n- If the service restarts, are we guaranteed to keep the extra data?\n  + It should be handled by attaching disks to the service. Meaning it's only available\n    for paying customers of Render for now.\n- How can we make it so Prometheus is never restarted, but instead call its\n  reload-config endpoint when something changes in the configuration?\n  + Use service discovery\n- Is it possible to update the configuration externally?\n  + Use service discovery, again\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautometrics-dev%2Frender-prometheus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautometrics-dev%2Frender-prometheus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautometrics-dev%2Frender-prometheus/lists"}