Skip to content

Expose metrics endpoint #486

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

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f1abcdc
refactor: addition of root ctx to main
dimakis Aug 9, 2023
16ad276
refactor: addition of metrics address
dimakis Aug 9, 2023
3298bbf
refactor: edit of the deployment and service to expose metrics ports
dimakis Aug 9, 2023
4180e7a
refactor: edit of run to start controller and health + metrics concur…
dimakis Aug 9, 2023
e42175c
refactor: making sure that the health and metrics servers only start …
dimakis Aug 9, 2023
f35715d
refactor: update health and metric port defaults from strings to ints
dimakis Aug 11, 2023
a20d09d
refactor: addition of a generic server to use for health, metrics etc
dimakis Aug 11, 2023
3e98689
refactor: use errgroup and new generic-server
dimakis Aug 11, 2023
394f411
refactor: update metrics port in deployment to standard prom port
dimakis Aug 14, 2023
6cd08e7
docs: add license
dimakis Aug 14, 2023
fc7abaa
refactor: update metrics port to use conventional prom port
dimakis Aug 14, 2023
c1518e7
refactor: move metrics funcs to own file
dimakis Aug 14, 2023
7941a94
refactor: add better error and use custom timeout
dimakis Aug 22, 2023
935698a
refactor: remove not needed comments and context
dimakis Aug 22, 2023
4b6e864
refactor: start shutdown in their own goroutines and start metrics se…
dimakis Aug 22, 2023
19a5662
docs: remove duplicate copyright notice
dimakis Aug 22, 2023
0d92fca
refactor: addition of wait groups to ensure order of shutdown and oth…
dimakis Aug 23, 2023
2b5987c
refactor: simplify the concurrency logic
dimakis Aug 23, 2023
6a0e175
refactor: update after rebase
dimakis Sep 15, 2023
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
Prev Previous commit
Next Next commit
refactor: addition of wait groups to ensure order of shutdown and oth…
…er minor edits from reviews
  • Loading branch information
dimakis committed Sep 15, 2023
commit 0d92fca321b30feca0cef2826060e5b106adbf9e
2 changes: 1 addition & 1 deletion cmd/kar-controllers/app/generic-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (s *Server) Shutdown() error {
if err := s.httpServer.Shutdown(shutdownCtx); err != nil {
return fmt.Errorf("failed to shutdown server gracefully: %v", err)
}
return s.httpServer.Shutdown(shutdownCtx)
return nil
}

// newListener creates a new TCP listener bound to the given address.
Expand Down
21 changes: 18 additions & 3 deletions cmd/kar-controllers/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -21,6 +21,7 @@ import (
"context"
"fmt"
"net/http"
"sync"

"golang.org/x/sync/errgroup"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -79,8 +80,22 @@ func Run(ctx context.Context, opt *options.ServerOption) error {
return err
}

// Start the job controller
go jobctrl.Run(ctx.Done())
// Create the job controller
jobctrl := queuejob.NewJobController(config, opt)
if jobctrl == nil {
return fmt.Errorf("failed to create a job controller")
}

// Run the job controller in a goroutine and wait for it to exit
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
defer wg.Done()
jobctrl.Run(ctx.Done())
}()

wg.Wait()


return nil
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/kar-controllers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,4 @@ func main() {
os.Exit(1)
}

fmt.Println("Shutting down gracefully")

}