Repository navigation
Conversation
internal/storage held the Storage interface next to the gocloud and GCS backends, so every package that reads or writes artifacts compiled in the AWS, Azure and Google SDKs. The backends now have their own package, and internal/storage keeps the interface, the errors and the path layout. internal/handler drops from 837 to 389 packages in its dependency graph and no longer imports a cloud SDK. internal/storage builds for wasip1 and joins the wasm build in CI. No behaviour change. Step 5 of git-pkgs#501, for storage.
internal/database imported modernc.org/sqlite and lib/pq only to register them, which kept the package and everything that uses it from building for targets the drivers don't support. internal/database/drivers now registers both, and internal/server and internal/cli import it. No behaviour change. Step 5 of git-pkgs#501, for the database.
internal/gitcache locked with syscall.Flock, which WASI doesn't have. A lockFile for wasip1 returns errors.ErrUnsupported; the git cache can't run there anyway, since it starts git. With the storage backends and the SQL drivers in their own packages, internal/handler and internal/mirror now build for wasip1. CI builds them, so a native import in a handler fails the wasm job. Part of git-pkgs#501.
…ndlers' imports internal/metrics keeps the Record functions the handlers, the git cache and the scanners call, and passes them to a registered Recorder. The Prometheus metrics move to internal/metrics/prom, which registers itself when imported. The files are moved, not rewritten. internal/server and the tests that read a metric import prom. The wasm job also checks that the handlers don't depend on Prometheus, since the build alone doesn't notice it.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The metrics part of step 5 of #501. Stacked on #868: until that is merged, the diff here includes it. Only the last commit is new.
internal/handlerbuilds forwasip1with #868, but it still links Prometheus, because the handlers callmetrics.Record*andinternal/metricsholds the Prometheus vectors.internal/metricskeeps theRecord*functions that the handlers, the git cache and the scanners call,FailureDetailand the cache kind constants. The functions pass each call to a registeredRecorder, and to nothing while none is registered. The package imports only the standard library.internal/metrics/promgets the Prometheus vectors, the/metricshandler, the snapshot for/ui/analytics, the failure details and the gauges the server publishes. The files are moved, not rewritten. Importing the package registers it as theRecorder, the wayinternal/database/driversregisters the SQL drivers.internal/handler,internal/gitcacheorinternal/scannerchanges.internal/serverand the tests that read a metric importprom; that is a rename of the prefix.No behaviour change. I ran the binary of #868 and of this branch against the same npm and rpm requests and compared the request, cache, upstream and storage lines of
/metrics: they are the same.internal/handlerandinternal/mirrordepend onPrometheus builds for
wasip1, so the wasm build doesn't notice it coming back. The wasm job gets a second step that fails whengo list -depsofinternal/handlerorinternal/mirrornames a Prometheus package.Two choices you may want differently:
Recorderis registered globally. The counters are global today, and this way no call site changes. Passing a recorder intohandler.Proxywould be a larger change.prom.prometheuswould clash with the client library's package name.