Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error ordering for traces #1398

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,202 changes: 1,103 additions & 1,099 deletions connect-go/gen/proto/wg/cosmo/platform/v1/platform.pb.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions connect/src/wg/cosmo/platform/v1/platform_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ export enum Unit {
* @generated from enum value: SpanID = 7;
*/
SpanID = 7,

/**
* @generated from enum value: Percentage = 8;
*/
Percentage = 8,
}
// Retrieve enum metadata with: proto3.getEnumType(Unit)
proto3.util.setEnumType(Unit, "wg.cosmo.platform.v1.Unit", [
Expand All @@ -136,6 +141,7 @@ proto3.util.setEnumType(Unit, "wg.cosmo.platform.v1.Unit", [
{ no: 5, name: "StatusCode" },
{ no: 6, name: "TraceID" },
{ no: 7, name: "SpanID" },
{ no: 8, name: "Percentage" },
]);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,12 @@ export class AnalyticsRequestViewRepository {
unit: Unit.Nanoseconds,
title: 'P95 Latency',
},
errorsWithRate: {
title: 'Errors (Rate%)',
errors: {
title: 'Errors',
},
errorRate: {
title: 'Error Rate%',
thisisnithin marked this conversation as resolved.
Show resolved Hide resolved
unit: Unit.Percentage,
},
rate: {
title: 'Rate',
Expand Down Expand Up @@ -289,12 +293,8 @@ export class AnalyticsRequestViewRepository {
OperationType as operationType,
sum(TotalRequests) as totalRequests,
quantilesMerge(0.95)(DurationQuantiles)[1] as p95,
CONCAT(
toString(sum(TotalRequestsError)),
' (',
toString(round(sum(TotalRequestsError) / sum(TotalRequests) * 100, 2)),
'%)'
) as errorsWithRate,
sum(TotalRequestsError) as errors,
round(sum(TotalRequestsError) / sum(TotalRequests) * 100, 2) as errorRate,
toString(toUnixTimestamp(max(LastCalled))) as lastCalled
FROM
${this.client.database}.traces_by_operation_quarter_hourly
Expand All @@ -307,6 +307,7 @@ export class AnalyticsRequestViewRepository {
${baseOrderSql || 'ORDER BY totalRequests DESC'}
${basePaginationSql}
`;

break;
}
case AnalyticsViewGroupName.Client: {
Expand All @@ -316,12 +317,8 @@ export class AnalyticsRequestViewRepository {
ClientVersion as clientVersion,
sum(TotalRequests) as totalRequests,
quantilesMerge(0.95)(DurationQuantiles)[1] as p95,
CONCAT(
toString(sum(TotalRequestsError)),
' (',
toString(round(sum(TotalRequestsError) / sum(TotalRequests) * 100, 2)),
'%)'
) as errorsWithRate,
sum(TotalRequestsError) as errors,
round(sum(TotalRequestsError) / sum(TotalRequests) * 100, 2) as errorRate,
toString(toUnixTimestamp(max(LastCalled))) as lastCalled
FROM
${this.client.database}.traces_by_client_quarter_hourly
Expand Down
1 change: 1 addition & 0 deletions proto/wg/cosmo/platform/v1/platform.proto
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ enum Unit {
StatusCode = 5;
TraceID = 6;
SpanID = 7;
Percentage = 8;
}

enum AnalyticsViewFilterOperator {
Expand Down
4 changes: 4 additions & 0 deletions studio/src/components/analytics/getColumnData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ const formatColumnData = (data: string | number, type: Unit): ReactNode => {
return <span>{mapStatusCode[data]}</span>;
}

if (type === Unit.Percentage) {
return <span>{data}%</span>;
}

if (type === Unit.TraceID || type === Unit.SpanID) {
return (
<TooltipProvider>
Expand Down
2 changes: 1 addition & 1 deletion studio/src/components/analytics/metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ export const ErrorMetricsCard = (props: {
formatter={formatter}
queryParams={{
group: "OperationName",
sort: "errorsWithRate",
sort: "errors",
sortDir: "desc",
}}
isSubgraphAnalytics={props.isSubgraphAnalytics}
Expand Down
Loading