spanDescription.tsx 838 B

123456789101112131415161718192021222324252627282930
  1. import styled from '@emotion/styled';
  2. import {FormattedCode} from 'sentry/views/starfish/components/formattedCode';
  3. import type {IndexedSpan} from 'sentry/views/starfish/queries/types';
  4. import {highlightSql} from 'sentry/views/starfish/utils/highlightSql';
  5. export function SpanDescription({span}: {span: IndexedSpan}) {
  6. if (span.op.startsWith('db')) {
  7. return <DatabaseSpanDescription span={span} />;
  8. }
  9. return <div>{span.description}</div>;
  10. }
  11. function DatabaseSpanDescription({span}: {span: IndexedSpan}) {
  12. return (
  13. <CodeWrapper>
  14. <FormattedCode>
  15. {highlightSql(span.description || '', {
  16. action: span.action || '',
  17. domain: span.domain || '',
  18. })}
  19. </FormattedCode>
  20. </CodeWrapper>
  21. );
  22. }
  23. const CodeWrapper = styled('div')`
  24. font-size: ${p => p.theme.fontSizeMedium};
  25. `;