{"id":13726615,"url":"https://github.com/odis-labs/refana","last_synced_at":"2025-05-07T21:33:21.325Z","repository":{"id":129074890,"uuid":"192937656","full_name":"odis-labs/refana","owner":"odis-labs","description":"Define Grafana dashboards with ReasonML","archived":false,"fork":false,"pushed_at":"2020-01-31T16:14:55.000Z","size":77,"stargazers_count":19,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-03T01:29:12.414Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://odis-labs.github.io/refana/refana","language":"Reason","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/odis-labs.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}},"created_at":"2019-06-20T14:45:28.000Z","updated_at":"2023-07-27T12:05:31.000Z","dependencies_parsed_at":"2023-04-10T00:18:33.054Z","dependency_job_id":null,"html_url":"https://github.com/odis-labs/refana","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odis-labs%2Frefana","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odis-labs%2Frefana/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odis-labs%2Frefana/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odis-labs%2Frefana/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/odis-labs","download_url":"https://codeload.github.com/odis-labs/refana/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224654331,"owners_count":17347727,"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-08-03T01:03:14.702Z","updated_at":"2024-11-14T16:34:12.949Z","avatar_url":"https://github.com/odis-labs.png","language":"Reason","funding_links":[],"categories":["Reason"],"sub_categories":[],"readme":"# Refana\n\nDefine Grafana dashboards with ReasonML.\n\n- [Homepage](https://odis-labs.github.io/refana/refana)\n- [API reference](https://odis-labs.github.io/refana/refana/Refana)\n\n\n## Usage\n\n### Defining metrics\n\n```reason\nlet cpu = (~name) =\u003e\n  Grafana.(Query.prometheus(Prometheus_query {\n    \"id\": \"CPU\",\n    \"expr\": fmt(\"rate(cpu_seconds{container_name=~'%s'}[30s])\", name),\n    \"format\": \"time_series\",\n    \"legend\": \"cpu_seconds@{{pod_name}}\"\n  }));\n\nlet mem = (~name) =\u003e\n  Grafana.(Query.prometheus(Prometheus_query {\n    \"id\": \"MEM\",\n    \"expr\": fmt(\"sum(memory_rss{container_name=~'%s'}) by (pod_name)\", name),\n    \"format\": \"time_series\",\n    \"legend\": \"memory_rss@{{pod_name}}\"\n  }));\n```\n\n### Creating panels\n\n```reason\nlet name = \"my-app\";\n\nlet metrics = Grafana.[\n  Panel.row(Row {\n    \"title\": \"My metrics\",\n    \"position\": size(~width=24, ~height=1),\n  }),\n\n  Panel.graph(Graph {\n    \"title\": \"Container CPU usage\",\n    \"position\": size(~width=12, ~height=9),\n    \"queries\": [cpu(~name)]\n  }),\n  Panel.graph(Graph {\n    \"title\": \"Container memory usage\",\n    \"position\": size(~width=12, ~height=9),\n    \"queries\": [Std.Grafana.Metrics.mem(~name)]\n  })\n];\n```\n\n### Creating dashboards\n\n```reason\nlet dash = Grafana.Dashboard {\n  \"title\": \"My Monitoring Dashboard\",\n  \"panels\": Grafana.panels([metrics])\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodis-labs%2Frefana","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fodis-labs%2Frefana","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodis-labs%2Frefana/lists"}