{"id":42863173,"url":"https://github.com/bvieira/json-to-statsd","last_synced_at":"2026-01-30T12:40:53.336Z","repository":{"id":57659272,"uuid":"92840615","full_name":"bvieira/json-to-statsd","owner":"bvieira","description":"Sends info from a http (GET) service as gauge to statsd every 'x' seconds","archived":false,"fork":false,"pushed_at":"2017-06-02T02:19:50.000Z","size":106,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T15:00:11.365Z","etag":null,"topics":["gauge","json","metrics","statsd","timer"],"latest_commit_sha":null,"homepage":"","language":"Go","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/bvieira.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}},"created_at":"2017-05-30T14:18:59.000Z","updated_at":"2024-06-20T15:00:11.366Z","dependencies_parsed_at":"2022-08-29T11:31:23.407Z","dependency_job_id":null,"html_url":"https://github.com/bvieira/json-to-statsd","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bvieira/json-to-statsd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvieira%2Fjson-to-statsd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvieira%2Fjson-to-statsd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvieira%2Fjson-to-statsd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvieira%2Fjson-to-statsd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bvieira","download_url":"https://codeload.github.com/bvieira/json-to-statsd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvieira%2Fjson-to-statsd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28912914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"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":["gauge","json","metrics","statsd","timer"],"created_at":"2026-01-30T12:40:51.911Z","updated_at":"2026-01-30T12:40:53.325Z","avatar_url":"https://github.com/bvieira.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"json-to-statsd\n======================\n\nSends info from a http (GET) service as gauge to statsd every 'x' seconds\n\n# Help \u0026 Usage\n```bash\n$ json-to-statsd -h\n```\n\n# Map\nThe map format is defined by setting the key for statsd metrics as key and the json path containing the metrics value as value on a yml file.\n```yaml\nstats.gauge.key: json.path\n```\n\n## JSON path\n[gjson](http://github.com/tidwall/gjson) is used for mapping the metrics from json, for path syntax, check on their docs.\n\n## Functions\nIt's possible to replace values using go native \"text/template\" syntax, **the template is rendered before applying json values only**\n\neg. APP_NAME=app1\ntemplate:\n```yaml\ndynamic.metrics.heap.total: metrics.#[name==\"{{env \"APP_NAME\"}}\"].totalHeapBytes\n```\nresult:\n```yaml\ndynamic.metrics.heap.total: metrics.#[name==\"app1\"].totalHeapBytes\n```\n\n## Aditional template functions\n### env [key]\nget key from env var, returns an error if not exists\n\n### envd [key] [default-value]\nget key from env var, returns default-value if not exists\n\n### lower [value]\nstring to lowercase\n\n### upper [value]\nstring to uppercase\n\n\n## Eg.\n```bash\n$ APP_NAME=app1 json-to-statsd -u http://my-api/status -p example -m map.yml -s 127.0.0.1:8125\n```\n\n### json service response\n```json\n{\n    \"version\": \"1.0.0\",\n    \"metrics\": [\n        {\n            \"name\": \"app1\",\n            \"totalHeapBytes\": 32212254721,\n            \"usedHeapBytes\": 1292247521,\n            \"totalThreads\": 291\n        },\n        {\n            \"name\": \"app2\",\n            \"totalHeapBytes\": 32212254722,\n            \"usedHeapBytes\": 1292247522,\n            \"totalThreads\": 292\n        }\n    ]\n}\n```\n### map\n```yaml\nversion: version\nfixed.app1.name: metrics.0.name\nfixed.app2.name: metrics.1.name\ndynamic.metrics.heap.total: metrics.#[name==\"{{env \"APP_NAME\"}}\"].totalHeapBytes\ndynamic.metrics.heap.used: metrics.#[name==\"{{env \"APP_NAME\"}}\"].usedHeapBytes\ndynamic.metrics.threads.total: metrics.#[name==\"{{env \"APP_NAME\"}}\"].totalThreads\n```\n\n### result\n```yaml\nexample.version: 1.0.0\nexample.fixed.app1.name: app1\nexample.fixed.app2.name: app2\nexample.dynamic.metrics.heap.total: 32212254721\nexample.dynamic.metrics.heap.used: 1292247521\nexample.dynamic.metrics.threads.total: 291\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbvieira%2Fjson-to-statsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbvieira%2Fjson-to-statsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbvieira%2Fjson-to-statsd/lists"}