Repository navigation
feat(containers): export a service's declared git repo and branch on container_info - #403
Closed
PrashantBtkl wants to merge 1 commit into
Closed
PrashantBtkl wants to merge 1 commit into
PrashantBtkl wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to track a service's source repository and branch via container labels or systemd environment variables, exposing this information through the container_info Prometheus metric. The reviewer correctly identified a potential issue with URL cleaning where trailing query indicators might persist, and pointed out that the documentation incorrectly claims existing metric series remain unchanged, when in fact adding new labels to a Prometheus metric descriptor will alter existing series. Both comments provide actionable feedback and should be addressed.
…container_info A container label or a systemd Environment= entry names the repository a service runs; container_info gains git_repo and git_branch labels so the platform can link a VM service to its code. Credentials embedded in the URL are stripped before export. Part of nudgebee/nudgebee-enterprise#40585 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PrashantBtkl
force-pushed
the
feat/service-git-labels
branch
from
October 16, 2026 09:32
cfb4539 to
75cc1b3
Compare
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.
What this PR does
A service can declare the repository and branch it runs, and
container_infoexports them asgit_repoandgit_branch. That lets the platform link a VM service (systemd unit or container) to its code without anyone typing it in. Only services that declare a repo gain the labels.Decision: reuse the Kubernetes annotation keys as container labels (
workloads.nudgebee.com/git.repo,.../git.branch) and read systemd'sEnvironment=property for units, rather than parsing unit files. Onlyhttp(s)URLs are exported, with embedded credentials, query and fragment stripped, so a token in a URL can't become a metric label.Look at:
containers/git_source.go(the URL cleaning is the part with risk). The rest is wiring.Linked issue / context
Lets the Nudgebee platform link a VM service to its code. The platform side reads these labels in a follow-up.
How was this tested?
containerspackage passes (built in the repo's bullseye toolchain,-Wl,-z,lazy).Environment=NUDGEBEE_GIT_REPO=https://github.com/org/apito a unit drop-in, restart it, thencurl -s localhost:80/metrics | grep 'container_info.*git_repo'; or run a container with--label workloads.nudgebee.com/git.repo=https://github.com/org/api.eBPF changes?
No.
Checklist
make lintpasses (gofmt, go vet)make testpasses for./containers## [Unreleased]Engineering detail
docs/service-git-source.md.EnvironmentFile=; the running commit (a label holds a static repo/branch, not what is deployed).