Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(examples): update python examples #3769

Merged
merged 7 commits into from
Dec 13, 2024

Conversation

kolesnikovae
Copy link
Collaborator

@kolesnikovae kolesnikovae commented Dec 12, 2024

The PR does not bring any significant changes: I fixed a couple of links, added new ones, and cleaned up a bit. All the examples (simple, flask, django, fastapi) use the latest version and can be run locally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the file as it duplicates the README in the /python. This file includes more recent updates: in fact, I replaced /python/README.md with /python/rideshare/README.md (same for _zh version – however, I don't know if it is up to date)

Comment on lines 1 to 16
# Dockerizing Django with Pyroscope, Postgres, Gunicorn, and Nginx
This is a simple rideshare example that adds Pyroscope to a Django application and uses it to profile various routes
# Django Example

### Development
Uses the default Django development server.
To run the example run the following commands:
```
# Pull latest pyroscope and grafana images:
docker pull grafana/pyroscope:latest
docker pull grafana/grafana:latest

1. Rename *.env.dev-sample* to *.env.dev*.
1. Update the environment variables in the *docker-compose.yml* and *.env.dev* files.
1. Build the images and run the containers:
# Run the example project:
docker-compose up --build

```sh
$ docker-compose up -d --build
```
# Reset the database (if needed):
# docker-compose down
```

Test it out at [http://localhost:8000](http://localhost:8000). The "app" folder is mounted into the container and your code changes apply automatically.
Navigate to [Grafana](http://localhost:3000/a/grafana-pyroscope-app/profiles-explorer?explorationType=flame-graph&var-serviceName=django-ride-sharing-app&var-profileMetricId=process_cpu:cpu:nanoseconds:cpu:nanoseconds) to Explore Profiles.
Copy link
Collaborator Author

@kolesnikovae kolesnikovae Dec 12, 2024

Choose a reason for hiding this comment

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

I unified it with the Flask and FastAPI versions

Comment on lines 15 to 16

Navigate to [Grafana](http://localhost:3000/a/grafana-pyroscope-app/profiles-explorer?explorationType=flame-graph&var-serviceName=flask-ride-sharing-app&var-profileMetricId=process_cpu:cpu:nanoseconds:cpu:nanoseconds) to Explore Profiles.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I decided to add a link to the local Explore Profiles page with the service flame graph, as it might not be immediately apparent to new users what to do or where to find the profiling data

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's a pity that the README is quite outdated in terms of user experience. I'm hesitant to update it to the Explore Profiles version.

@Rperry2174, please let me know if you think it's time to make the update

@kolesnikovae kolesnikovae marked this pull request as ready for review December 12, 2024 11:09
@kolesnikovae kolesnikovae requested review from a team as code owners December 12, 2024 11:09
Copy link
Contributor

@simonswine simonswine left a comment

Choose a reason for hiding this comment

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

LGTM

@kolesnikovae kolesnikovae merged commit 74a05a9 into main Dec 13, 2024
18 checks passed
@kolesnikovae kolesnikovae deleted the chore(examples)/update-python-examples branch December 13, 2024 11:05
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