Skip to content

Commit

Permalink
more doc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed Aug 9, 2024
1 parent b2ce952 commit 34eaecc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion core/metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Pass in the `PYROSCOPE_ENDPOINT` environment variable

## Rookout

Pass in `ROOKOUT_TOKEN`. Note: this will not work if ldflags -s and -w are used, as these diable the symbol table. Additionally the gcflag `all=-dwarflocationlists=true` must be enabled.
Pass in `ROOKOUT_TOKEN`. Note: this will not work if ldflags -s and -w are used, as these diable the symbol table. Additionally the gcflag `all=-dwarflocationlists=true` must be enabled. You can override the git repo by setting an ldflag on `github.com/synapsecns/sanguine/core/metrics.DefaultGitRepo` to your repo or setting the enviornment variable `GIT_REPO`.
Additionally, all [rookout enviornment](https://docs.rookout.com/docs/setup-guide/#configuration) variables are supported.

## Metrics Endpoint

Expand Down
6 changes: 6 additions & 0 deletions core/metrics/internal/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ const (
PyroscopeJaegerUIEnabled = "PYROSCOPE_JAEGER_UI_ENABLED"
// RookoutToken is used for https://app.rookout.com/
RookoutToken = "ROOKOUT_TOKEN"
// RookoutCommit is the environment variable for the git commit in use.
RookoutCommit = "ROOKOUT_COMMIT"
// RookoutDebug can be used to enable rookout debug.
RookoutDebug = "ROOKOUT_DEBUG"
// RookoutRemoteOrigin is the environment variable for the git remote origin in use.
RookoutRemoteOrigin = "ROOKOUT_REMOTE_ORIGIN"
// GitRepo is the environment variable for the git repo in use.
GitRepo = "GIT_REPO"
)
13 changes: 9 additions & 4 deletions core/metrics/rookout.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ import (
"os"
)

// DefaultGitRepo is the default git repo for sanguine.
// exposed here to allow it to be overridden by an ldflag rather than an env var.
const DefaultGitRepo = "https://github.com/synapsecns/sanguine"

// rookout is sideloaded.
// TODO: consider moving this to metrics.
func init() {
if core.HasEnv(internal.RookoutToken) {
// TODO: Consider doing git stuff here.
// some env vars are supported here to allow config docs to be valid: https://docs.rookout.com/docs/setup-guide/#configuration.
// we do not document these as they are not intended to be used.
err := rookout.Start(config.RookOptions{
Token: os.Getenv(internal.RookoutToken),
Debug: core.HasEnv(internal.RookoutDebug),
GitCommit: synconfig.DefaultCommit,
// note: will chagne on fork
GitOrigin: "https://github.com/synapsecns/sanguine",
GitCommit: core.GetEnv(internal.RookoutCommit, synconfig.DefaultCommit),
// note: we do not document
GitOrigin: core.GetEnv(internal.RookoutRemoteOrigin, core.GetEnv(internal.GitRepo, DefaultGitRepo)),
})
if err != nil {
logger.Warn(err)
Expand Down

0 comments on commit 34eaecc

Please sign in to comment.