fix: fix for unexpected token error#169
Conversation
Summary of ChangesHello @mayankpande88, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an 'unexpected token error' by significantly improving the robustness of container ID parsing and workload resolution. It introduces conditional logic to correctly handle both Kubernetes and non-Kubernetes container ID formats, ensuring that the appropriate workload owner is identified. Furthermore, it enhances system stability by adding a filter to explicitly ignore certain control plane systemd services during container ID calculation. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses an unexpected token error by introducing more robust handling of different container ID formats, correctly distinguishing between Kubernetes and other container types like Docker or systemd. This prevents potential panics when encountering non-standard container IDs. Additionally, it enhances filtering by ignoring certain systemd services associated with the control plane. My review includes a suggestion to refactor a block of code in containers/container.go to align with idiomatic Go naming conventions and to simplify the logic, improving readability and maintainability. The changes are a positive step towards making the agent more resilient.
…ystemd services - Fix concurrent map read/write crash in updateDelays by using proper locking: - Get PIDs snapshot under read lock - Make syscalls without holding lock to avoid contention - Update delays under write lock - Fix "unexpected container id" errors for systemd services: - Only resolve pod owner for k8s containers (/k8s/ or /k8s-cronjob/ prefixes) - Use container name as workload for non-k8s containers - Skip systemd services that match IGNORE_CONTROL_PLANE list in calcId Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Increase l7_events perf buffer from 64 to 128 pages per CPU to reduce lost samples - Add rate-limited logging for lost samples (aggregate and log every 10s instead of per-event) - Include CPU info in lost samples log for better debugging The duplicate log lines (4x) were caused by per-CPU lost sample records being logged separately. Now they are aggregated and logged periodically. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Initialize klog flags properly to prevent duplicate log output. The issue was that klog was outputting to both the custom writer and stderr by default. Setting logtostderr=false, alsologtostderr=false, and stderrthreshold=FATAL ensures only the custom output is used. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace klog.Errorf with klog.ErrorS for lost samples logging. klog.Errorf logs to ERROR, WARNING, and INFO levels causing 3x duplicates. klog.ErrorS uses structured logging and only logs once at the ERROR level. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace klog.ErrorS with log.Printf for lost samples logging. Both klog.Errorf and klog.ErrorS output to multiple severity levels (ERROR, WARNING, INFO) by design, causing 3x duplicates. The standard log package writes once to the configured output (our RateLimitedLogOutput) without duplication. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add read lock when iterating over activeConnections map in the Collect function to prevent concurrent map iteration and map write errors during Prometheus metric collection. The race condition occurs when: - Prometheus calls Collect() which iterates over activeConnections - Concurrently, connection events modify activeConnections Error: fatal error: concurrent map iteration and map write at containers/container.go:455 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Prevent agent crashes when receiving malformed or incomplete ClickHouse protocol packets by adding defer/recover pattern to ParseClickhouse. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
No description provided.