Skip to content

Commit 11df698

Browse files
authored
Simplify + split out readmes (#108)
* Simplify the intro descriptions * Separate readmes for crates.io and docs.rs * Fix links
1 parent 208593c commit 11df698

File tree

4 files changed

+185
-121
lines changed

4 files changed

+185
-121
lines changed

README.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,23 @@
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-
Autometrics is an observability micro-framework built for developers.
7+
Autometrics provides a macro that makes it easy to instrument any function with the most useful metrics: request rate, error rate, and latency. It then uses the instrumented function names to generate Prometheus queries to help you identify and debug issues in production.
88

9-
The Rust library provides a macro that makes it easy to instrument any function with the most useful metrics: request rate, error rate, and latency. Autometrics uses instrumented function names to generate Prometheus queries so you don’t need to hand-write complicated PromQL.
9+
## Features
10+
11+
-[`#[autometrics]`](https://docs.rs/autometrics/latest/autometrics/attr.autometrics.html) macro instruments any function or `impl` block to track the [most useful metrics](https://docs.rs/autometrics/latest/autometrics/attr.autometrics.html#generated-metrics)
12+
- 💡 Writes Prometheus queries so you can understand the data generated without knowing PromQL
13+
- 🔗 Injects links to live Prometheus charts directly into each function's doc comments
14+
- [🔍 Identify commits](https://docs.rs/autometrics/latest/autometrics/#build_info-metric-labels) that introduced errors or increased latency
15+
- [🚨 Define alerts](https://docs.rs/autometrics/latest/autometrics/objectives/index.html) using SLO best practices directly in your source code
16+
- [📊 Grafana dashboards](https://github.com/autometrics-dev/autometrics-shared#dashboards) work out of the box to visualize the performance of instrumented functions & SLOs
17+
- [⚙️ Configurable](https://docs.rs/autometrics/latest/autometrics/#metrics-backends) metric collection library ([`opentelemetry`](https://crates.io/crates/opentelemetry), [`prometheus`](https://crates.io/crates/prometheus), [`prometheus-client`](https://crates.io/crates/prometheus-client) or [`metrics`](https://crates.io/crates/metrics))
18+
- [📍 Attach exemplars](https://docs.rs/autometrics/latest/autometrics/exemplars/index.html) to connect metrics with traces
19+
- ⚡ Minimal runtime overhead
1020

11-
To make it easy for you to spot and debug issues in production, Autometrics inserts links to live charts directly into each function’s doc comments and provides dashboards that work out of the box. It also enables you to create powerful alerts based on Service-Level Objectives (SLOs) directly in your source code. Lastly, Autometrics writes queries that correlate your software’s version info with anomalies in the metrics to help you quickly identify commits that introduced bugs or latency.
21+
See [autometrics.dev](https://docs.autometrics.dev/) for more details on the ideas behind autometrics.
22+
23+
# Example + Demo
1224

1325
```rust
1426
use autometrics::autometrics;
@@ -50,20 +62,6 @@ Here is a demo of jumping from function docs to live Prometheus charts:
5062

5163
https://github.com/autometrics-dev/autometrics-rs/assets/3262610/966ed140-1d6c-45f3-a607-64797d5f0233
5264

53-
## Features
54-
55-
-[`#[autometrics]`](https://docs.rs/autometrics/latest/autometrics/attr.autometrics.html) macro instruments any function or `impl` block to track the [most useful metrics](https://docs.rs/autometrics/latest/autometrics/attr.autometrics.html#generated-metrics)
56-
- 💡 Writes Prometheus queries so you can understand the data generated without knowing PromQL
57-
- 🔗 Injects links to live Prometheus charts directly into each function's doc comments
58-
- [🔍 Identify commits](https://docs.rs/autometrics/latest/autometrics/#identifying-commits-that-introduced-problems) that introduced errors or increased latency
59-
- [🚨 Define alerts](https://docs.rs/autometrics/latest/autometrics/objectives/index.html) using SLO best practices directly in your source code
60-
- [📊 Grafana dashboards](https://github.com/autometrics-dev#5-configuring-prometheus) work out of the box to visualize the performance of instrumented functions & SLOs
61-
- [⚙️ Configurable](https://docs.rs/autometrics/latest/autometrics/#metrics-libraries) metric collection library ([`opentelemetry`](https://crates.io/crates/opentelemetry), [`prometheus`](https://crates.io/crates/prometheus), [`prometheus-client`](https://crates.io/crates/prometheus-client) or [`metrics`](https://crates.io/crates/metrics))
62-
- [📍 Attach exemplars](https://docs.rs/autometrics/latest/autometrics/exemplars/index.html) to connect metrics with traces
63-
- ⚡ Minimal runtime overhead
64-
65-
See [Why Autometrics?](https://github.com/autometrics-dev#4-why-autometrics) for more details on the ideas behind autometrics.
66-
6765
## Quickstart
6866

6967
1. Add `autometrics` to your project:

autometrics/README.md

Lines changed: 23 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1+
<!-- This is used on crates.io -->
2+
13
![GitHub_headerImage](https://user-images.githubusercontent.com/3262610/221191767-73b8a8d9-9f8b-440e-8ab6-75cb3c82f2bc.png)
24

35
[![Documentation](https://docs.rs/autometrics/badge.svg)](https://docs.rs/autometrics)
46
[![Crates.io](https://img.shields.io/crates/v/autometrics.svg)](https://crates.io/crates/autometrics)
57
[![Discord Shield](https://discordapp.com/api/guilds/950489382626951178/widget.png?style=shield)](https://discord.gg/kHtwcH8As9)
68

7-
Autometrics is an observability micro-framework built for developers.
9+
Autometrics provides a macro that makes it easy to instrument any function with the most useful metrics: request rate, error rate, and latency. It then uses the instrumented function names to generate Prometheus queries to help you identify and debug issues in production.
810

9-
The Rust library provides a macro that makes it easy to instrument any function with the most useful metrics: request rate, error rate, and latency. Autometrics uses instrumented function names to generate Prometheus queries so you don’t need to hand-write complicated PromQL.
11+
## Features
1012

11-
To make it easy for you to spot and debug issues in production, Autometrics inserts links to live charts directly into each function’s doc comments and provides dashboards that work out of the box. It also enables you to create powerful alerts based on Service-Level Objectives (SLOs) directly in your source code. Lastly, Autometrics writes queries that correlate your software’s version info with anomalies in the metrics to help you quickly identify commits that introduced bugs or latency.
13+
-[`#[autometrics]`](https://docs.rs/autometrics/latest/autometrics/attr.autometrics.html) macro instruments any function or `impl` block to track the [most useful metrics](https://docs.rs/autometrics/latest/autometrics/attr.autometrics.html#generated-metrics)
14+
- 💡 Writes Prometheus queries so you can understand the data generated without knowing PromQL
15+
- 🔗 Injects links to live Prometheus charts directly into each function's doc comments
16+
- [🔍 Identify commits](https://docs.rs/autometrics/latest/autometrics/#build_info-metric-labels) that introduced errors or increased latency
17+
- [🚨 Define alerts](https://docs.rs/autometrics/latest/autometrics/objectives/index.html) using SLO best practices directly in your source code
18+
- [📊 Grafana dashboards](https://github.com/autometrics-dev/autometrics-shared#dashboards) work out of the box to visualize the performance of instrumented functions & SLOs
19+
- [⚙️ Configurable](https://docs.rs/autometrics/latest/autometrics/#metrics-backends) metric collection library ([`opentelemetry`](https://crates.io/crates/opentelemetry), [`prometheus`](https://crates.io/crates/prometheus), [`prometheus-client`](https://crates.io/crates/prometheus-client) or [`metrics`](https://crates.io/crates/metrics))
20+
- [📍 Attach exemplars](https://docs.rs/autometrics/latest/autometrics/exemplars/index.html) to connect metrics with traces
21+
- ⚡ Minimal runtime overhead
22+
23+
See [autometrics.dev](https://docs.autometrics.dev/) for more details on the ideas behind autometrics.
1224

1325
## Example Axum App
1426

@@ -40,91 +52,15 @@ pub async fn main() {
4052
}
4153
```
4254

43-
## Features
44-
45-
-[`#[autometrics]`](https://docs.rs/autometrics/latest/autometrics/attr.autometrics.html) macro instruments any function or `impl` block to track the [most useful metrics](https://docs.rs/autometrics/latest/autometrics/attr.autometrics.html#generated-metrics)
46-
- 💡 Writes Prometheus queries so you can understand the data generated without knowing PromQL
47-
- 🔗 Injects links to live Prometheus charts directly into each function's doc comments
48-
- [🔍 Identify commits](#identifying-commits-that-introduced-problems) that introduced errors or increased latency
49-
- [🚨 Define alerts](https://docs.rs/autometrics/latest/autometrics/objectives/index.html) using SLO best practices directly in your source code
50-
- [📊 Grafana dashboards](https://github.com/autometrics-dev#5-configuring-prometheus) work out of the box to visualize the performance of instrumented functions & SLOs
51-
- [⚙️ Configurable](#metrics-libraries) metric collection library ([`opentelemetry`](https://crates.io/crates/opentelemetry), [`prometheus`](https://crates.io/crates/prometheus), [`prometheus-client`](https://crates.io/crates/prometheus-client) or [`metrics`](https://crates.io/crates/metrics))
52-
- [📍 Attach exemplars](https://docs.rs/autometrics/latest/autometrics/exemplars/index.html) to connect metrics with traces
53-
- ⚡ Minimal runtime overhead
54-
55-
See [Why Autometrics?](https://github.com/autometrics-dev#4-why-autometrics) for more details on the ideas behind autometrics.
56-
57-
## Identifying commits that introduced problems
58-
59-
Autometrics makes it easy to [spot versions and commits that introduce errors or latency](https://fiberplane.com/blog/autometrics-rs-0-4-spot-commits-that-introduce-errors-or-slow-down-your-application).
60-
61-
It produces a `build_info` metric and uses the following labels to expose the version info of your app to Prometheus:
62-
63-
| Label | Compile-Time Environment Variables | Default |
64-
|---|---|---|
65-
| `version` | `AUTOMETRICS_VERSION` or `CARGO_PKG_VERSION` | `CARGO_PKG_VERSION` (set by cargo by default) |
66-
| `commit` | `AUTOMETRICS_COMMIT` or `VERGEN_GIT_COMMIT` | `""` |
67-
| `branch` | `AUTOMETRICS_BRANCH` or `VERGEN_GIT_BRANCH` | `""` |
68-
69-
### (Optional) Using [`vergen`](https://crates.io/crates/vergen) to set the Git details
70-
71-
```toml
72-
# Cargo.toml
73-
74-
[build-dependencies]
75-
vergen = { version = "8.1", features = ["git", "gitcl"] }
76-
```
77-
78-
```rust
79-
// build.rs
80-
fn main() {
81-
vergen::EmitBuilder::builder()
82-
.git_sha(true)
83-
.git_branch()
84-
.emit()
85-
.expect("Unable to generate build info");
86-
}
87-
```
88-
89-
90-
## Configuring Autometrics
91-
92-
### Custom Prometheus URL
93-
94-
Autometrics inserts Prometheus query links into function documentation. By default, the links point to `http://localhost:9090` but you can configure it to use a custom URL using an environment variable in your `build.rs` file:
95-
96-
```rust
97-
// build.rs
98-
99-
fn main() {
100-
// Reload Rust analyzer after changing the Prometheus URL to regenerate the links
101-
let prometheus_url = "https://your-prometheus-url.example";
102-
println!("cargo:rustc-env=PROMETHEUS_URL={prometheus_url}");
103-
}
104-
```
105-
106-
### Feature flags
107-
108-
- `prometheus-exporter` - exports a Prometheus metrics collector and exporter (compatible with any of the [Metrics backends](#metrics-backends))
109-
- `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.
110-
- `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](https://github.com/autometrics-dev/autometrics-rs/tree/main/autometrics-cli)).
111-
112-
#### Metrics backends
113-
114-
**Required:** Configure which library autometrics will use to produce metrics by using one of the following feature flags:
115-
116-
> **Note**
117-
>
118-
> If you are **not** using the `prometheus-exporter`, you must ensure that you are using the exact same version of the metrics library as `autometrics` (and it must come from `crates.io` rather than git or another source). If not, the autometrics metrics will not appear in your exported metrics.
55+
## Quickstart
11956

120-
- `opentelemetry` - use the [opentelemetry](https://crates.io/crates/opentelemetry) crate for producing metrics.
121-
- `metrics` - use the [metrics](https://crates.io/crates/metrics) crate for producing metrics
122-
- `prometheus` - use the [prometheus](https://crates.io/crates/prometheus) crate for producing metrics
123-
- `prometheus-client` - use the official [prometheus-client](https://crates.io/crates/prometheus-client) crate for producing metrics
57+
See the [Github repo README](https://github.com/autometrics-dev/autometrics-rs#quickstart) to quickly add `autometrics` to your project.
12458

125-
#### Exemplars (for integrating metrics with traces)
59+
## Contributing
12660

127-
See the [exemplars module docs](https://docs.rs/autometrics/latest/autometrics/exemplars/index.html) for details about these features. Currently only supported with the `prometheus-client` backend.
61+
Issues, feature suggestions, and pull requests are very welcome!
12862

129-
- `exemplars-tracing` - extract arbitrary fields from `tracing::Span`s
130-
- `exemplars-tracing-opentelemetry` - extract the `trace_id` and `span_id` from the `opentelemetry::Context`, which is attached to `tracing::Span`s by the `tracing-opentelemetry` crate
63+
If you are interested in getting involved:
64+
- Join the conversation on [Discord](https://discord.gg/9eqGEs56UB)
65+
- Ask questions and share ideas in the [Github Discussions](https://github.com/orgs/autometrics-dev/discussions)
66+
- Take a look at the overall [Autometrics Project Roadmap](https://github.com/orgs/autometrics-dev/projects/1)

0 commit comments

Comments
 (0)