Skip to content

copy metrics to container#71

Merged
maorfr merged 1 commit intoopenshift-assisted:masterfrom
maorfr:copy-metrics
Aug 18, 2025
Merged

copy metrics to container#71
maorfr merged 1 commit intoopenshift-assisted:masterfrom
maorfr:copy-metrics

Conversation

@maorfr
Copy link
Copy Markdown
Member

@maorfr maorfr commented Aug 18, 2025

this PR copies the metrics directory to the container for it to be found.

this fixes an error introduced in #67:

Traceback (most recent call last):
  File "/opt/app-root/src/server.py", line 19, in <module>
    from service_client import InventoryClient
  File "/opt/app-root/src/service_client/__init__.py", line 8, in <module>
    from .assisted_service_api import InventoryClient
  File "/opt/app-root/src/service_client/assisted_service_api.py", line 20, in <module>
    from metrics.metrics import API_CALL_LATENCY
ModuleNotFoundError: No module named 'metrics'

Summary by CodeRabbit

  • Chores
    • Container image now includes the metrics directory, ensuring metrics files are present at runtime.
    • Build process unchanged otherwise; ownership and startup steps remain the same.
    • Building the image now requires a metrics directory in the build context.

@openshift-ci openshift-ci Bot requested review from eranco74 and jhernand August 18, 2025 10:18
@openshift-ci openshift-ci Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 18, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 18, 2025

Walkthrough

A single Dockerfile change adds copying the metrics directory into the image with "COPY metrics ./metrics/". No other instructions were modified; existing chown and runtime steps remain unchanged. The build now requires a metrics directory in the context.

Changes

Cohort / File(s) Summary
Dockerfile update
Dockerfile
Inserted COPY metrics ./metrics/ to include metrics directory in image; all subsequent steps unchanged.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Docker as Docker Daemon
    participant Img as Image Filesystem

    Dev->>Docker: docker build .
    Docker->>Img: COPY service_client ./service_client/
    Docker->>Img: COPY metrics ./metrics/
    Docker->>Img: chown and runtime steps (unchanged)
    Docker-->>Dev: Built image with /opt/app-root/src/metrics
Loading

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

I tucked some metrics in my pack,
A hop, a copy—no looking back.
Into the image, neat and tight,
Carrots counted, dashboards bright.
With whiskers twitching at the log,
I ship my bytes—a metric hog! 🥕📊

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 (1)
Dockerfile (1)

16-16: Optional: add a build-time import smoke check (as non-root).

A quick import check during build can catch regressions early if the directory goes missing or import paths change.

You can insert this after Line 20 (USER 1001):

RUN python -c "import importlib; importlib.import_module('metrics.metrics'); print('metrics import OK')"
📜 Review details

Configuration used: CodeRabbit UI
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 8463fc5 and 00a7da4.

📒 Files selected for processing (1)
  • Dockerfile (1 hunks)
⏰ 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). (1)
  • GitHub Check: Red Hat Konflux / assisted-service-mcp-saas-main-on-pull-request
🔇 Additional comments (1)
Dockerfile (1)

16-16: Fix aligns with PR objective; should resolve ModuleNotFoundError.

Copying the metrics directory into APP_HOME makes metrics/metrics.py importable at runtime. This directly addresses the import path used by service_client (from metrics.metrics import API_CALL_LATENCY).

Please confirm that the repository build context contains:

  • metrics/metrics.py (module path matches the import), and
  • metrics is not excluded via .dockerignore.

@carbonin
Copy link
Copy Markdown
Collaborator

🤦 Thanks @maorfr

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 18, 2025
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Aug 18, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carbonin, maorfr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 18, 2025
@maorfr maorfr merged commit 9b11182 into openshift-assisted:master Aug 18, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants