Skip to content
This repository was archived by the owner on Dec 30, 2024. It is now read-only.

Commit b7e7846

Browse files
fix/incidents grouping postgres query, platform visualization as iterate over dictionary fields
1 parent 5795113 commit b7e7846

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

lib/src/db/entities/incident.entity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "t
22
import { User } from "./user.entity";
33
import { Project } from "./project.entity";
44
import { BaseEntity } from "../../common/base/base.entity";
5-
import { IIncident, IProject, Platform, SDK, Trace } from "@traceo/types";
5+
import { Dictionary, IIncident, IProject, Platform, SDK, Trace } from "@traceo/types";
66

77
export enum IncidentStatus {
88
RESOLVED = "resolved",
@@ -80,7 +80,7 @@ export class Incident extends BaseEntity implements IIncident {
8080
type: "simple-json",
8181
nullable: true
8282
})
83-
platform: Platform;
83+
platform: Dictionary<string | number>;
8484

8585
@Column({
8686
type: "simple-json",

public/packages/app/src/features/project/explore/tracing/view/SpanRow.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ export const SpanRow = ({
109109
)}
110110

111111
{isShowedChildrens &&
112-
childrens.map((child) => (
112+
childrens.map((child, index) => (
113113
<SpanRow
114+
key={index}
114115
left={left}
115116
right={right}
116117
root={root}

public/packages/app/src/features/project/incidents/components/PlatformSection.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ export const PlatformSection = () => {
77

88
return (
99
<Card title="Platform" className="h-auto">
10-
<FieldLabel label="Platform">
11-
<Typography>{incident?.platform?.platform}</Typography>
12-
</FieldLabel>
13-
<FieldLabel label="Arch">
14-
<Typography>{incident?.platform?.arch}</Typography>
15-
</FieldLabel>
16-
<FieldLabel label="Release">
17-
<Typography>{incident?.platform?.release}</Typography>
18-
</FieldLabel>
10+
{Object.entries(incident?.platform || {}).map(([key, value]) => (
11+
<FieldLabel label={key}>
12+
<Typography>{value}</Typography>
13+
</FieldLabel>
14+
))}
1915
</Card>
2016
);
2117
};

public/packages/shared/traceo-types/src/types/incident.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { IProject } from "./project";
22
import { BrowserInfoType } from "./browser";
33
import { SDK } from "./sdk";
44
import { IUser } from "./user";
5+
import { Dictionary } from ".";
56

67
export enum IncidentStatus {
78
RESOLVED = "resolved",
@@ -35,7 +36,7 @@ export interface IIncident {
3536
assigned: Pick<IUser, "id" | "name" | "gravatar">;
3637
// information about incident platform only for backend SDKs
3738
// for browsers this infomation is persisted inside IError structure
38-
platform?: Platform;
39+
platform?: Dictionary<string | number>;
3940

4041
traces: Array<Trace>;
4142

relay-worker/src/db/database.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export class DatabaseService {
8181
let sqlQuery = `SELECT * FROM incident WHERE name = '${name}' AND project_id = '${projectId}'`;
8282

8383
if (message) {
84-
sqlQuery += `AND message = '${message}'`;
84+
// $4 - help to avoid issues with escaping both single and double quotes
85+
sqlQuery += ` AND message = $$${message}$$`;
8586
}
8687

8788
const result = await client.query<IIncident>(sqlQuery);
@@ -135,7 +136,7 @@ export class DatabaseService {
135136
createdAt,
136137
now,
137138
project.id,
138-
platform,
139+
JSON.stringify(platform),
139140
0
140141
]);
141142

0 commit comments

Comments
 (0)