Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add config to cli args #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vscode
sentry2prometheus
8 changes: 8 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sources:
- sentry-url: https://sentry.io
token: XXX
extraLabels:
- "game:wows"
organization: XXX
query: "team:BISMARCK"
stats-period: "24h"
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,22 @@ func getLabelsRepr(labels map[string]string) string {

func main() {
var (
// Server
listenAddress = flag.String("port", ":9412", "The address to listen on for HTTP requests.")

// Sentry cli config
sentryURL = flag.String("sentry-url", "https://sentry.io", "The sentry url")
organization = flag.String("organization", "XXX", "Organization name in sentry")
statsPeriod = flag.String("stats-period", "24h", "Sentry stats period")
query = flag.String("query", "", "Sentry query for projects filtering")
listenAddress = flag.String("port", ":9412", "The address to listen on for HTTP requests.")
authorizationToken = flag.String("token", "", "Sentry API authorization token")
extraLabelsRaw = flag.StringSlice("extra-labels", []string{}, "Extra labels for prometheus metrics splitted by ':'")

// Sentry config file
configPath = flag.String("config", "config.yml", "YML config path")
)
flag.Parse()
log.Infoln(*configPath)

extraLabels := map[string]string{}
for _, rawLabel := range *extraLabelsRaw {
Expand Down