cmd: fix outpost metrics not being set in embedded mode
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
65c75f085a
commit
f771383c4b
1
.github/workflows/ci-main.yml
vendored
1
.github/workflows/ci-main.yml
vendored
|
@ -133,6 +133,7 @@ jobs:
|
||||||
python-version: '3.9'
|
python-version: '3.9'
|
||||||
- name: checkout stable
|
- name: checkout stable
|
||||||
run: |
|
run: |
|
||||||
|
git fetch
|
||||||
# Copy current, latest config to local
|
# Copy current, latest config to local
|
||||||
cp authentik/lib/default.yml local.env.yml
|
cp authentik/lib/default.yml local.env.yml
|
||||||
git checkout $(git describe --abbrev=0 --match 'version/*')
|
git checkout $(git describe --abbrev=0 --match 'version/*')
|
||||||
|
|
|
@ -106,6 +106,7 @@ func attemptProxyStart(ws *web.WebServer, u *url.URL) {
|
||||||
log.WithField("logger", "authentik").Debug("attempting to start outpost")
|
log.WithField("logger", "authentik").Debug("attempting to start outpost")
|
||||||
err := ac.StartBackgorundTasks()
|
err := ac.StartBackgorundTasks()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.WithField("logger", "authentik").WithError(err).Warning("outpost failed to start")
|
||||||
attempt += 1
|
attempt += 1
|
||||||
time.Sleep(15 * time.Second)
|
time.Sleep(15 * time.Second)
|
||||||
if attempt > maxTries {
|
if attempt > maxTries {
|
||||||
|
|
|
@ -94,13 +94,6 @@ func NewAPIController(akURL url.URL, token string) *APIController {
|
||||||
|
|
||||||
// Start Starts all handlers, non-blocking
|
// Start Starts all handlers, non-blocking
|
||||||
func (a *APIController) Start() error {
|
func (a *APIController) Start() error {
|
||||||
OutpostInfo.With(prometheus.Labels{
|
|
||||||
"outpost_name": a.Outpost.Name,
|
|
||||||
"outpost_type": a.Server.Type(),
|
|
||||||
"uuid": a.instanceUUID.String(),
|
|
||||||
"version": constants.VERSION,
|
|
||||||
"build": constants.BUILD(),
|
|
||||||
}).Set(1)
|
|
||||||
err := a.StartBackgorundTasks()
|
err := a.StartBackgorundTasks()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -131,6 +124,13 @@ func (a *APIController) OnRefresh() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *APIController) StartBackgorundTasks() error {
|
func (a *APIController) StartBackgorundTasks() error {
|
||||||
|
OutpostInfo.With(prometheus.Labels{
|
||||||
|
"outpost_name": a.Outpost.Name,
|
||||||
|
"outpost_type": a.Server.Type(),
|
||||||
|
"uuid": a.instanceUUID.String(),
|
||||||
|
"version": constants.VERSION,
|
||||||
|
"build": constants.BUILD(),
|
||||||
|
}).Set(1)
|
||||||
err := a.OnRefresh()
|
err := a.OnRefresh()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to run initial refresh")
|
return errors.Wrap(err, "failed to run initial refresh")
|
||||||
|
|
|
@ -22,7 +22,7 @@ var (
|
||||||
func RunMetricsServer() {
|
func RunMetricsServer() {
|
||||||
m := mux.NewRouter()
|
m := mux.NewRouter()
|
||||||
m.Path("/metrics").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
m.Path("/metrics").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||||
defer promhttp.InstrumentMetricHandler(
|
promhttp.InstrumentMetricHandler(
|
||||||
prometheus.DefaultRegisterer, promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{
|
prometheus.DefaultRegisterer, promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{
|
||||||
DisableCompression: true,
|
DisableCompression: true,
|
||||||
}),
|
}),
|
||||||
|
|
Reference in a new issue