-
Notifications
You must be signed in to change notification settings - Fork 32
/
rookout.go
36 lines (31 loc) · 1.21 KB
/
rookout.go
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
//go:build go1.16 && !go1.23
package metrics
import (
"os"
rookout "github.com/Rookout/GoSDK"
"github.com/Rookout/GoSDK/pkg/config"
"github.com/synapsecns/sanguine/core"
synconfig "github.com/synapsecns/sanguine/core/config"
"github.com/synapsecns/sanguine/core/metrics/internal"
)
// 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 and doing after boot.
func init() {
if core.HasEnv(internal.RookoutToken) {
// 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: 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)
}
}
}