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

(feature) Error tracking #224

Merged
merged 25 commits into from
May 6, 2024
Merged

(feature) Error tracking #224

merged 25 commits into from
May 6, 2024

Conversation

Blaumaus
Copy link
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
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
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.

] as const) {
@ApiProperty()
@IsNotEmpty()
eid: string
Copy link
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
Contributor

Choose a reason for hiding this comment

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

Validate it!!!

@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
1 check passed
@delete-merged-branch delete-merged-branch bot deleted the feature/error-tracking branch May 6, 2024 20:24
@bengalaviz
Copy link

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

@Blaumaus
Copy link
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