Skip to content

(feature) Error tracking#224

Merged
Blaumaus merged 25 commits intomainfrom
feature/error-tracking
May 6, 2024
Merged

(feature) Error tracking#224
Blaumaus merged 25 commits intomainfrom
feature/error-tracking

Conversation

@Blaumaus
Copy link
Copy Markdown
Member

@Blaumaus Blaumaus commented Mar 30, 2024

Ticket:

Self-hosted support

  • Your feature is implemented for the selfhosted version of Swetrix
  • This PR only updates the production code (e.g. paddle webhooks, CAPTCHA, blog, etc.)

Database migrations

  • Clickhouse / MySQL migrations added for this PR
  • No table schemas changed in this PR

Documentation

  • You have updated the documentation according to your PR
  • This PR did not change any publicly documented endpoints

@Blaumaus Blaumaus self-assigned this Mar 30, 2024
Comment on lines +227 to +263
const errorLogDTO = (
eid: string,
pid: string,
pg: string,
dv: string,
br: string,
os: string,
lc: string,
cc: string,
rg: string,
ct: string,
name: string,
message: string,
lineno: number,
colno: number,
filename: string,
): Array<string | number | string[]> => {
return [
eid,
pid,
pg,
dv,
br,
os,
lc,
cc,
rg,
ct,
name,
message,
lineno,
colno,
filename,
dayjs.utc().format('YYYY-MM-DD HH:mm:ss'),
]
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the DTO in a separate file.

Comment on lines +328 to +348
const getEIDsArray = (eids, eid) => {
const eidsEmpty = _isEmpty(eids)
const eidEmpty = _isEmpty(eid)
if (eidsEmpty && eidEmpty) {
throw new BadRequestException(
"An array of Error ID's (eids) or a Error ID (eid) has to be provided",
)
}
if (!eidsEmpty && !eidEmpty) {
throw new BadRequestException(
"Please provide either an array of Error ID's (eids) or a Error ID (eid), but not both",
)
}

if (!eidsEmpty) {
return eids
}

return [eid]
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take the function out to the service.

Comment thread apps/production/src/analytics/analytics.controller.ts
Comment thread apps/production/src/analytics/analytics.controller.ts
Comment thread apps/production/src/analytics/analytics.controller.ts
Comment thread apps/production/src/analytics/analytics.controller.ts
Comment thread apps/production/src/analytics/dto/error.dto.ts
] as const) {
@ApiProperty()
@IsNotEmpty()
eid: string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name the field better errorId.

Comment on lines +12 to +14
take: number

skip: number
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate it!!!

Comment thread apps/production/src/analytics/dto/patch-status.dto.ts
@Blaumaus Blaumaus marked this pull request as ready for review May 5, 2024 19:10
@Blaumaus Blaumaus merged commit d7b6c73 into main May 6, 2024
@delete-merged-branch delete-merged-branch Bot deleted the feature/error-tracking branch May 6, 2024 20:24
@bengalaviz
Copy link
Copy Markdown

Any idea on when this will be available in the docker version?

@Blaumaus
Copy link
Copy Markdown
Member Author

Blaumaus commented May 7, 2024

Any idea on when this will be available in the docker version?

soon, I promise. I'll fix a few bugs related to timezones first and will start working on a new selfhosted release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants