oncall-engine/dev/scripts/generate-fake-data
dependabot[bot] 633476365a
chore(deps): bump aiohttp from 3.10.2 to 3.10.11 in /dev/scripts/generate-fake-data (#5275)
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=aiohttp&package-manager=pip&previous-version=3.10.2&new-version=3.10.11)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/grafana/oncall/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2024-11-20 19:47:55 +00:00
..
main.py fake-data generation script + fixes for django-silk and django-debug-toolbar (#1128) 2023-01-20 09:19:41 +01:00
README.md bump uwsgi to 2.0.26 + Python to 3.12.3 (#4495) 2024-06-10 15:33:37 -04:00
requirements.txt chore(deps): bump aiohttp from 3.10.2 to 3.10.11 in /dev/scripts/generate-fake-data (#5275) 2024-11-20 19:47:55 +00:00

Fake Data Generator Script

This script can be used to easily populate fake data into your local Grafana/OnCall setup. Currently the script is capable of generating the following objects:

  • teams
  • users
  • schedules
  • schedule on call shifts

Prerequisites

  1. Create/active a Python 3.12 virtual environment
  2. pip install -r requirements.txt
  3. Must have a local version of Grafana and OnCall up and running
  4. Generate an API key inside of Grafana OnCall

How to run

Note: The below flag values assume you are running a grafana container locally via the docker-compose setup. The reason why there is a few separate steps involved is that we need to first create teams and users in the Grafana instance. Later on, in order to create OnCall schedules/oncall-shifts, we need the OnCall user ID to do so. There is currently no way to trigger a Grafana -> OnCall data sync via the public API, hence the manual step in the middle to have data synced between Grafana and OnCall.

  1. Create teams and users in Grafana. The teams and users flags represent the number of teams and users you would like to create respectively:

    # by default this will generate 10 teams and 1000 users
    python main.py generate_teams_and_users
    

    See python main.py generate_teams_and_users -h for more information on how to run the command.

  2. Head to your OnCall setup, and trigger a Grafana -> OnCall data sync by visiting the plugin page.

  3. Create schedules and on call shifts in OnCall. The schedules flag represents the number of OnCall schedules you would like to generate. Note that one on call shift is created for each schedule:

    # by default this will generate 100 schedules
    python main.py generate_schedules_and_oncall_shifts --oncall-api-token=<oncall-api-key>
    

    See python main.py generate_schedules_and_oncall_shifts -h for more information on how to run the command.