Skip to content

feat: Add Jaegar ocp resource#2518

Merged
myakove merged 2 commits into
RedHatQE:mainfrom
kpunwatk:opentelemetry_resource
Sep 4, 2025
Merged

feat: Add Jaegar ocp resource#2518
myakove merged 2 commits into
RedHatQE:mainfrom
kpunwatk:opentelemetry_resource

Conversation

@kpunwatk

@kpunwatk kpunwatk commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

Adds jaegar resource to the wrapper

Short description:
More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
Bug:

Summary by CodeRabbit

  • New Features
    • Added support for managing Jaeger tracing instances via the Jaeger Operator CRD (jaegertracing.io).
    • Allows creating and customizing Jaeger resources with optional strategy, ingress, and collector settings.
    • Supports namespace-scoped Jaeger deployments for easier setup, customization, and lifecycle management.

@coderabbitai

coderabbitai Bot commented Sep 3, 2025

Copy link
Copy Markdown

Walkthrough

Adds a new Jaeger NamespacedResource class for the Jaeger operator CRD with optional strategy, ingress, and collector attributes and a custom to_dict that populates spec when kind_dict/yaml_file are not set. Also adds the JAEGERTRACING_IO API group constant.

Changes

Cohort / File(s) Summary of edits
Jaeger resource implementation
ocp_resources/jaeger.py
Added Jaeger class extending NamespacedResource; set api_group to NamespacedResource.ApiGroup.JAEGERTRACING_IO; implemented __init__ accepting optional strategy, ingress, and collector; implemented to_dict() to initialize and populate spec when neither kind_dict nor yaml_file are provided.
API group constant addition
ocp_resources/resource.py
Added ApiGroup constant JAEGERTRACING_IO = "jaegertracing.io" (string constant added alongside existing API group constants).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 36ceae8 and bac25bf.

📒 Files selected for processing (2)
  • ocp_resources/jaeger.py (1 hunks)
  • ocp_resources/resource.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • ocp_resources/resource.py
  • ocp_resources/jaeger.py
⏰ 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). (6)
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: conventional-title
  • GitHub Check: python-module-install
  • GitHub Check: tox
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
ocp_resources/resource.py (1)

504-505: Add explicit type annotation for consistency

Most ApiGroup constants declare : str. Consider aligning JAEGERTRACING_IO for consistency and static typing.

-        JAEGERTRACING_IO = "jaegertracing.io"
+        JAEGERTRACING_IO: str = "jaegertracing.io"
ocp_resources/jaeger.py (2)

15-33: Validate strategy input (early fail on invalid values)

Constrain strategy to accepted values to catch typos at construction time.

-from typing import Any
+from typing import Any
@@
     def __init__(
@@
-        super().__init__(**kwargs)
+        super().__init__(**kwargs)
+
+        allowed_strategies = {"allInOne", "production"}
+        if strategy is not None and strategy not in allowed_strategies:
+            raise ValueError(f"Invalid strategy '{strategy}'. Allowed: {sorted(allowed_strategies)}")

Optionally, tighten the type hint:

-from typing import Any
+from typing import Any, Literal
@@
-        strategy: str | None = None,
+        strategy: Literal["allInOne", "production"] | None = None,

34-50: Don’t wipe existing spec on repeated to_dict() calls

Resetting self.res["spec"] = {} can drop prior fields if to_dict() is called more than once. Prefer merging and only overriding when arguments are provided.

-        if not self.kind_dict and not self.yaml_file:
-            self.res["spec"] = {}
-            _spec = self.res["spec"]
-
-            # If no strategy is set, default to "allInOne"
-            _spec["strategy"] = self.strategy or "allInOne"
-
-            if self.ingress is not None:
-                _spec["ingress"] = self.ingress
-
-            if self.collector is not None:
-                _spec["collector"] = self.collector
+        if not self.kind_dict and not self.yaml_file:
+            _spec = self.res.setdefault("spec", {})
+
+            if self.strategy is not None:
+                _spec["strategy"] = self.strategy
+            else:
+                _spec.setdefault("strategy", "allInOne")
+
+            if self.ingress is not None:
+                _spec["ingress"] = self.ingress
+
+            if self.collector is not None:
+                _spec["collector"] = self.collector
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 570b070 and 36ceae8.

📒 Files selected for processing (2)
  • ocp_resources/jaeger.py (1 hunks)
  • ocp_resources/resource.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ocp_resources/jaeger.py (1)
ocp_resources/resource.py (4)
  • NamespacedResource (1532-1642)
  • ApiGroup (466-574)
  • to_dict (735-739)
  • to_dict (1640-1642)
🔇 Additional comments (1)
ocp_resources/jaeger.py (1)

13-13: LGTM: correct API group reference

Using NamespacedResource.ApiGroup.JAEGERTRACING_IO matches the Jaeger operator CRD group.

@kpunwatk

kpunwatk commented Sep 3, 2025

Copy link
Copy Markdown
Contributor Author

Hi @adolfo-ab @myakove @rnetser please review this PR, Thanks!

@myakove myakove changed the title Add Jaegar ocp resource feat: Add Jaegar ocp resource Sep 3, 2025
@myakove

myakove commented Sep 3, 2025

Copy link
Copy Markdown
Collaborator

/retest all

Comment thread ocp_resources/jaeger.py Outdated
	new file:   ocp_resources/jaeger.py
	modified:   ocp_resources/resource.py

	new file:   ocp_resources/jaeger.py
	modified:   ocp_resources/resource.py
@myakove

myakove commented Sep 4, 2025

Copy link
Copy Markdown
Collaborator

/approve
/lgtm

@kpunwatk

kpunwatk commented Sep 4, 2025

Copy link
Copy Markdown
Contributor Author

/verified

@myakove myakove merged commit 694c9da into RedHatQE:main Sep 4, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants