-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build information to the metrics/queries (#34)
* Add build information to the metrics/queries This allows use cases where we can see and query the changes in metrics after a version change in the code base. Ref: autometrics-dev/autometrics-rs#69 Ref: https://github.com/orgs/autometrics-dev/discussions/10 * Add --help and --version flags to the binary Closes: #36 * !Breaking: Use go-arg to parse generator arguments Breaking change: the long flags in autometrics now take the long form arguments starting with -- Also removes the unused `am-alertsgen` binary. Even though for the time being we are using sloth to generate the alerts, at some point we might want to change, and adding extra code/friction to do the change seems unwarranted for now.
- Loading branch information
Showing
45 changed files
with
659 additions
and
3,492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "autometrics-shared"] | ||
path = configs/shared | ||
url = https://github.com/autometrics-dev/autometrics-shared.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,36 @@ | ||
// Autometrics runs as Go generator and updates a source file to add usage queries and metric collection to annotated functions. | ||
// | ||
// As a Go generator, it relies on the environment variables `GOFILE` and | ||
// `GOPACKAGE` to find the target file to edit. | ||
// Autometrics instruments annotated functions, and adds links in their doc comments to graphs of their live usage. | ||
// | ||
// By default, `autometrics` generates metric collection code for usage with the | ||
// [Prometheus client library]. If you want to use [OpenTelemetry metrics] | ||
// instead (with a prometheus exporter for the metrics), pass the `-otel` flag | ||
// instead (with a prometheus exporter for the metrics), pass the `--otel` flag | ||
// to the invocation. | ||
// | ||
// By default, when activating Service Level Objectives (SLOs) `autometrics` | ||
// does not allow to use latency targets that are outside the default latencies | ||
// defined in [autometrics.DefBuckets]. If you want to use custom latencies for | ||
// your latency SLOs, pass the `-custom-latency` flag to the invocation. | ||
// your latency SLOs, pass the `--custom-latency` flag to the invocation. | ||
// | ||
// It is meant to be used in a Go generator context. As such, it takes mandatory arguments in the form of environment variables. | ||
// You can also control the base URL of the prometheus instance in doc comments with an environment variable. | ||
// Note: If you do not use the custom latencies in the SLO, the allowed latencies (in seconds) are in [autometrics.DefBuckets]. | ||
// | ||
// Check https://github.com/autometrics-dev/autometrics-go for more help (including examples) and information. | ||
// Autometrics is built by Fiberplane -- https://autometrics.dev | ||
// | ||
// Usage: autometrics -f FILE_NAME -m MODULE_NAME [--prom_url PROMETHEUS_URL] [--otel] [--custom-latency] | ||
// | ||
// By default, the generated links in the documentation point to a Prometheus | ||
// instance at http://localhost:9090. You can use the environment variable | ||
// `AM_PROMETHEUS_URL` to change the base URL in the documentation links. | ||
// Options: | ||
// -f FILE_NAME File to transform. [env: GOFILE] | ||
// -m MODULE_NAME Module containing the file to transform. [env: GOPACKAGE] | ||
// --prom_url PROMETHEUS_URL | ||
// Base URL of the Prometheus instance to generate links to. [default: http://localhost:9090, env: AM_PROMETHEUS_URL] | ||
// --otel Use [OpenTelemetry client library] to instrument code instead of default [Prometheus client library]. [default: false] | ||
// --custom-latency Allow non-default latencies to be used in latency-based SLOs. [default: false] | ||
// --help, -h display this help and exit | ||
// --version display version and exit | ||
// | ||
// [Prometheus client library]: https://github.com/prometheus/client_golang | ||
// [OpenTelemetry client library]: https://github.com/open-telemetry/opentelemetry-go | ||
// [OpenTelemetry metrics]: https://opentelemetry.io/docs/instrumentation/go/ | ||
// [autometrics.DefBuckets]: https://godoc.org/github.com/autometrics-dev/autometrics-go/pkg/autometrics#DefBuckets | ||
package main |
Oops, something went wrong.