Commit e48c8d3
authored
Add proxy_build_info metric (#600)
## Why
Closes linkerd/linkerd2#3424
## What
A new `proxy_build_info` metric is introduced that contains the following
fields:
- `git_branch`: The branch that the proxy was built on
- `git_version`: The version of the proxy. This is the output of `git describe`
and finds the most recent tag that is reachable from the commit.
- `rust_version`: The rust version used to build the proxy
This metric is a gauge that always has a value of `1`. The reasoning is
described [here](https://www.robustperception.io/exposing-the-software-version-to-prometheus).
The fields reflect those of the `prometheus_build_info` discussed in the link
above.
```bash
❯ linkerd metrics -n linkerd pods/linkerd-tap-5f6565cfc5-56q9r
..
# HELP proxy_build_info Proxy build info
# TYPE proxy_build_info gauge
proxy_build_info{git_branch="kleimkuhler/build-info",git_version="release/v2.104.1-11-gea34a589",rust_version="rustc 1.44.1 (c7087fe00 2020-06-17)",} 1
```
## How
The `.git/` directory is now copied into the docker container when building so
that the `build.rs` file being introduced can reference the git history to find
the most recent tag and populate the `GIT_BRANCH` and `GIT_VERSION` environment
variables at compile time.
### Labels
I considered a `git_release` and `git_revision` tag instead of the single
`git_version`.
`git_release` would be the most recent tag reachable from the commit, and
`git_revision` would be the full commit SHA.
I chose the output of `git describe` instead because it includes both the tag
and short SHA as well as how many additional commits have occurred on top of the
tag.
I think this makes it a little easier as a user to see that the proxy build
version is the `kleimkuhler/build-info` branch, which is `1` commit from
`release/v2.104.1` with the SHA starting with `1ee7452f`:
```bash
❯ git describe
release/v2.104.1-1-g1ee7452f
```
Signed-off-by: Kevin Leimkuhler <[email protected]>1 parent f37e3ff commit e48c8d3
File tree
5 files changed
+103
-2
lines changed- linkerd/app
- core
- src/telemetry
- src
5 files changed
+103
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | | - | |
| 103 | + | |
| 104 | + | |
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
| |||
0 commit comments