chore: modify producer output

This commit is contained in:
shivanshu 2024-08-26 20:35:08 +05:30
parent f508ee7521
commit 90cb8ba9a1
No known key found for this signature in database
GPG Key ID: 0F9ACBC3AA12DC71
2 changed files with 5 additions and 7 deletions

View File

@ -122,7 +122,7 @@ Response in query range `table` format
"isValueColumn": false
},
{
"name": "rps",
"name": "throughput",
"queryName": "",
"isValueColumn": false
}
@ -132,7 +132,7 @@ Response in query range `table` format
"data": {
"error_percentage": "0",
"p99": "5.51359028",
"rps": "39.86888888888889",
"throughput": "39.86888888888889",
"service_name": "producer-svc"
}
}

View File

@ -26,7 +26,6 @@ WITH consumer_query AS (
GROUP BY serviceName
)
-- Main query to select all metrics
SELECT
serviceName AS service_name,
p99,
@ -65,7 +64,7 @@ SELECT
serviceName AS service_name,
p99,
COALESCE((error_count * 100.0) / total_count, 0) AS error_percentage,
COALESCE(total_count / %d, 0) AS rps -- Convert nanoseconds to seconds
COALESCE(total_count / %d, 0) AS throughput -- Convert nanoseconds to seconds
FROM
producer_query
ORDER BY
@ -78,12 +77,11 @@ ORDER BY
func generateNetworkLatencyThroughputSQL(start, end int64, consumerGroup, queueType string) string {
timeRange := (end - start) / 1000000000
query := fmt.Sprintf(`
--- Subquery for RPS calculation, desc sorted by rps
SELECT
stringTagMap['messaging.client_id'] AS client_id,
stringTagMap['service.instance.id'] AS service_instance_id,
serviceName AS service_name,
count(*) / %d AS rps -- Convert nanoseconds to seconds
count(*) / %d AS throughput -- Convert nanoseconds to seconds
FROM signoz_traces.distributed_signoz_index_v2
WHERE
timestamp >= '%d'
@ -92,7 +90,7 @@ WHERE
AND msgSystem = '%s'
AND stringTagMap['messaging.kafka.consumer.group'] = '%s'
GROUP BY service_name, client_id, service_instance_id
ORDER BY rps DESC
ORDER BY throughput DESC
`, timeRange, start, end, queueType, consumerGroup)
return query
}