fix: added funnel step fixes

Signed-off-by: Shivanshu Raj Shrivastava <shivanshu1333@gmail.com>
This commit is contained in:
Shivanshu Raj Shrivastava 2025-05-05 02:48:11 +05:30
parent 6ee9b9b222
commit 00526e3803
No known key found for this signature in database
GPG Key ID: D34D26C62AC3E9AE

View File

@ -76,25 +76,19 @@ func GetFunnelAnalytics(funnel *tracefunnel.Funnel, timeRange tracefunnel.TimeRa
stepStartOrder := 0
stepEndOrder := 1
// (todo): check the logic
if stepStart != stepEnd {
stepStartOrder = int(stepStart) - 1
stepEndOrder = int(stepEnd) - 1
}
if len(funnel.Steps) == 2 && funnelSteps[0].HasErrors {
if funnelSteps[0].HasErrors {
containsErrorT1 = 1
}
if len(funnel.Steps) == 2 && funnelSteps[1].HasErrors {
if funnelSteps[1].HasErrors {
containsErrorT2 = 1
}
if len(funnel.Steps) > 2 && funnelSteps[2].HasErrors {
containsErrorT3 = 1
}
if len(funnel.Steps) == 2 && funnelSteps[0].LatencyPointer != "" {
if funnelSteps[0].LatencyPointer != "" {
latencyPointerT1 = "end"
}
if len(funnel.Steps) == 2 && funnelSteps[1].LatencyPointer != "" {
if funnelSteps[1].LatencyPointer != "" {
latencyPointerT1 = "end"
}
if len(funnel.Steps) > 2 && funnelSteps[2].LatencyPointer != "" {
@ -125,6 +119,16 @@ func GetFunnelAnalytics(funnel *tracefunnel.Funnel, timeRange tracefunnel.TimeRa
//"db_operation = 'SELECT'", // clauseStep3
)
} else {
if stepStart != stepEnd {
stepStartOrder = int(stepStart) - 1
stepEndOrder = int(stepEnd) - 1
if funnelSteps[stepStartOrder].HasErrors {
containsErrorT1 = 1
}
if funnelSteps[stepEndOrder].HasErrors {
containsErrorT2 = 1
}
}
query = BuildTwoStepFunnelOverviewQuery(
containsErrorT1, // containsErrorT1
containsErrorT2, // containsErrorT2
@ -207,17 +211,15 @@ func GetSlowestTraces(funnel *tracefunnel.Funnel, timeRange tracefunnel.TimeRang
stepStartOrder := 0
stepEndOrder := 1
if len(funnel.Steps) == 2 && funnelSteps[0].HasErrors {
containsErrorT1 = 1
}
if len(funnel.Steps) == 2 && funnelSteps[1].HasErrors {
containsErrorT2 = 1
}
// (todo): check the logic
if stepStart != stepEnd {
stepStartOrder = int(stepStart) - 1
stepEndOrder = int(stepEnd) - 1
if funnelSteps[stepStartOrder].HasErrors {
containsErrorT1 = 1
}
if funnelSteps[stepEndOrder].HasErrors {
containsErrorT2 = 1
}
}
query := BuildTwoStepFunnelTopSlowTracesQuery(
@ -243,17 +245,16 @@ func GetErroredTraces(funnel *tracefunnel.Funnel, timeRange tracefunnel.TimeRang
stepStartOrder := 0
stepEndOrder := 1
if len(funnel.Steps) == 2 && funnelSteps[0].HasErrors {
containsErrorT1 = 1
}
if len(funnel.Steps) == 2 && funnelSteps[1].HasErrors {
containsErrorT2 = 1
}
// (todo): check the logic
if stepStart != stepEnd {
stepStartOrder = int(stepStart) - 1
stepEndOrder = int(stepEnd) - 1
if funnelSteps[stepStartOrder].HasErrors {
containsErrorT1 = 1
}
if funnelSteps[stepEndOrder].HasErrors {
containsErrorT2 = 1
}
}
query := BuildTwoStepFunnelTopSlowErrorTracesQuery(