{"id":13606413,"url":"https://github.com/autometrics-dev/autometrics-shared","last_synced_at":"2025-04-13T15:06:19.276Z","repository":{"id":154026403,"uuid":"626950816","full_name":"autometrics-dev/autometrics-shared","owner":"autometrics-dev","description":"Resources used by all of the autometrics implementations","archived":false,"fork":false,"pushed_at":"2023-12-05T10:56:13.000Z","size":80,"stargazers_count":13,"open_issues_count":14,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-27T06:01:55.852Z","etag":null,"topics":["alerting","alerts","grafana","grafana-dashboard","monitoring","prometheus"],"latest_commit_sha":null,"homepage":"https://autometrics.dev","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","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":"LICENSE-APACHE","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":"2023-04-12T13:38:27.000Z","updated_at":"2025-01-29T01:29:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"e0427af9-a496-4006-8b4a-f9a82ea309b3","html_url":"https://github.com/autometrics-dev/autometrics-shared","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/autometrics-dev%2Fautometrics-shared","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Fautometrics-shared/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Fautometrics-shared/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Fautometrics-shared/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autometrics-dev","download_url":"https://codeload.github.com/autometrics-dev/autometrics-shared/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248539811,"owners_count":21121237,"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":["alerting","alerts","grafana","grafana-dashboard","monitoring","prometheus"],"created_at":"2024-08-01T19:01:08.915Z","updated_at":"2025-04-12T08:31:06.982Z","avatar_url":"https://github.com/autometrics-dev.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"![GitHub_headerImage](https://user-images.githubusercontent.com/3262610/221191767-73b8a8d9-9f8b-440e-8ab6-75cb3c82f2bc.png)\n\n[![Discord Shield](https://discordapp.com/api/guilds/950489382626951178/widget.png?style=shield)](https://discord.gg/kHtwcH8As9)\n\nThis repo contains resources shared between all of the [Autometrics](https://github.com/autometrics-dev) implementations.\n\n## [Autometrics Specification](./specs/autometrics_v1.0.0.md)\n\n## Dashboards\n\nYou can find the Grafana dashboard JSON files in the [dashboards](./dashboards/) directory.\n\nThese will work out of the box once you have imported them into Grafana and selected the Prometheus data source for them to use.\n\n## Prometheus Recording \u0026 Alerting Rules\n\nThe [`autometrics.rules.yml`](./autometrics.rules.yml) file contains the default recording and alerting rules for Prometheus.\n\n**This should work for most autometrics-instrumented projects without modification.**\n\nSpecifically, these rules will work for any project that uses the following objective percentiles: 90%, 95%, 99%, 99.9%. Projects that want to use other percentiles can generate a new rules file, specifying the `objectives` for the `autometrics-cli`'s `generate-sloth-file` command (see [here](https://github.com/autometrics-dev/autometrics-rs/tree/main/autometrics-cli)).\n\n## Adding the rules to Prometheus\n\nPrometheus can be configured to use the `autometrics.rules.yml` file using the `rule_files` field in the [Prometheus config](https://prometheus.io/docs/prometheus/latest/configuration/configuration):\n\n```yaml\n# prometheus.yml\n\nrule_files:\n  - /path/to/autometrics.rules.yml\n```\n\n### How it works\n\nThis file sets up a number of recording and alerting rules that are dormant by default and are only enabled when the autometrics libraries product metrics with special labels: `function_calls_total{objective_name=\"\", objective_percentile=\"\"}` or `function_calls_duration_seconds_bucket{objective_name=\"\", objective_latency_threshold=\"\", objective_percentile=\"\"}`.\n\nTo read more details about the label tricks we use to make these rules work across autometrics-instrumented projects, see [An adventure with SLOs, generic Prometheus alerting rules, and complex PromQL queries](https://fiberplane.com/blog/an-adventure-with-slos-generic-prometheus-alerting-rules-and-complex-promql-queries).\n\n### Re-generating the alerting rules file\n\nThe file is generated using the [autometrics-cli](https://github.com/autometrics-dev/autometrics-rs/tree/main/autometrics-cli) and the [Sloth](https://sloth.dev) tool.\n\nTo regenerate the file, you'll need:\n- Rust\n- Docker\n\nThen run:\n\n```shell\ngit clone https://github.com/autometrics-dev/autometrics-rs.git`\ncargo run -p autometrics-cli generate-sloth-file \u003e sloth.yml\ndocker run -v $(pwd):/data  ghcr.io/slok/sloth generate -i /data/sloth.yml -o /data/autometrics.rules.yml\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautometrics-dev%2Fautometrics-shared","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautometrics-dev%2Fautometrics-shared","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautometrics-dev%2Fautometrics-shared/lists"}