Skip to content

Conversation

@yaroslavborbat
Copy link
Member

Description

add persistent data for local pyroscope

Why do we need it, and what problem does it solve?

What is the expected result?

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

@yaroslavborbat yaroslavborbat added this to the v1.2.0 milestone Oct 24, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 24, 2025

Reviewer's Guide

This PR refactors the local Pyroscope setup by introducing a named Docker volume for persistent data and expanding the hack script and Taskfile with granular start/stop/data commands, while adding a standalone compose file for Pyroscope-only deployments.

Class diagram for pyroscope.sh command functions

classDiagram
  class pyroscope_sh {
    +start()
    +stop()
    +wipe_data()
    +info_data()
    +start_pyroscope()
    +stop_pyroscope()
  }
Loading

Flow diagram for new pyroscope.sh command structure

flowchart TD
  A["pyroscope.sh"] --> B["start"]
  A --> C["stop"]
  A --> D["wipe-data"]
  A --> E["info-data"]
  A --> F["start-pyroscope"]
  A --> G["stop-pyroscope"]
Loading

File-Level Changes

Change Details Files
Refactor hack/pyroscope.sh to support persistent data and granular commands
  • Renamed run → start and wipe → stop commands
  • Added wipe-data, info-data, start-pyroscope, and stop-pyroscope functions
  • Introduced PYROSCOPE_VOLUME_NAME and reference to a secondary compose file
  • Updated usage help and CMD case blocks to reflect new commands
images/virtualization-artifact/hack/pyroscope.sh
Update Taskfile with granular Pyroscope tasks
  • Replaced run/wipe tasks with start/stop tasks for both controller and vm-route-forge
  • Added start-pyroscope-only and stop-pyroscope-only tasks
  • Added wipe-data and info-data tasks
images/virtualization-artifact/Taskfile.yaml
Enable persistent data volume in Docker Compose configs
  • Added named volume mapping under services and volumes in existing compose file
  • Created docker-compose-pyroscope-only.yaml with same volume and service configuration
images/virtualization-artifact/hack/pyroscope/docker-compose.yaml
images/virtualization-artifact/hack/pyroscope/docker-compose-pyroscope-only.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Rename bash functions to use underscores instead of hyphens (e.g. wipe_data, info_data) since hyphens aren’t valid in function names and will cause syntax errors.
  • Add a confirmation step or safety check before running the destructive wipe-data command to avoid accidental volume removal.
  • Refactor the duplicated start/stop logic for full vs. pyroscope-only modes by parameterizing the compose file path instead of repeating almost identical functions.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Rename bash functions to use underscores instead of hyphens (e.g. wipe_data, info_data) since hyphens aren’t valid in function names and will cause syntax errors.
- Add a confirmation step or safety check before running the destructive wipe-data command to avoid accidental volume removal.
- Refactor the duplicated start/stop logic for full vs. pyroscope-only modes by parameterizing the compose file path instead of repeating almost identical functions.

## Individual Comments

### Comment 1
<location> `images/virtualization-artifact/hack/pyroscope.sh:107-109` </location>
<code_context>
-        run
+    "start")
+        start
+        echo "Pyroscope launched successfully."
+        echo "Open http://localhost:4040 in your browser."
+        ;;
+    "stop")
</code_context>

<issue_to_address>
**suggestion:** Consider making the success message conditional on actual launch success.

Check the exit status of the start command and print the success message only if it completes successfully.

```suggestion
        start
        if [ $? -eq 0 ]; then
            echo "Pyroscope launched successfully."
            echo "Open http://localhost:4040 in your browser."
        else
            echo "Pyroscope failed to launch." >&2
        fi
```
</issue_to_address>

### Comment 2
<location> `images/virtualization-artifact/Taskfile.yaml:126-128` </location>
<code_context>
-  pyroscope:local:wipe:vm-route-forge:
-    desc: "Wipe local pyroscope for vm-route-forge"
-    cmd: ./hack/pyroscope.sh wipe --namespace={{ .BaseNamespace }}
+  pyroscope:local:info-data:
+    desc: "Show local pyroscope dat info"
+    cmd: ./hack/pyroscope.sh info-data
</code_context>

<issue_to_address>
**nitpick (typo):** Typo in description: 'dat' should be 'data'.

Please update the description to use 'data' instead of 'dat'.

```suggestion
  pyroscope:local:info-data:
    desc: "Show local pyroscope data info"
    cmd: ./hack/pyroscope.sh info-data
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@yaroslavborbat yaroslavborbat force-pushed the chore/persistent-data-for-local-pyroscope branch from 9d27f9c to 44eb9ed Compare October 24, 2025 14:11
@yaroslavborbat yaroslavborbat force-pushed the chore/persistent-data-for-local-pyroscope branch from 3b73e10 to 865b580 Compare October 24, 2025 14:19
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.

1 participant