Skip to content

Commit fd5a356

Browse files
authored
More detailed top-line description (#65)
1 parent 4c7600c commit fd5a356

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

autometrics/README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,34 @@
44
[![Crates.io](https://img.shields.io/crates/v/autometrics.svg)](https://crates.io/crates/autometrics)
55
[![Discord Shield](https://discordapp.com/api/guilds/950489382626951178/widget.png?style=shield)](https://discord.gg/kHtwcH8As9)
66

7-
**A Rust macro that makes it easy to understand the error rate, response time, and production usage of any function in your code.**
7+
Autometrics is an open source framework that makes it easy to understand the health and performance of your code in production.
88

9-
Jump from your IDE to live Prometheus charts for each HTTP/RPC handler, database method, or other piece of application logic.
9+
The Rust library provides a macro that makes it trivial to track the most useful metrics for any function: request rate, error rate, and lantency. It then generates Prometheus queries to help you understand the data collected and inserts links to the live charts directly into each function's doc comments.
1010

11-
<video src="https://user-images.githubusercontent.com/3262610/220152261-2ad6ab2b-f951-4b51-8d6e-855fb71440a3.mp4" autoplay loop muted width="100%"></video>
11+
Autometrics also provides Grafana dashboards to get an overview of instrumented functions and enables you to create powerful alerts based on Service-Level Objectives (SLOs) directly in your source code.
1212

1313
```rust
1414
use autometrics::autometrics;
1515

1616
#[autometrics]
1717
pub async fn create_user() {
18-
// Now this function will be producing metrics!
18+
// Now this function will have metrics!
1919
}
2020
```
2121

22+
Here is a demo of jumping from function docs to live Prometheus charts:
23+
24+
<video src="https://user-images.githubusercontent.com/3262610/220152261-2ad6ab2b-f951-4b51-8d6e-855fb71440a3.mp4" autoplay loop muted width="100%"></video>
25+
26+
2227
## Features
2328

2429
-[`#[autometrics]`](https://docs.rs/autometrics/latest/autometrics/attr.autometrics.html) macro instruments any function or `impl` block to track the most useful metrics
2530
- 💡 Writes Prometheus queries so you can understand the data generated without knowing PromQL
2631
- 🔗 Injects links to live Prometheus charts directly into each function's doc comments
27-
- 📊 Grafana dashboards to visualize the performance of all instrumented functions
28-
- 🚨 Enable Prometheus alerts using SLO best practices from simple annotations in your code
29-
- ⚙️ Configurable metric collection library (`opentelemetry`, `prometheus`, or `metrics`)
32+
- [🚨 Define alerts](#alerts--slos) using SLO best practices directly in your source code
33+
- [📊 Grafana dashboards](#dashboards) work out of the box to visualize the performance of instrumented functions & SLOs
34+
- [⚙️ Configurable](#metrics-libraries) metric collection library (`opentelemetry`, `prometheus`, or `metrics`)
3035
- ⚡ Minimal runtime overhead
3136

3237
See [Why Autometrics?](https://github.com/autometrics-dev#why-autometrics) for more details on the ideas behind autometrics.
@@ -53,7 +58,7 @@ Or run the example in Gitpod:
5358

5459
## Exporting Prometheus Metrics
5560

56-
Prometheus works by polling a specific HTTP endpoint on your server to collect the current state of all the metrics it has in memory.
61+
Prometheus works by polling an HTTP endpoint on your server to collect the current values of all the metrics it has in memory.
5762

5863
### For projects not currently using Prometheus metrics
5964

@@ -89,7 +94,7 @@ pub fn get_metrics() -> (http::StatusCode, String) {
8994

9095
Autometrics uses existing metrics libraries (see [below](#metrics-libraries)) to produce and collect metrics.
9196

92-
If you are already using one of these to collect and export metrics, simply configure autometrics to use the same library and the metrics it produces will be exported alongside yours. You do not need to use the Prometheus exporter functions this library provides and you do not need a separate endpoint for autometrics' metrics.
97+
If you are already using one of these to collect metrics, simply configure autometrics to use the same library and the metrics it produces will be exported alongside yours. You do not need to use the Prometheus exporter functions this library provides and you do not need a separate endpoint for autometrics' metrics.
9398

9499
## Dashboards
95100

@@ -123,9 +128,7 @@ Once you've added objectives to your code, you can use the [Autometrics Service-
123128

124129
### Custom Prometheus URL
125130

126-
By default, Autometrics creates Prometheus query links that point to `http://localhost:9090`.
127-
128-
You can configure a custom Prometheus URL using a build-time environment in your `build.rs` file:
131+
Autometrics creates Prometheus query links that point to `http://localhost:9090` by default but you can configure it to use a custom URL using an environment variable in your `build.rs` file:
129132

130133
```rust
131134
// build.rs
@@ -138,13 +141,13 @@ fn main() {
138141

139142
When using Rust Analyzer, you may need to reload the workspace in order for URL changes to take effect.
140143

141-
Note that the Prometheus URL is only included in function documentation comments so changing it will have no impact on the final compiled binary.
144+
The Prometheus URL is only included in documentation comments so changing it will have no impact on the final compiled binary.
142145

143146
### Feature flags
144147

145148
- `prometheus-exporter` - exports a Prometheus metrics collector and exporter (compatible with any of the Metrics Libraries)
146-
- `custom-objective-latency` - by default, Autometrics only supports a fixed set of latency thresholds for objectives. Enable this to use custom latency thresholds. Note, however, that the custom latency must match one of the buckets configured for your histogram, meaning you will not be able to use the default Prometheus exporter. This is not currently compatible with the `prometheus` or `prometheus-exporter` feature.
147-
- `custom-objective-percentile` by default, Autometrics only supports a fixed set of objective percentiles. Enable this to use a custom percentile. Note, however, that using custom percentiles requires generating a different recording and alerting rules file using the CLI + Sloth.
149+
- `custom-objective-latency` - by default, Autometrics only supports a fixed set of latency thresholds for objectives. Enable this to use custom latency thresholds. Note, however, that the custom latency **must** match one of the buckets configured for your histogram or the alerts will not work. This is not currently compatible with the `prometheus` or `prometheus-exporter` feature.
150+
- `custom-objective-percentile` by default, Autometrics only supports a fixed set of objective percentiles. Enable this to use a custom percentile. Note, however, that using custom percentiles requires generating a different recording and alerting rules file using the CLI + Sloth (see [here](../autometrics-cli/)).
148151

149152
#### Metrics Libraries
150153

0 commit comments

Comments
 (0)