flamegraphZoomView.stories.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import styled from '@emotion/styled';
  2. import {Flamegraph} from 'sentry/components/profiling/flamegraph';
  3. import {FlamegraphStateProvider} from 'sentry/utils/profiling/flamegraph/flamegraphStateProvider';
  4. import {FlamegraphThemeProvider} from 'sentry/utils/profiling/flamegraph/flamegraphThemeProvider';
  5. import {importProfile} from 'sentry/utils/profiling/profile/importProfile';
  6. const FlamegraphContainer = styled('div')`
  7. display: flex;
  8. flex-direction: column;
  9. height: 100vh;
  10. `;
  11. export default {
  12. title: 'Components/Profiling/FlamegraphZoomView',
  13. };
  14. const eventedProfiles = importProfile(
  15. require('sentry/utils/profiling/profile/formats/android/trace.json')
  16. );
  17. export const EventedTrace = () => {
  18. return (
  19. <FlamegraphStateProvider>
  20. <FlamegraphThemeProvider>
  21. <FlamegraphContainer>
  22. <Flamegraph profiles={eventedProfiles} />
  23. </FlamegraphContainer>
  24. </FlamegraphThemeProvider>
  25. </FlamegraphStateProvider>
  26. );
  27. };
  28. const sampledTrace = importProfile(
  29. require('sentry/utils/profiling/profile/formats/ios/trace.json')
  30. );
  31. export const SampledTrace = () => {
  32. return (
  33. <FlamegraphStateProvider>
  34. <FlamegraphThemeProvider>
  35. <FlamegraphContainer>
  36. <Flamegraph profiles={sampledTrace} />
  37. </FlamegraphContainer>
  38. </FlamegraphThemeProvider>
  39. </FlamegraphStateProvider>
  40. );
  41. };
  42. const jsSelfProfile = importProfile(
  43. require('sentry/utils/profiling/profile/formats/jsSelfProfile/trace.json')
  44. );
  45. export const JSSelfProfiling = () => {
  46. return (
  47. <FlamegraphStateProvider>
  48. <FlamegraphThemeProvider>
  49. <FlamegraphContainer>
  50. {jsSelfProfile ? <Flamegraph profiles={jsSelfProfile} /> : null}
  51. </FlamegraphContainer>
  52. </FlamegraphThemeProvider>
  53. </FlamegraphStateProvider>
  54. );
  55. };
  56. const typescriptProfile = importProfile(
  57. require('sentry/utils/profiling/profile/formats/typescript/trace.json')
  58. );
  59. export const TypescriptProfile = () => {
  60. return (
  61. <FlamegraphStateProvider>
  62. <FlamegraphThemeProvider>
  63. <FlamegraphContainer>
  64. {typescriptProfile ? <Flamegraph profiles={typescriptProfile} /> : null}
  65. </FlamegraphContainer>
  66. </FlamegraphThemeProvider>
  67. </FlamegraphStateProvider>
  68. );
  69. };