{"id":23532657,"url":"https://github.com/outbrain-inc/torch","last_synced_at":"2025-04-22T22:41:23.756Z","repository":{"id":45944119,"uuid":"76394745","full_name":"outbrain-inc/torch","owner":"outbrain-inc","description":"A Prometheus metrics aggregator","archived":false,"fork":false,"pushed_at":"2023-03-31T12:20:50.000Z","size":16,"stargazers_count":23,"open_issues_count":1,"forks_count":7,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-29T19:34:31.429Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/outbrain-inc.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}},"created_at":"2016-12-13T20:13:48.000Z","updated_at":"2024-11-11T18:33:49.000Z","dependencies_parsed_at":"2024-11-12T17:02:43.131Z","dependency_job_id":"01366360-5416-43cb-a4ee-340b7e3c5c87","html_url":"https://github.com/outbrain-inc/torch","commit_stats":null,"previous_names":["outbrain-inc/torch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Ftorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Ftorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Ftorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Ftorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outbrain-inc","download_url":"https://codeload.github.com/outbrain-inc/torch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337276,"owners_count":21414092,"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-12-25T23:12:12.300Z","updated_at":"2025-04-22T22:41:23.738Z","avatar_url":"https://github.com/outbrain-inc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Torch: A Prometheus metrics aggregator\n\nTorch is a web application meant to fill in for a use case the the Prometheus Pushgateway explicitly does not support, aggregating metrics.  This is useful for scenarios where standard code instrumentation fails such as a python web application which uses multiple worker processes.  If we use standard instrumentation, we would only get the results from whichever worker serves the page that Prometheus will scrape rather than the combined metrics from all of the worker processes.\n\n## How to use\n\nInstall the torch python package. It will create a script named torch. You must set the port for torch to run on by setting the environment variable `SERVICE_PORT`\n\nBy default a metric/label combination which has not been updated will be removed after 24 hours.  Set the environment variable `TORCH_TTL` to change the number of hours to wait before cleaning up old metrics.\n\n###Usage\n\n    SERVICE_PORT=9092 torch\n\n## How it works\n\nTorch works via a simple HTTP interface.\n\nMetrics are expected to be sent as JSON blobs with the following format:\n\n    {\n    \tname: \"The name of the metric\",\n    \tdescription: \"The description of the metric\",\n    \tlabels: {label1: \"value1\", label2: \"value2\"},\n    \tvalue: 1.2\n    }\n\nIf the metric is a histogram you can define the bucket values via an additional \"bucket\" field to be sent as an array. If the buckets are not defined Torch will use these values by default:\n\n    [.005, .01, .025, .05, .075, .1, .25, .5, .75, 1.0, 2.5, 5.0, 7.5, 10.0, +Inf]\n\nIf custom bucket values are sent which do not end wit +Inf, torch will automatically add +Inf as the last bucket value.\n\nExample of a histogram metric blob with custom bucket values\n\n    {\n    \tname: \"The name of the metric\",\n    \tdescription: \"The description of the metric\",\n    \tlabels: {label1: \"value1\", label2: \"value2\"},\n    \tvalue: 1.2,\n    \tbuckets: [1, 2, 3, 5, 8, 13, +Inf]\n    }\n\n\n*Note: Torch does not support dynamic quantile calculation for the Summary metric type*\n\n## Clients\nA python client is included in the torch package, though implementing a client in other languages should be pretty easy.\n\n## Routes\n\n###\t/metrics/\nThis will generate the scrape page formatted how Prometheus expects\n\n###\t/metrics\nThis will generate the scrape page formatted how Prometheus expects\n\n###\t/metrics/counter\nIncrement Counter\n\n###\t/metrics/gauge/inc\nIncrement Gauge\n\n###\t/metrics/gauge/dec\nDecrement Gauge\n\n###\t/metrics/gauge/set\nSet Gauge\n\n###\t/metrics/summary\nUpdate Summary\n\n###\t/metrics/histogram\nUpdate Histogram\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutbrain-inc%2Ftorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutbrain-inc%2Ftorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutbrain-inc%2Ftorch/lists"}