Add language detection to auto-monitor to inject only the relevant SDK#380
Open
Miqueasher wants to merge 1 commit into
Open
Add language detection to auto-monitor to inject only the relevant SDK#380Miqueasher wants to merge 1 commit into
Miqueasher wants to merge 1 commit into
Conversation
mxiamxia
reviewed
May 12, 2026
mxiamxia
reviewed
May 12, 2026
mxiamxia
reviewed
May 12, 2026
mxiamxia
reviewed
May 12, 2026
mxiamxia
reviewed
May 12, 2026
Comment on lines
+196
to
+199
| desc, err := remote.Get(ref, | ||
| remote.WithAuthFromKeychain(d.keychain), | ||
| remote.WithContext(ctx), | ||
| ) |
Contributor
There was a problem hiding this comment.
I think we need to cache this for the same kind of pod. otherwise for large cluster with thousands of pod, it will either be throttled or make some performance impact.
Author
There was a problem hiding this comment.
Agreed — we'll add an image-level cache so that the same image reference is only looked up once from the registry. If 200 workloads use the same image, the registry call fires once and subsequent lookups return the cached result.
mxiamxia
reviewed
May 12, 2026
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.
Summary
When
monitorAllServices: true, auto-monitor currently injects all 4 language SDK init containers (Java, Python, Node.js, .NET) into every pod regardless of runtime, causing liveness/readiness probe failures, restart loops, and deployment instability.This PR adds a registry-based language detector that inspects container image config (ENV, CMD, ENTRYPOINT) via google/go-containerregistry without pulling layers (~100-500ms, 5s timeout)
Falls back gracefully through image name patterns → pod-spec env vars → pod-spec commands → all languages (current behavior), ensuring zero regression
Detection Layers
Dependencies added
Package | Version | Purpose
github.com/google/go-containerregistry | v0.20.0 | Fetch image config from registry without pulling layers
github.com/aws/aws-sdk-go (existing) | v1.45.25 | ECR auth via custom keychain
Test Plan
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.