load-mocks 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env python
  2. from sentry.runner import configure
  3. configure()
  4. from django.conf import settings
  5. from sentry.utils import mockdata
  6. if __name__ == "__main__":
  7. settings.CELERY_ALWAYS_EAGER = True
  8. from optparse import OptionParser
  9. parser = OptionParser()
  10. parser.add_option("--events", default=1, type=int, help="number of events to generate")
  11. parser.add_option(
  12. "--skip-default-setup",
  13. default=False,
  14. action="store_true",
  15. help="Skips creating the default project, teams and timeseries, useful when only loading specific transactions",
  16. )
  17. parser.add_option(
  18. "--extra-events",
  19. default=False,
  20. action="store_true",
  21. help="add multiple events for each error group",
  22. )
  23. parser.add_option(
  24. "--load-trends",
  25. default=False,
  26. action="store_true",
  27. help="load multiple transactions for each id to show trends",
  28. )
  29. parser.add_option(
  30. "--load-performance-issues",
  31. default=False,
  32. action="store_true",
  33. help="load transactions with performance issues, still needs options/flags on for issues to appear.",
  34. )
  35. parser.add_option(
  36. "--slow",
  37. default=False,
  38. action="store_true",
  39. help="sleep between each transaction to let clickhouse rest",
  40. )
  41. (options, args) = parser.parse_args()
  42. try:
  43. mockdata.main(
  44. skip_default_setup=options.skip_default_setup,
  45. num_events=options.events,
  46. extra_events=options.extra_events,
  47. load_trends=options.load_trends,
  48. load_performance_issues=options.load_performance_issues,
  49. slow=options.slow,
  50. )
  51. except Exception:
  52. # Avoid reporting any issues recursively back into Sentry
  53. import sys
  54. import traceback
  55. traceback.print_exc()
  56. sys.exit(1)