Skip to content

Commit

Permalink
minor BPC adoptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Trautwein Martin (BD/ISA-PRC3) authored and Trautwein Martin (BD/ISA-PRC3) committed Oct 29, 2024
1 parent 044dc10 commit 954849c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"net/http"
"os"
"os/signal"
"strconv"
"strings"
"syscall"
"time"
Expand Down Expand Up @@ -46,9 +47,9 @@ func loadEnvironmentVariables() {
flag.StringVar(&password, "password", LookupEnvOrString("PASSWORD", ""), "Cloud Foundry password")
flag.StringVar(&clientID, "client-id", LookupEnvOrString("CLIENT_ID", ""), "uaa Client ID")
flag.StringVar(&clientSecret, "client-secret", LookupEnvOrString("CLIENT_SECRET", ""), "uaa Client Secret")
flag.Int64Var(&updateFrequency, "update-frequency", 300, "The time in seconds, that takes between each apps update call")
flag.Int64Var(&scrapeInterval, "scrape-interval", 60, "The time in seconds, that takes between Prometheus scrapes")
flag.IntVar(&prometheusBindPort, "prometheus-bind-port", 60, "The port to bind to for prometheus metrics")
flag.Int64Var(&updateFrequency, "update-frequency", strconv.Atoi(LookupEnvOrString("UPDATE_FREQUENCY", "300")), "The time in seconds, that takes between each apps update call")

Check failure on line 50 in main.go

View workflow job for this annotation

GitHub Actions / build

multiple-value strconv.Atoi(LookupEnvOrString("UPDATE_FREQUENCY", "300")) (value of type (int, error)) in single-value context
flag.Int64Var(&scrapeInterval, "scrape-interval", strconv.Atoi(LookupEnvOrString("SCRAPE_INTERVAL", "60")), "The time in seconds, that takes between Prometheus scrapes")

Check failure on line 51 in main.go

View workflow job for this annotation

GitHub Actions / build

multiple-value strconv.Atoi(LookupEnvOrString("SCRAPE_INTERVAL", "60")) (value of type (int, error)) in single-value context
flag.IntVar(&prometheusBindPort, "prometheus-bind-port", strconv.Atoi(LookupEnvOrString("PROMETHEUS_BIND_PORT", "60000")), "The port to bind to for prometheus metrics")

Check failure on line 52 in main.go

View workflow job for this annotation

GitHub Actions / build

multiple-value strconv.Atoi(LookupEnvOrString("PROMETHEUS_BIND_PORT", "60000")) (value of type (int, error)) in single-value context
flag.StringVar(&authUsername, "auth-username", LookupEnvOrString("AUTH_USERNAME", ""), "HTTP basic auth username; leave blank to disable basic auth")
flag.StringVar(&authPassword, "auth-password", LookupEnvOrString("AUTH_PASSWORD", ""), "HTTP basic auth password")
}
Expand Down Expand Up @@ -175,6 +176,7 @@ func main() {
server := buildHTTPServer(prometheusBindPort, promhttp.Handler(), authUsername, authPassword)

go func() {
server.Addr = "0.0.0.0:8080"
err := server.ListenAndServe()
if err != nil {
errChan <- err
Expand Down
13 changes: 5 additions & 8 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
# See manifest.yml documentation available at:
# https://docs.developer.swisscom.com/devguide/deploy-apps/manifest.html

applications:
- name: prometheus-exporter
Expand All @@ -10,17 +8,16 @@ applications:
health-check-type: port

routes:
- route: prometheus-metrics.scapp.io
- route: prometheus-metrics.applicationcloud.io
- route: prometheus.sys.cfy04.ipz001.internal.bosch.cloud

buildpacks:
- go_buildpack
- go_buildpack_latest

env:
TZ: Europe/Berlin
GOPACKAGENAME: github.com/liquid-matra/paas-prometheus-exporter
API_ENDPOINT: https://api.lyra-836.appcloud.swisscom.com
API_ENDPOINT: https://api.sys.cfy04.ipz001.internal.bosch.cloud
USERNAME: ((cf_username))
PASSWORD: ((cf_password))
AUTH_USERNAME: ((metrics_username))
AUTH_PASSWORD: ((metrics_password))
# AUTH_USERNAME: ((metrics_username))
# AUTH_PASSWORD: ((metrics_password))

0 comments on commit 954849c

Please sign in to comment.