{"id":16957924,"url":"https://github.com/joshnuss/vertex","last_synced_at":"2025-04-11T21:52:45.745Z","repository":{"id":54329971,"uuid":"522120787","full_name":"joshnuss/vertex","owner":"joshnuss","description":"Store multi-tenant metrics in ClickHouse","archived":false,"fork":false,"pushed_at":"2022-08-26T04:59:32.000Z","size":77,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T21:52:41.507Z","etag":null,"topics":["clickhouse","elixir","metrics"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/joshnuss.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":"2022-08-07T05:06:24.000Z","updated_at":"2024-05-18T12:26:43.000Z","dependencies_parsed_at":"2022-08-13T12:10:45.766Z","dependency_job_id":null,"html_url":"https://github.com/joshnuss/vertex","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/joshnuss%2Fvertex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshnuss%2Fvertex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshnuss%2Fvertex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshnuss%2Fvertex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshnuss","download_url":"https://codeload.github.com/joshnuss/vertex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487733,"owners_count":21112188,"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":["clickhouse","elixir","metrics"],"created_at":"2024-10-13T22:20:36.319Z","updated_at":"2025-04-11T21:52:45.719Z","avatar_url":"https://github.com/joshnuss.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vertex\n\nA server for storing multi-tenant metrics in [ClickHouse](https://clickhouse.com/).\n\n## Motivation\n\nUnlike StatsD, events are scoped by tenant. That makes it possible to have alerts and reporting on the tenant level.\n\nFor example, if you'd like to when accounts haven't logged in over for 2 weeks. The app could publish an event `login.success` and attach their `account_id` as the `tenant`. Then reporting and alerts could be triggered when `login.success` event is missing over a window of 2 weeks.\n\nThis approach is also more economical than DataDog or similar logging systems. It doesn't require expensive hosting, and the same infrastructure can support multiple projects for no additional cost.\n\n## Usage\n\n### Sending a single metric\n\n```bash\ncurl http://localhost:4000/event \\\n  --header \"authorization: Bearer \u003caccess-token\u003e\" \\\n  --header \"content-type: application/json\" \\\n  --data '{ \"tenant\": \"1234\", \"event\": \"order.success\", \"tags\": [\"enterprise-plan\", \"sandbox\"] }'\n```\n\n### Sending a batch of metrics\n\n```bash\ncurl http://localhost:4000/events \\\n  --header \"authorization: Bearer \u003caccess-token\u003e\" \\\n  --header \"content-type: application/json\" \\\n  --data '[{\"tenant\": \"1234\", \"event\": \"account.login\"}, {\"tenant\": \"1234\", \"event\": \"order.success\"}]'\n```\n\n## Deployment\n\nCreate the database using [`setup.sql`](/priv/setup.sql):\n\n```bash\ncat priv/setup.sql | clickhouse-client --host \u003cip\u003e --database=\u003cdb-name\u003e --user=default --password=\u003cpassword\u003e\n```\n\nSet up the environment variables:\n\n- `CLICKHOUSE_URL`: URL of the ClickHouse cluster. Including the port (usually `:8123`).\n- `CLICKHOUSE_DATABASE`: Name of the ClickHouse database.\n- `CLICKHOUSE_USER`: Name of ClickHouse user.\n- `CLICKHOUSE_PASSWORD`: Password for ClickHouse user.\n\nFor each project that can access the server, create a record in `projects.json`.\n\n```json\n{\n  \"my-project\": \"my-access-token\",\n  \"my-other-project\": \"my-other-access-token\"\n}\n```\n\nThe key is the name of the project, and the value is the access token.\n\n## Future ideas\n\n- Support triggers: send an email when something happens\n- Support expectations: send an email when something doesn't happen\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshnuss%2Fvertex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshnuss%2Fvertex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshnuss%2Fvertex/lists"}