spanIdCell.tsx 987 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import Link from 'sentry/components/links/link';
  2. import {generateLinkToEventInTraceView} from 'sentry/utils/discover/urls';
  3. import {useLocation} from 'sentry/utils/useLocation';
  4. import useOrganization from 'sentry/utils/useOrganization';
  5. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  6. import {SPAN_ID_DISPLAY_LENGTH} from 'sentry/views/performance/http/settings';
  7. interface Props {
  8. projectSlug: string;
  9. spanId: string;
  10. timestamp: string;
  11. traceId: string;
  12. transactionId: string;
  13. }
  14. export function SpanIdCell({
  15. projectSlug,
  16. traceId,
  17. transactionId,
  18. spanId,
  19. timestamp,
  20. }: Props) {
  21. const organization = useOrganization();
  22. const location = useLocation();
  23. const url = normalizeUrl(
  24. generateLinkToEventInTraceView({
  25. eventId: transactionId,
  26. projectSlug,
  27. traceSlug: traceId,
  28. timestamp,
  29. organization,
  30. location,
  31. spanId,
  32. })
  33. );
  34. return <Link to={url}>{spanId.slice(0, SPAN_ID_DISPLAY_LENGTH)}</Link>;
  35. }