Skip to content

container update changes were being reported as type unspecified#212

Merged
kevin-devzero merged 1 commit into
mainfrom
kevin/unspecifiedtypebug
Dec 12, 2025
Merged

container update changes were being reported as type unspecified#212
kevin-devzero merged 1 commit into
mainfrom
kevin/unspecifiedtypebug

Conversation

@kevin-devzero
Copy link
Copy Markdown
Contributor

@kevin-devzero kevin-devzero commented Dec 12, 2025

Summary by CodeRabbit

  • New Features
    • Added support for Container as a new resource type, enabling users to track and manage container resources within the system.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 12, 2025

Walkthrough

Extended the ResourceType enum in the interface to support a new Container type, adding mappings for both string representation ("container") and protobuf type conversion (gen.ResourceType_RESOURCE_TYPE_CONTAINER).

Changes

Cohort / File(s) Summary
ResourceType enum extension
internal/collector/interface.go
Added Container case to ResourceType.String() returning "container"; added Container case to ResourceType.ProtoType() returning gen.ResourceType_RESOURCE_TYPE_CONTAINER

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Straightforward enum value addition with standard pattern matching in two methods
  • No complex logic or control flow changes
  • Single file modification with minimal scope

Poem

🐰 A container now finds its home,
In mappings where resources roam.
From string to proto, types align,
Another enum case—chef's kiss, so fine! 📦

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: fixing a bug where container update changes were being reported as 'unspecified' type instead of 'container'.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kevin/unspecifiedtypebug

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3451ee4 and 8ab5a42.

📒 Files selected for processing (1)
  • internal/collector/interface.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
internal/collector/interface.go (2)
gen/api/v1/k8s.pb.go (3)
  • Container (4129-4137)
  • Container (4152-4152)
  • Container (4167-4169)
gen/api/v1/metrics_collector.pb.go (1)
  • ResourceType_RESOURCE_TYPE_CONTAINER (146-146)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build Docker Image
  • GitHub Check: Build Docker Image
  • GitHub Check: Run make test
  • GitHub Check: Analyze (go)
🔇 Additional comments (3)
internal/collector/interface.go (3)

181-181: LGTM! Container string mapping correctly added.

This change fixes the issue where Container resources were being reported as "unknown". The mapping is consistent with the naming convention used for other resource types.


272-273: LGTM! Critical fix for the "unspecified type" bug.

This change directly addresses the issue in the PR title. Before this fix, Container resources would fall through to the default case and be reported as RESOURCE_TYPE_UNSPECIFIED. The mapping to gen.ResourceType_RESOURCE_TYPE_CONTAINER is correct and consistent with the protobuf definitions.


124-127: Confirmed: CustomResource, ConfigMap, and Secret enum values are not used in the codebase.

The search reveals no references to ResourceType.CustomResource, ResourceType.ConfigMap, or ResourceType.Secret anywhere in the codebase. All matches found are for Kubernetes core types (corev1.ConfigMap, corev1.Secret, corev1.Container), not the ResourceType enum values. These three enum constants are indeed kept purely for enum numbering purposes and can be safely left as-is to avoid disrupting the enum ordering.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kevin-devzero kevin-devzero enabled auto-merge (squash) December 12, 2025 23:37
@kevin-devzero kevin-devzero merged commit 27725d8 into main Dec 12, 2025
25 checks passed
@kevin-devzero kevin-devzero deleted the kevin/unspecifiedtypebug branch December 12, 2025 23:52
This was referenced Jan 27, 2026
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