Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TomerTcherniak
Copy link

Metrics

Supporting prometheus counters :

proxy_request_counter
proxy_response_counter
aws_auth_error_counter
aws_url_error_counter
aws_config_error_counter

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

        - name: CODEARTIFACT_DOMAIN
          value: ""
        - name: CODEARTIFACT_REPO
          value: ""
        - name: CODEARTIFACT_OWNER
          value: ""
        - name: CODEARTIFACT_TYPE
          value: ""
        - name: AWS_REGION
          value: ""

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, "/"))
Copy link
Owner

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.

Copy link
Author

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

@sktan
Copy link
Owner

sktan commented Jul 18, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants