-
Notifications
You must be signed in to change notification settings - Fork 8
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
prometheus metrics, dynamic url creation #16
base: master
Are you sure you want to change the base?
Conversation
Bumps [black](https://github.com/psf/black) from 22.3.0 to 24.3.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](psf/black@22.3.0...24.3.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@@ -32,6 +52,10 @@ func ProxyRequestHandler(p *httputil.ReverseProxy) func(http.ResponseWriter, *ht | |||
} else { | |||
originalUrlResolver[r.RemoteAddr].Scheme = "http" | |||
} | |||
// Set URL with an updated path based on the request | |||
log.Printf("baseURL %s", CodeArtifactAuthInfo.Url) | |||
CodeArtifactAuthInfo.Url = fmt.Sprintf("%s/%s", extractBaseURL(CodeArtifactAuthInfo.Url), strings.TrimPrefix(r.URL.Path, "/")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't had some time to look at or test this code yet, but are you able to explain what problem is being solved with these changes?
I am likely missing something, but it looks like we're over-writing the ProxyRequestHandler hooks everytime a request comes through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Steven Tan,
Current project status supports only the "Repository Type" value.
The change i made is using "Repository Type" only for the health check.
I am rewriting ProxyRequestHandler to support multiple types during runtime.
For example if a specific team would like pip and not maven, currently it is hard coded maven by the "Repository Type" ENV param.
For example -
Currently status: proxy support only maven curl http://localhost:8080/maven/maven-central-store/group-id/artifact-id/version/artifact-id-version.jar.sha1
Change status:
The change allow to redirect request with artifact type
curl http://localhost:8080/maven/maven-central-store/group-id/artifact-id/version/artifact-id-version.jar.sha1
curl http://localhost:8080/pip/maven-central-store/group-id/artifact-id/version/artifact-id-version.jar.sha1
Allowing both pip and maven
Thanks
Tomer
hey @TomerTcherniak, thanks for your contribution! I've left a comment for you to respond to so that I can fully understand what results these changes are trying to achieve. |
Metrics
Supporting prometheus counters :
Prometheus endpoint is 8080 on /metrics
Multiple path support
It is dynamic url creation based on the request , supporting multiple paths.
CodeArtifactAuthInfo.Url = fmt.Sprintf("%s/%s", extractBaseURL(CodeArtifactAuthInfo.Url), strings.TrimPrefix(r.URL.Path, "/"))
Kubernetes deployments
svc.yaml and deployment.yaml which are found in deploy/kubernetes can be used to deploy.
The below env var should be set