Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

2.1 KB
Raw Blame
import type { Meta, StoryObj } from '@storybook/react-vite';
import ROUTES from 'constants/routes';
import { renderAtRoute } from '@/storybook/renderAtRoute';
import { screen, userEvent, within } from 'storybook/test';

import { storyMocks } from '@/storybook/controls/defineStoryMocks';
import type { PageStoryArgs } from '@/storybook/runtime/resolveStory';

import TracesFunnelDetails from '../index';
import { tracesFunnelDetailsMocks } from './TracesFunnelDetails.stories.mocks';

type TracesFunnelDetailsArgs = PageStoryArgs<typeof tracesFunnelDetailsMocks>;

const pageStory = storyMocks(tracesFunnelDetailsMocks, { layout: 'app' });

/**
 * One trace funnel: conversion and drop off per step, with the slow and erroring
 * traces behind each.
 *
 * Route: `/traces/funnels/:funnelId`.
 */
const meta = {
	title: 'Pages/Traces/Funnel Details',
	tags: ['play'],
	component: TracesFunnelDetails,
	// The funnel id is in the pathname, so the page renders under its own route
	// rather than being mounted on its own.
	render: renderAtRoute(ROUTES.TRACES_FUNNELS_DETAIL, TracesFunnelDetails),
	...pageStory,
	parameters: { ...pageStory.parameters },
} satisfies Meta<TracesFunnelDetailsArgs>;

export default meta;

type Story = StoryObj<TracesFunnelDetailsArgs>;

/**
 * A four-step checkout funnel: the steps on the left, and the conversion,
 * timing and the traces behind each transition on the right.
 */
export const Default: Story = {};

/** Most of the traffic lost at the first hop, which is what the funnel is for. */
export const SevereDropOff: Story = {
	args: { dropOff: 'severe' },
};

/** A funnel someone has started but only defined the entry step of. */
export const SingleStep: Story = {
	args: { steps: 1 },
};

/**
 * The latency pointer menu on the first step, open over the funnel
 * configuration: which end of a step's span the funnel times from.
 */
export const LatencyPointerMenu: Story = {
	play: async ({ canvasElement }): Promise<void> => {
		await userEvent.click(
			await within(canvasElement).findByTestId(
				'funnel-step-latency-pointer-0',
				{},
				{ timeout: 10000 },
			),
		);
		await screen.findByRole('menu');
	},
};