-
Notifications
You must be signed in to change notification settings - Fork 1
Add support for gathering, publishing and fetching metrics #12
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
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "github.com/stackrox/image-prefetcher/internal/logging" | ||
| "github.com/stackrox/image-prefetcher/internal/metrics/server" | ||
|
|
||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| // aggregateMetricsCmd represents the aggregate-metrics command | ||
| var aggregateMetricsCmd = &cobra.Command{ | ||
| Use: "aggregate-metrics", | ||
| Short: "Accept metrics submissions and serve them.", | ||
| Long: `This subcommand is intended to run in a single pod. | ||
|
|
||
| It serves: | ||
| - a gRPC endpoint to which individual metrics can be submitted, | ||
| - an HTTP endpoint from which the aggregate metrics can be fetched.`, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| return server.Run(logging.GetLogger(), grpcPort, httpPort) | ||
| }, | ||
| } | ||
|
|
||
| var ( | ||
| grpcPort int | ||
| httpPort int | ||
| ) | ||
|
|
||
| func init() { | ||
| rootCmd.AddCommand(aggregateMetricsCmd) | ||
| logging.AddFlags(aggregateMetricsCmd.Flags()) | ||
| aggregateMetricsCmd.Flags().IntVar(&grpcPort, "grpc-port", 8443, "Port for metrics submission gRPC endpoint to listen on.") | ||
| aggregateMetricsCmd.Flags().IntVar(&httpPort, "http-port", 8080, "Port for metrics retrieval HTTP endpoint to listen on.") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,33 @@ | ||
| module github.com/stackrox/image-prefetcher | ||
|
|
||
| go 1.21 | ||
| go 1.22.0 | ||
|
|
||
| toolchain go1.21.7 | ||
| toolchain go1.22.1 | ||
|
|
||
| require ( | ||
| github.com/cenkalti/backoff/v4 v4.2.1 | ||
| github.com/google/uuid v1.6.0 | ||
| github.com/neilotoole/slogt v1.1.0 | ||
| github.com/spf13/cobra v1.8.0 | ||
| github.com/spf13/pflag v1.0.5 | ||
| github.com/stretchr/testify v1.8.4 | ||
| google.golang.org/grpc v1.63.2 | ||
| k8s.io/apimachinery v0.29.3 | ||
| google.golang.org/protobuf v1.33.0 | ||
| k8s.io/apimachinery v0.30.0 | ||
| k8s.io/cri-api v0.29.3 | ||
| k8s.io/klog/v2 v2.110.1 | ||
| k8s.io/klog/v2 v2.120.1 | ||
| ) | ||
|
|
||
| require ( | ||
| github.com/go-logr/logr v1.3.0 // indirect | ||
| github.com/davecgh/go-spew v1.1.1 // indirect | ||
| github.com/go-logr/logr v1.4.1 // indirect | ||
| github.com/gogo/protobuf v1.3.2 // indirect | ||
| github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
| github.com/spf13/pflag v1.0.5 // indirect | ||
| golang.org/x/net v0.21.0 // indirect | ||
| golang.org/x/sys v0.17.0 // indirect | ||
| github.com/kr/text v0.2.0 // indirect | ||
| github.com/pmezard/go-difflib v1.0.0 // indirect | ||
| golang.org/x/net v0.23.0 // indirect | ||
| golang.org/x/sys v0.18.0 // indirect | ||
| golang.org/x/text v0.14.0 // indirect | ||
| google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect | ||
| google.golang.org/protobuf v1.33.0 // indirect | ||
| gopkg.in/yaml.v3 v3.0.1 // indirect | ||
| ) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.