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.

feat: enable creating more than 3 steps in trace funnels + enable latency pointer (#8628)

Ankit Nayan6b1d62ba8f69
diff --git a/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/FunnelStep.tsx b/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/FunnelStep.tsx
index 9788baf527..a31e8442b9 100644
--- a/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/FunnelStep.tsx
+++ b/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/FunnelStep.tsx
@@ -1,12 +1,22 @@
import './FunnelStep.styles.scss';
-import { Button, Divider, Form, Switch, Tooltip } from 'antd';
+import {
+ Button,
+ Divider,
+ Dropdown,
+ Form,
+ MenuProps,
+ Space,
+ Switch,
+ Tooltip,
+} from 'antd';
import cx from 'classnames';
import { FilterSelect } from 'components/CeleryOverview/CeleryOverviewConfigOptions/CeleryOverviewConfigOptions';
import { QueryParams } from 'constants/query';
import { initialQueriesMap } from 'constants/queryBuilder';
import QueryBuilderSearchV2 from 'container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2';
-import { HardHat, PencilLine } from 'lucide-react';
+import { ChevronDown, HardHat, PencilLine } from 'lucide-react';
+import { LatencyPointers } from 'pages/TracesFunnelDetails/constants';
import { useFunnelContext } from 'pages/TracesFunnels/FunnelContext';
import { useAppContext } from 'providers/App/App';
import { useMemo, useState } from 'react';
@@ -37,17 +47,16 @@ function FunnelStep({
false,
);
- // temporarily hide latency pointer, as it breaks some edge cases (ref: https://signoz-team.slack.com/archives/C089MNX4Y90/p1748600682066499?thread_ts=1748599673.171759&cid=C089MNX4Y90)
- // const latencyPointerItems: MenuProps['items'] = LatencyPointers.map(
- // (option) => ({
- // key: option.value,
- // label: option.key,
- // style:
- // option.value === stepData.latency_pointer
- // ? { backgroundColor: 'var(--bg-slate-100)' }
- // : {},
- // }),
- // );
+ const latencyPointerItems: MenuProps['items'] = LatencyPointers.map(
+ (option) => ({
+ key: option.value,
+ label: option.key,
+ style:
+ option.value === stepData.latency_pointer
+ ? { backgroundColor: 'var(--bg-slate-100)' }
+ : {},
+ }),
+ );
const updatedCurrentQuery = useMemo(
() => ({
@@ -205,8 +214,7 @@ function FunnelStep({
/>
<div className="error__label">Errors</div>
</div>
- {/* temporarily hide latency pointer, as it breaks some edge cases (ref: https://signoz-team.slack.com/archives/C089MNX4Y90/p1748600682066499?thread_ts=1748599673.171759&cid=C089MNX4Y90) */}
- {/* <div className="latency-pointer">
+ <div className="latency-pointer">
<div className="latency-pointer__label">Latency pointer</div>
<Dropdown
menu={{
@@ -217,6 +225,7 @@ function FunnelStep({
}),
}}
trigger={['click']}
+ disabled={!hasEditPermission}
>
<Space>
{
@@ -227,7 +236,7 @@ function FunnelStep({
<ChevronDown size={14} color="var(--bg-vanilla-400)" />
</Space>
</Dropdown>
- </div> */}
+ </div>
</div>
</Form>
</div>
diff --git a/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/StepsContent.tsx b/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/StepsContent.tsx
index aa78dcce7d..aef3129fce 100644
--- a/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/StepsContent.tsx
+++ b/frontend/src/pages/TracesFunnelDetails/components/FunnelConfiguration/StepsContent.tsx
@@ -81,51 +81,26 @@ function StepsContent({
}
/>
))}
- {/* For now we are only supporting 3 steps */}
- {steps.length < 3 && (
- <Step
- className="steps-content__add-step"
- description={
- !isTraceDetailsPage ? (
- <Tooltip
- title={
- !hasEditPermission
- ? 'You need editor or admin access to add steps'
- : ''
- }
- >
- <Button
- type="default"
- className="steps-content__add-btn"
- onClick={handleAddStep}
- icon={<PlusIcon size={14} />}
- disabled={!hasEditPermission}
- >
- Add Funnel Step
- </Button>
- </Tooltip>
- ) : (
- <Tooltip
- title={
- !hasEditPermission
- ? 'You need editor or admin access to add steps'
- : ''
- }
- >
- <Button
- type="default"
- className="steps-content__add-btn"
- onClick={handleAddForNewStep}
- icon={<PlusIcon size={14} />}
- disabled={!hasEditPermission}
- >
- Add for new Step
- </Button>
- </Tooltip>
- )
- }
- />
- )}
+ <Step
+ className="steps-content__add-step"
+ description={
+ <Tooltip
+ title={
+ !hasEditPermission ? 'You need editor or admin access to add steps' : ''
+ }
+ >
+ <Button
+ type="default"
+ className="steps-content__add-btn"
+ onClick={isTraceDetailsPage ? handleAddForNewStep : handleAddStep}
+ icon={<PlusIcon size={14} />}
+ disabled={!hasEditPermission}
+ >
+ {isTraceDetailsPage ? 'Add for new Step' : 'Add Funnel Step'}
+ </Button>
+ </Tooltip>
+ }
+ />
</Steps>
</div>
);
diff --git a/frontend/src/pages/TracesFunnelDetails/constants.ts b/frontend/src/pages/TracesFunnelDetails/constants.ts
index c48bbf9a31..b9a0b78fd7 100644
--- a/frontend/src/pages/TracesFunnelDetails/constants.ts
+++ b/frontend/src/pages/TracesFunnelDetails/constants.ts
@@ -23,7 +23,7 @@ export const createInitialStepsData = (): FunnelStepData[] => [
items: [],
op: 'and',
},
- latency_pointer: 'start',
+ latency_pointer: 'end',
latency_type: LatencyOptions.P95,
has_errors: false,
},
diff --git a/frontend/src/pages/TracesFunnels/FunnelContext.tsx b/frontend/src/pages/TracesFunnels/FunnelContext.tsx
index 9a0092b6d8..ed944ecc37 100644
--- a/frontend/src/pages/TracesFunnels/FunnelContext.tsx
+++ b/frontend/src/pages/TracesFunnels/FunnelContext.tsx
@@ -161,18 +161,20 @@ export function FunnelProvider({
);
const addNewStep = useCallback(() => {
- if (steps.length >= 3) return false;
-
- setSteps((prev) => [
- ...prev,
- {
- ...createInitialStepsData()[0],
- id: v4(),
- step_order: prev.length + 1,
- },
- ]);
+ setSteps((prev) => {
+ const newStepOrder = prev.length + 1;
+ return [
+ ...prev,
+ {
+ ...createInitialStepsData()[0],
+ id: v4(),
+ step_order: newStepOrder,
+ latency_pointer: newStepOrder === 1 ? 'start' : 'end',
+ },
+ ];
+ });
return true;
- }, [steps.length]);
+ }, []);
const handleStepRemoval = useCallback((index: number) => {
setSteps((prev) =>